IBM Support

Mounting Filesystems in Groups

Question & Answer


Question

I have a volume group I have created, how can I mount all the filesystems in it at once?

Answer

When a volume group containing filesystems is created or imported, it may be difficult or time-consuming to mount each filesystem by hand.

Usually administrators will use either "mount -a" or "mount all" to have the mount command go through the /etc/filesystems file and mount everything. However this will cause errors regarding the filesystems that are already mounted, such as:


# mount all
mount: /dev/hd1 on /home: Device busy
mount: /dev/hd11admin on /admin: Device busy
mount: /proc on /proc: Device busy
mount: /dev/hd10opt on /opt: Device busy
mount: /dev/livedump on /var/adm/ras/livedump: Device busy
mount: /dev/auditlv on /audit: Device busy
mount: /dev/fslv01 on /backup: Device busy
mount: /dev/mylv on /myfs1: Device busy

There may be other filesystems in other volume groups you do not wish mounted, but the "mount all" command will unfortunately mount them too.

An easy remedy to this problem is to use mount groups, and assign the same group to each filesystem in the same volume group. A good name to use for the group would be the volume group name. Then the mount command can be used with the "-t" option to mount only those filesystems for that group.

Example: I have a data volume group with 4 filesystems I have just imported:

# importvg -y datavg hdisk18
datavg

# lsvg -l datavg
datavg:
LV NAME        TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
mondaylv       jfs2       20      20      1    closed/syncd  /monday
tuesdaylv      jfs2       20      20      1    closed/syncd  /tuesday
wednesdaylv    jfs2       20      20      1    closed/syncd  /wednesday
thursdaylv     jfs2       20      20      1    closed/syncd  /thursday
loglv03        jfs2log    1       1       1    closed/syncd  N/A

Now I could mount up each filesystem individually, or use "mount all", but if the filesystems have a common type I can use that.

Checking For Mount Groups
Two ways to view the "type" or group are:

# grep -p "/monday:" /etc/filesystems
/monday:
        dev             = /dev/mondaylv
        vfs             = jfs2
        log             = /dev/loglv03
        mount           = false
        check           = false
        type            = datavg
        account         = false
or

# getlvcb -f mondaylv
vfs=jfs2:log=/dev/loglv03:type=datavg:account=false

Assigning A Mount Group
If the type variable is not set then you can assign one to an existing filesystem using the chfs command:

# chfs -t datavg /monday
# chfs -t datavg /tuesday
# chfs -t datavg /wednesday
# chfs -t datavg /thursday

If you are creating a new filesystem you can set the type variable during creation:

# mklv -t jfs2 -y mondaylv datavg 20
mondaylv

# crfs -v jfs2 -m /monday -d /dev/mondaylv -a type=datavg
File system created successfully.
327464 kilobytes total disk space.
New File System size is 655360

In the SMIT menus the option is called:

  Mount GROUP                                        []

Using The Mount Group
After all the filesystems in this volume group have the type set, you can mount them with a single command:

# mount -t datavg

# df
/dev/mondaylv     655360    654600    1%      4     1% /monday
/dev/tuesdaylv     655360    654600    1%      4     1% /tuesday
/dev/wednesdaylv     655360    654600    1%      4     1% /wednesday
/dev/thursdaylv     655360    654600    1%      4     1% /thursday

Since the mount group attribute is set in the Logical Volume Control Block of each logical volume, it will be retained even if the volume group is exported and imported again.

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

Document Information

Modified date:
17 June 2018

UID

isg3T1021476