Wednesday, July 9, 2008

Solaris 10: mount a disk slice in a sub-zone

Non-global zones in Solaris 10 do not have the ability to see drives or disk slices (to prove this, list the contents of /dev/dsk from within a zone). What filesystems are mounted in which zones is controlled exclusively from the global zone. This recipe describes persistently mounting a disk slice in a non-global zone.
To mount the device c0t1d0s3 in the existing zone testzone under the mount point /mnt, login to the global zone and become root or a priviledged user and complete the following steps:



zonecfg -z testzone
zonecfg:testzone> add fs
zonecfg:testzone:fs> set dir=/mnt
zonecfg:testzone:fs> set special=/dev/dsk/c0t1d0s3
zonecfg:testzone:fs> set raw=/dev/rdsk/c0t1d0s3
zonecfg:testzone:fs> set type=ufs
zonecfg:testzone:fs> end
zonecfg:testzone> verify
zonecfg:testzone> commit
zonecfg:testzone> exit

Following the commit command, the filesystem will be immediately available in the zone. Substitute the desired mount point and device name for your system. If the zone has not yet been created, you can use the 'add fs' commands when creating the zone.

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...