How to configure `auto_activation_volume_list` in lvm.conf file to activate the specific VGs.
Environment
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- LVM
Issue
- We have a server with several VGs. We donot want to activate all the VGs automatically at boot time. Out of the following VGs available, only
rootvganddatavgneeds to be activated automatically.
VG Name data_vg
VG Name qa_test_vg1
VG Name qa_test_vg2
VG Name rootvg
Resolution
-
Include the VGs that need to be activated at boot in the auto_activation_volume_list parameter in
/etc/lvm/lvm.conffile. -
Rebuild initramfs once all the changes are made. This is because the
lvm.conffile is present in initramfs as well and hence to keep it updated, intramfs needs to be rebuilt. Please make sure the next reboot is with the newly built initramfs file.
Root Cause
By default /etc/rc.sysinit uses lvchange -a ay (auto-activate all):
if [ -x /sbin/lvm ]; then
if [ ! -f /.nolvm ] && ! strstr "$cmdline" nolvm ; then
action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a ay --sysinit --ignoreskippedcluster <<====
else
echo $"Logical Volume Management disabled at boot."
fi
fi
The behavior is documented in lvm.conf:
# By default, the auto_activation_volume_list is not defined and all
# volumes will be activated either automatically or by using --activate ay/-a ay.
# auto_activation_volume_list = [] <<== commented, so rc.sysinit will activate 'all' volumes
# If auto_activation_volume_list is defined and it's not empty, only matching
# volumes will be activated either automatically or by using --activate ay/-a ay.
man lvchange
If autoactivation option is used (-aay), the logical volume is activated only if it matches an item in the activation/auto_activation_volume_list set in
lvm.conf. If this list is not set, then all volumes are considered for activation. The -aay option should be also used during system boot so it's possi‐
ble to select which volumes to activate using the activation/auto_activation_volume_list setting.
Example usage to activate only rootvg and data_vg:
auto_activation_volume_list = [ "rootvg", "data_vg" ]
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.