Site icon UnixArena

How to assign VXFS FS to Solaris local zone from global ?

Adding veritas filesystems to zones

How to assign different type of filesystems from Solaris global zone to local zone ? The filesystem type could be type of vxfs , zfs or ufs. Oracle Solaris offers various way of assigning filesystem to Solaris zones.But we need to find out the best method for adding different type filesystems  to local zones. The best method must meet the following. 

1. Filesystems can be added to the local zones on fly without rebooting the server.
2. Newly added filesystem should be come up automatically when the zone reboots.

We will differentiate filesystems in to ZFS and Non ZFS. Here we will see about adding/assigning  Non-ZFS filesystems in to local zones and this could be done in two ways.

1.Non ZFS filesystems can be mounted using lofs.(Here i have shown for veritas filesystem)
Existing Setup:

bash-3.00# df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UADG/vol1
                       100M   3.1M    91M     4%    /vol1
bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
  17 sol1             running    /export/zone/sollz1            native   shared

We will see how to add the /vol1 to local zone “sol1” without rebooting it using lofs method.But /vol1 should be mounted in global zone before proceeding the below steps.

bash-3.00# mount -F lofs /vol1 /export/zone/sollz1/root/vol1
mount: Mount point /export/zone/sollz1/root/vol1 does not exist.
bash-3.00# mkdir -p /export/zone/sollz1/root/vol1
bash-3.00# mount -F lofs /vol1 /export/zone/sollz1/root/vol1
bash-3.00# zlogin sol1 df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/vol1                  100M   3.1M    91M     4%    /vol1

The mount details will look like below for both vxfs & lofs.

bash-3.00# mount -v |grep vol1
/dev/vx/dsk/UADG/vol1 on /vol1 type vxfs read/write/setuid/devices/delaylog/largefiles/qio/ioerror=mwdisable/xattr/dev=4147530 on Thu May 30 20:50:22 2013
/vol1 on /export/zone/sollz1/root/vol1 type lofs read/write/setuid/devices/dev=4147530 on Thu May 30 20:54:29 2013


To make the above work persist across the reboot,you need to add it zonecfg.
Note:/vol1 should be in global zone’s vfstab to mount vxfs across the reboot.

bash-3.00# zonecfg -z sol1
zonecfg:sol1> add fs
zonecfg:sol1:fs> set dir=/vol1
zonecfg:sol1:fs> set special=/vol1
zonecfg:sol1:fs> set type=lofs
zonecfg:sol1:fs> end
zonecfg:sol1> commit
zonecfg:sol1> exit
bash-3.00# zonecfg -z sol1 info
zonename: sol1
zonepath: /export/zone/sollz1
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
fs:
        dir: /vol1
        special: /vol1
        raw not specified
        type: lofs
        options: []

verifying our work,

bash-3.00# zoneadm -z sol1 halt
bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - sol1             installed  /export/zone/sollz1            native   shared
bash-3.00# df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UADG/vol1
                       100M   3.1M    91M     4%    /vol1
bash-3.00# mount -v |grep vol1
/dev/vx/dsk/UADG/vol1 on /vol1 type vxfs read/write/setuid/devices/delaylog/largefiles/qio/ioerror=mwdisable/xattr/dev=4147530 on Thu May 30 20:50:22 2013
bash-3.00# zoneadm -z sol1 boot
bash-3.00# mount -v |grep vol1
/dev/vx/dsk/UADG/vol1 on /vol1 type vxfs read/write/setuid/devices/delaylog/largefiles/qio/ioerror=mwdisable/xattr/dev=4147530 on Thu May 30 20:50:22 2013
/vol1 on /export/zone/sollz1/root/vol1 type lofs read/write/setuid/devices/dev=4147530 on Thu May 30 22:01:56 2013
bash-3.00# zlogin sol1 df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/vol1                  100M   3.1M    91M     4%    /vol1


2.Mounting Non-ZFS filesystem in to local zone’s root path directly.
(Easy and recommend method for adding filesystems to local zone )
In this method,We can directly mount the vxfs filesystems to local zone’s root path.So we no need to mount the filesystem in global and you don;t see it if you do “df -h” .In the first method ,you need to maintain global zone’s vfstab and zone’s configuration.But here just modifying zone’s configuration will be sufficient. 

bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
  18 sol1             running    /export/zone/sollz1            native   shared
bash-3.00# mount -F vxfs /dev/vx/dsk/UADG/vol1 /export/zone/sollz1/root/vol1
bash-3.00# zlogin sol1 df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/vol1                  100M   3.1M    91M     4%    /vol1

To make the above work persist across the reboot,you need to modify zone’s configuration.

bash-3.00# zonecfg -z sol1
zonecfg:sol1> add fs
zonecfg:sol1:fs> set type=vxfs
zonecfg:sol1:fs> set special=/dev/vx/dsk/UADG/vol1
zonecfg:sol1:fs> set raw=/dev/vx/rdsk/UADG/vol1
zonecfg:sol1:fs> set dir=/vol1
zonecfg:sol1:fs> end
zonecfg:sol1> commit
zonecfg:sol1> verify
zonecfg:sol1> exit
bash-3.00# zoneadm -z sol1 boot
bash-3.00# zlogin sol1 df -h /vol1
Filesystem             size   used  avail capacity  Mounted on
/vol1                  100M   3.1M    91M     4%    /vol1
bash-3.00# df -h /export/zone/sollz1/root/vol1
Filesystem             size   used  avail capacity  Mounted on
/dev/vx/dsk/UADG/vol1
                       100M   3.1M    91M     4%    /export/zone/sollz1/root/vol1


Hope you have learned about assigning/adding veritas filesystem in to local zones.

Thank you for reading this article.

Exit mobile version