Sunday, 21 October 2018

How to configure Solaris Zone to access a CDROM By Devan

How to configure Solaris Zone to access a CDROM

There are times when it would be useful for a zone to access it’s host system’s CDROM device. This can be done using the Loop Back File System(lofs).

Procedure for Solaris 10

# zonecfg -z zone01
zonecfg:zone01> add fs
zonecfg:zone01:fs> set dir=/cdrom
zonecfg:zone01:fs> set special=/cdrom
zonecfg:zone01:fs> set type=lofs
zonecfg:zone01:fs> end
zonecfg:zone01> commit
zonecfg:zone01> exit
Solaris 10 uses the vold SMF service to mount a CDROM/DVD. The above set of commands adds a loop back file system to mount the global /cdrom file system on the /global directory of the non-global zone. The commit command writes the zone configuration from memory to disk. Next, reboot the non-global zone to make the configuration changes effective.
# zonecfg -z zone01 reboot
Place the media into the system’s CDROM drive. After it is mounted in the global zone, it will be available to the non-global zone, zone01 in this example. Once you are finished using the CDROM, type eject from the global zone to retrieve the CD media.

Procedure for Solaris 11

The value of the attribute “special” in the zones configuration should be ‘/media’ for Solaris 11. ‘/media’ is the standard path on Global zone where CDROM media gets mounted by rmmount command. Ensure the package media-volume-manager is installed
global_zone # pkg list media-volume-manager
NAME (PUBLISHER)                                  VERSION                    IFO
system/storage/media-volume-manager               0.5.11-0.175.3.3.0.3.0     i--
Ensure the SMF filesystem/rmvolmgr is ‘online’. Solaris 11 uses the rmvolmgr SMF service to mount a CDROM/DVD
global_zone # svcs rmvolmgr
STATE          STIME    FMRI
online         12:14:20 svc:/system/filesystem/rmvolmgr:default
Check the available devices and aliases and default for the CDROM on Global zone. In this case you can see the title of the currently mounted Solaris_10 DVD with title ‘SOL_10_SPARC’. Look for the DVD device in global zone :
global_zone # ls -l /dev/removable-media/dsk/*s2
lrwxrwxrwx   1 root     root          18 Aug 27  2012 /dev/removable-media/dsk/c3t0d0s2 -> ../../dsk/c3t0d0s2
Mount the DVD in global zone :
global_zone # rmmount /dev/dsk/c3t0d0s2
/dev/dsk/c3t0d0s2 mounted at /media/SOL_10_SPARC
List aliases :
global_zone # rmmount -l
/dev/dsk/c3t0d0s2    cdrom,cdrom0,cd,cd0,sr,sr0,SOL_10_SPARC,/media/SOL_10_SPARC
List default device :
global_zone # rmmount -d
Default device is: cdrom
Add the device to a non-global-zone using zonecfg :
global_zone # zonecfg -z zone01
zonecfg:my-zone> add fs
zonecfg:my-zone:fs> set dir=/cdrom
zonecfg:my-zone:fs> set special=/media
zonecfg:my-zone:fs> set type=lofs
zonecfg:my-zone:fs> add options [ro,nodevices]
zonecfg:my-zone:fs> end
zonecfg:my-zone:fs> commit
zonecfg:my-zone:fs> exit
In case the System is running Solaris 11.2 or higher, the modifications done by zonecfg can be applied online (without reboot of the non-global zone) by
# zoneadm -z zone01 apply
For Solaris 11 versions older than 11.2 you must reboot the non-global zone to activate the zonecfg changes. Confirm that the content of the DVD is visible in non-global zone :
global_zone # zlogin zone01 ls -l /cdrom/                
total 4
drwxr-xr-x   7 root     other       2048 Dec  4  2002 SOL_10_SPARC
global_zone # zlogin zone01 ls -l /cdrom/SOL_10_SPARC

No comments:

Post a Comment