Find it

Loading...

Saturday, February 11, 2012

Dynamically Adding a RAW device to a Solaris zone.

Dynamically Adding a RAW device to a Solaris zone.

By default it is not possible to add raw device to zone without taking a reboot on zone however there is a famous saying => "There is always a way out for those clever enough to find it". So I'm, just kidding, don't take it seriously. :)

I found a little hack to accomplish the objective of adding raw device to zone without rebooting it. Here is a way out -

1) Add the device to the zonecfg

#zonecfg -z barvozone1
zonecfg:barvozone1> add device
zonecfg:barvozone1:device> set match=/dev/rdsk/c3t60050768018A8023B8000000000000F0d0s0
zonecfg:barvozone1:device> end
zonecfg:barvozone1>exit

2) use the mknod command to create the device in the zones dev folder

#ls -l /dev/rdsk/c3t60050768018A8023B8000000000000F0d0s0
lrwxrwxrwx   1 root     root          67 Feb 18 15:34 /dev/rdsk/c3t60050768018A8023B8000000000000F0d0s0 -> ../../devices/scsi_vhci/ssd@g60050768018a8023b8000000000000f0:a,raw

#ls -l /devices/scsi_vhci/ssd@g60050768018a8023b8000000000000f0:a,raw
crw-r-----   1 root     sys      118, 128 Mar  5 23:55 /devices/scsi_vhci/ssd@g60050768018a8023b8000000000000f0:a,raw

# cd /barvozone1/zonepath/dev

# mknod c3t60050768018A8023B8000000000000F0d0s0 c 118 128

That's it. The raw device is now visible within zone and now you can start with your stuffs without any downtime. Isn't it cool?

7 comments:

  1. you saved my day :)

    additionally, files in ~zonepath/dev/rdsk are character files, and in ~zonepath/dev/dsk are block files, so the actual command works for me are something like
    # cd /barvozone1/zonepath/dev/dsk
    # mknod c3t60050768018A8023B8000000000000F0d0s0 b 118 128
    # cd /barvozone1/zonepath/dev/rdsk
    # mknod c3t60050768018A8023B8000000000000F0d0s0 c 118 128

    then i can see the disk in local zone format output, and use it :)

    ReplyDelete
  2. Glad to see that this post helped you.

    Tx/Nilesh

    ReplyDelete
  3. check "devfsadm -z -Cv" after assigning dev match to zone config

    ReplyDelete
  4. How about Soalaris 11 zones, The mknod mothod does not work any more??

    ReplyDelete
  5. On Solaris 11 ,you may need to add try as below

    On Solaris 11:
    zonecfg:rac4Zone> add device
    zonecfg:rac4Zone:device> set match=/dev/rdsk/c1t0d0s0
    zonecfg:rac4Zone:device> set allow-partition=true
    zonecfg:rac4Zone:device> set allow-raw-io=true
    zonecfg:rac4Zone:device> end

    ReplyDelete