Using Mount Groups for Nested Mounts in AIX

Technote (FAQ)


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?


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.


There are two solutions to this:

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.

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 /etc/rc script ( bos610 src/bos/etc/rc/ ) has this portion that performs all the local mounts for filesystems that were not mounted during initial boot:

# Perform all auto mounts
dspmsg 4 ' Performing all automatic mounts \n'

# Remove the file 'fs1.$$' if it already exists
rm -f /tmp/fs1.$$

# handle the egrep line carefully: between each pair of brackets is a tab
# followed by a space, and the tab may get lost if you copy and paste the line
egrep -vp "^[ ]*vfs[ ]*=[ ]*(cachefs|nfs|cifs)[ ]*$" \
/etc/filesystems > /tmp/fs1.$$

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:

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:

5.3, 6.1, 7.1

Operating system(s):


Reference #:


Modified date:


Translate my page

Content navigation