Version 3.1-en Solaris 10 Container Guide - 3.1 5. Cookbooks Effective: 30/11/2009
5.1.12.3. The global zone mounts a file system when the local zone is booted
[dd] File systems can be provided to a local zone by the global zone not only as loopback filesystems.
The following example shows how to mount a file system as an UFS directly when t he zone is
booted. The file system is mounted by the global zone in /zones/<zonepath>/root.
Please note: According to RFE 6495558, for filesystems that have been mounted in this manner by
zoneadm -z zone1 boot, no repair of corrupt f ile syste ms will be performed. This can
therefore prevent zones from starting.
zonecfg:zone1> add fs
zonecfg:zone1:fs> set dir=/mnt
zonecfg:zone1:fs> set special=/dev/dsk/c1d0s0
zonecfg:zone1:fs> set raw=/dev/rdsk/c1d0s0
zonecfg:zone1:fs> set type=ufs
zonecfg:zone1:fs> add options rw
zonecfg:zone1:fs> info
fs:
dir: /mnt
special: /dev/dsk/c1d0s0
raw: /dev/rdsk/c1d0s0
type: ufs
options: [rw]
zonecfg:zone1:fs> end
global# zoneadm -z zone1 reboot
global# df -kZ /dev/dsk/c1d0s0
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1d0s0 7064379 3794979 3198757 55% /zones/zone1/root/mnt
5.1.12.4. The local zone mounts a UFS file system from a device
[dd] The local zone itself can also mount filesystems. To do so, the corresponding block and raw
device must be assigned to the zone. Once the zone has been restarted, the devices are available in
the zone.
zonecfg:zone1> add device
zonecfg:zone1:device> set match=/dev/dsk/c1d0s0
zonecfg:zone1:device> end
zonecfg:zone1> add device
zonecfg:zone1:device> set match=/dev/rdsk/c1d0s0
zonecfg:zone1:device> end
zonecfg:zone1> info device
device:
match: /dev/dsk/c1d0s0
device:
match: /dev/rdsk/c1d0s0
zonecfg:zone1> commit
zonecfg:zone1> exit
After installing and booting of the zone the mount can be done inside of zone1:
zone1# ls /dev/dsk
c1d0s0
zone1# mount /dev/dsk/c1d0s0 /mnt
zone1# df -k /dev/dsk/c1d0s0
Filesystem kbytes used avail capacity Mounted on
/dev/dsk/c1d0s0 7064379 3794979 3198757 55% /mnt
global# df -kZ /zones/zone1/root/dev/dsk/c1d0s0
Filesystem kbytes used avail capacity Mounted on
/zones/zone1/root/dev/dsk/c1d0s0
7064379 3794979 3198757 55% /zones/zone1/root/mnt
75