IBM Support

Using Mount Groups for Nested Mounts in AIX

Technote (FAQ)


Question

I have filesystems that depend on others to be mounted in the filesystem tree. How can I make sure these are mounted in the correct order?

Cause

An example of this setup, also known as "nested mounts" would be:
/dev/oralv mounted as /oracle
/dev/orhomelv mounted as /oracle/home
/dev/orainstlv mounted as /oracle/home/orainst
/dev/oraloglv mounted as /oracle/home/logs

If the logical volumes and filesystems are not created in this exact order, then after 'importvg' is run for this volume group the /etc/filesystems file will show the order they were created, rather than the order they need to be mounted.

For example if an attempt to mount /oracle/home is made before the parent filesystem /oracle is mounted, there will be no directory to mount /oracle/home onto, as the directory exists inside the /oracle filesystem.

# mount /oracle/home
mount: 0506-324 Cannot mount /dev/orhomelv on /oracle/home: A file or directory in the path name does not exist.


Answer

While you may be tempted to manually edit the /etc/filesystems file and arrange the filesystems in the proper order, this is not recommended. The main reason is the filesystems will be removed from this file during export of a volume group, and added again during importvg. If they are added they will be put in the order they appear in the VGDA, which may not be the correct order for mounting purposes.

Also typos or other mistakes in /etc/filesystems can cause filesystem mount problems during the system boot.

Solutions:

1. Remove the filesystems from the volume group and recreate them in the order they should be mounted.

This may not be practical if they already contain data and are being used.

2. Use "mount groups" to mount the filesystems in a specific order.
The "-u mountgroup" option to crfs and chfs can be used to add a mount group name to any filesystem.
Then the "-t type" option to the mount command will mount all filesystems matching with that specific "type", or mount group.

A) First, divide the filesystems you wish to modify into groups, and assign a "type" to them for each group.

Using the above filesystems as an example, we make 3 groups, and to help remember which order they are to be mounted name them "first", "second" and "third".

Create the first group:
# chfs -u "first" /oracle

Create the second group, which depends on a mount having been performed in the previous group:
# chfs -u "second" /oracle/home

Create the third group, which depends on both the previous two groups:
# chfs -u "third" /oracle/home/orainst
# chfs -u "third" /oracle/home/logs

B) Now we must modify the /etc/rc script to use these mount groups.

A current version of the script /etc/rc has this portion that performs all the local mounts for filesystems that were not mounted during initial boot:

mount /tmp/fs1.$$ /etc/filesystems
mount all
umount /etc/filesystems
rm -f /tmp/fs1.$$

Save a backup copy of the /etc/rc file:
# cp /etc/rc /etc/rc.ORIG

Modify the script to use your mount groups in the proper order, before mounting the rest of the filesystems:

mount /tmp/fs1.$$ /etc/filesystems
mount -t first
mount -t second
mount -t third
mount all
umount /etc/filesystems
rm -f /tmp/fs1.$$

The 'mount all' may print errors about the filesystems in your mount groups already being mounted, but that's OK.

The /etc/rc file is considered a user-customizable script and will not be overwritten during updates to AIX (such as Technology Level or Service Pack updates).

Document information

More support for: AIX family

Software version: Version Independent

Operating system(s): AIX

Reference #: T1010981

Modified date: 2011-08-01