Dynamically Adding a RAW device to a Solaris zone.

por | 17 enero, 2019

http://nilesh-joshi.blogspot.com/2012/02/dynamically-adding-raw-device-to.html

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?Posted by Nilesh Joshi at 2/11/2012 01:36:00 AM

13 comments:

  1. AnonymousJune 15, 2012 at 7:45:00 PM GMT+5:30Thanks Man

    Rgds
    VinayanReply
  2. AnonymousSeptember 12, 2012 at 7:17:00 AM GMT+5:30you 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 🙂Reply
  3. Nilesh JoshiSeptember 20, 2012 at 12:18:00 AM GMT+5:30Glad to see that this post helped you. 

    Tx/NileshReply
  4. AnonymousNovember 9, 2012 at 2:17:00 AM GMT+5:30check «devfsadm -z -Cv» after assigning dev match to zone configReply
  5. AnonymousNovember 27, 2012 at 1:55:00 AM GMT+5:30How about Soalaris 11 zones, The mknod mothod does not work any more??Reply
  6. AnonymousJanuary 9, 2013 at 1:53:00 PM GMT+5:30thanks !
    Reply
  7. AnonymousMarch 17, 2013 at 3:16:00 PM GMT+5:30On 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> endReply
  8. AnonymousOctober 25, 2013 at 5:50:00 PM GMT+5:30do we need to reboot after adding ASM disk in solaris 11?
    If yes is there any other way to do it without reboot of zone?Reply
  9. AnonymousNovember 20, 2013 at 3:30:00 PM GMT+5:30Thanks, you saved my day!Reply
  10. Krishna MohanFebruary 17, 2014 at 1:34:00 PM GMT+5:30This comment has been removed by the author.Reply
  11. AnonymousFebruary 18, 2014 at 8:23:00 PM GMT+5:30Is there a way to accomplish the same thing for Solaris 11 zones?Reply
  12. AnonymousMarch 31, 2014 at 6:13:00 PM GMT+5:30Note you can do ls -lL on /dev/rdsk/c3t60050768018A8023B8000000000000F0d0s0
    rather than doing two stagesReply
  13. AnonymousOctober 17, 2016 at 12:55:00 PM GMT+5:30HI ,

    mknod command is working for the metaset device .

    #cd /dev//rdsk
    #mknod d135 c 85 30489 


    d135 is a metadevice 

    can you please provide me the procedure to make raw meta device visibleReply