IBM Support

Use of Filesystems Within a WPAR Environment

Question & Answer


Question

How can I use filesystems within a System Workload Partition (WPAR) ?

Answer

With the introduction of Workload Partitions (WPARs) in AIX 6, we have the ability to create multiple virtual systems within 1 running AIX context. Each System WPAR has its own AIX OS Environment, with dedicated rootvg filesystems of /, /var, /tmp, and /home. The /usr, /opt, and /proc filesystems are mounted namefs links to their counterparts in the global system.

Unless a System WPAR contains a volume group inside it, for example, in a rootvg WPAR, there would be no LVM operations available within the WPAR. In this case, any filesystem that is needed for data use must be created out in the global environment, then set up so the WPAR can access it. There are two ways to use a local (JFS or JFS2) filesystem in this manner.


1. Using a Filesystem Within a Single System WPAR

If the administrator prefers to use a filesystem inside a single System WPAR exclusively, it can be created in this manner, from the global environment.

First, create a filesystem using crfs.  Be sure to begin the path of the mount point with the base directory of the WPAR you would like to associate it with.

From the AIX command line an example would be:
# crfs -v jfs2 -g testvg -u mywpar -A no -a size=10M -m /wpars/mywpar/datafs

This command creates a 10 Mb JFS2 filesystem in volume group "testvg", set to not automatically mount at system boot time, under the WPAR base directory /wpars/mywpar with mount point /datafs. It also sets the mount group "mywpar" so anytime that WPAR is started, this filesystem will be mounted.

When the WPAR is started, from the global environment you will see the filesystem mounted as:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv12        32768     32096    3%        4     1% /wpars/mywpar/datafs


From inside the wpar "mywpar" the filesystem would appear like this:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv12        32768     32096    3%        4     1% /datafs


An existing filesystem can be moved for use from within a single WPAR by adding the mount group for the WPAR and changing the mount point to that WPAR's base directory.

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv00        65536     13360   80%        6     1% /notefs

We want to move this within the WPAR "mywpar". First, change the mount group:
# chfs -u mywpar /notefs

Next change the mount point:
# chfs -m /wpars/mywpar/notefs /notefs


2. Using a Shared Filesystem

Filesystems can also be shared between the global environment and WPARs. In these instances, the same technique is used for /usr and /opt filesystems, using namefs to mount the existing filesystems inside the WPAR. Using namefs will create a link between the mount point inside the System WPAR and the mount point out in the global environment.

Using an existing filesystem that is mounted in the global AIX environment:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv11      2097152   1976784    6%        6     1% /myfs

We want to make the filesystem available within WPAR "mywpar" at the same mount point. This can be done by using crfs, specifying the mount point within the WPAR, the VFS (virtual filesystem) type of namefs, and mount group of "mywpar":

$ crfs -v namefs -d /myfs -m /wpars/mywpar/myfs -u mywpar

When viewed from the global environment you will see the filesystem mounted twice, using two paths:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/fslv11      2097152   1976784    6%        6     1% /myfs
/myfs            2097152   1976784    6%        6     1% /wpars/mywpar/myfs

Notice the mount points, and the filesystem device is different.  The path /wpars/mywpar/myfs refers to the namefs "device" /myfs, whereas the original filesystem /myfs uses the LVM logical volume device /dev/fslv11.

Using the mount command, you can see what the filesystem type is:

# mount
  node      mounted       mounted over        vfs       date        options
-------- --------------  ---------------     ------ ------------ ---------------
         /dev/fslv11     /myfs                jfs2   Feb 20 14:11 rw,log=INLINE
         /myfs           /wpars/mikewpar/myfs namefs Feb 20 17:22 rw  

From inside the wpar you will see the filesystem mounted:

Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/myfs            2097152   1976784    6%        6     1% /myfs


Live WPAR Mobility Considerations
Since this WPAR is using local filesystems, it will not have the ability to be moved to another global environment using live WPAR mobility. This ability would require the WPAR to be using NFS filesystems.

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"}],"Version":"6.1;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
14 November 2019

UID

isg3T1011373