Adding File Systems for Zone Use
You can add multiple file systems for zone use through the fs
resource. This resource has multiple file system types. The following examples show how to use the LOFS and UFS file types. For examples of using ZFS, the default file system type, see Configuring the dataset Property on solaris Zones.
Example 3-2 Sharing a Directory With the Global Zone
This example specifically involves the type called loopback file system (lofs
) which enables a zone to share a directory with the global zone. The lofs
file system type is also used to grant zone access to media such as a DVD drive.
Suppose that you want to grant zone access to the /opt/mysoftware
directory in the global zone. In the example's different commands, special
identifies the global directory to be shared, dir
specifies the mount point in the zone through which the global directory is accessed, and options
specifies the zone permissions (read-only) in the shared directory. The read-only permission prevents users in the non-global zone from making changes to the global zone directory.
global$ zonecfg -z zoneA zonecfg:zoneA> add fs zonecfg:zoneA:fs> set type=lofs zonecfg:zoneA:fs> set special=/opt/mysoftware zonecfg:zoneA:fs> set dir=/usr/software zonecfg:zoneA:fs> set options=ro zonecfg:zoneA:fs> end zonecfg:zoneA> info ... fs 0: dir: /usr/software special: /opt/mysoftware raw not specified type: lofs options: [ro] ... zonecfg:zoneA> exit global$ Reboot or run zoneadm apply command.
Example 3-3 Assigning a UNIX File System to a Zone
The fs
resource also supports UNIX file systems (UFS). Suppose that you have a UFS file system on the slice /dev/rdsk/c1t1d0s0
. This example shows how to make that file system available to the zone.
In the example, special
identifies the block device path of the UFS file system, raw
is the raw device path where the fsck
process is run, and dir
is the mount point of the file system for the zone.
global$ zonecfg -z zoneA zonecfg:zoneA> add fs zonecfg:zoneA:fs> set type=ufs zonecfg:zoneA:fs> set special=/dev/dsk/c1t1d0s0 zonecfg:zoneA:fs> set raw=/dev/rdsk/c1t1d0s0 zonecfg:zoneA:fs> set dir=/data zonecfg:zoneA:fs> end zonecfg:zoneA> exit global$ zonecfg -z zoneA info ... fs 0 dir: /usr/software special: /opt/mysoftware raw not specified type: lofs options: [ro] fs 1 dir: /data special: /dev/dsk/c1t1d0s0 raw: /dev/rdsk/c1t1d0s0 type: ufs options: [ ] ... global$Reboot or run zoneadm apply command.