Managing Activation and Automatic Activation
You can activate or deactivate logical volumes using the lvchange
command. Activating a logical volume makes the logical volume usable through a block
device. Deactivating a logical volume makes the logical volume inactive and inaccessible
to the kernel.
Additionally, you can enable automatic activation for logical volumes or volume groups,
which applies to all logical volumes in the volume group. Automatic activation activates
logical volumes in response to attaching an LVM device to a machine. When you attach all
physical volumes in a volume group, the volume group is complete, and the logical
volumes in the volume group automatically activate. This automatic behavior can be
disabled or enabled using vgchange
or lvchange
with
the --setautoactivation
option.
You can also control which logical volumes can be automatically activated by listing
which logical volumes can be activated in the /etc/lvm/lvm.conf
auto_activation_volume_list
parameter.
- To deactivate a logical volume, use the following
command:
lvchange -an VG/LG
In the previous, VG is the name of the volume group and LG is the name of the logical volume to be deactivated.
- To deactivate all logical volumes in a volume group, use the following
command:
lvchange -an VG
- To activate a deactivated logical volume, use the following
command:
lvchange -ay VG/LG
Note:
systemd
automatically mounts LVM volumes using the mount points specified in the/etc/fstab
file. - To activate all deactivated logical volumes in a volume group, use the following
command:
lvchange -ay VG
- To control which logical volumes can be activated using
lvchange
commands described above, you can also use the/etc/lvm/lvm.conf
configuration file, with theactivation/volume_list
configuration option. The following example shows that the volume list can specify an entire volume group or just one logical volume within a volume group:
You can also use one or more tags to specify which logical devices can be activated. For example:volume_list = [ "VG", "VG/LV"]
volume_list = ["@tag1", "@tag2, "@tag3"]
If you leave the brackets empty, then no device can be activated.volume_list = []
- To enable or disable automatic activation for a volume group, use the following
command:
vgchange --setautoactivation <y|n>
- To enable or disable automatic activation for a logical volume, use the
following
command:
lvchange --setautoactivation <y|n>
- To control automatic activation using the
/etc/lvm/lvm.conf
configuration file, specify volume groups, or a volume group and a specific logical volume within it, to theactivation/auto_activation_volume_list
configuration option:
You can also use tags to enable autoactivation. For example:auto_activation_volume_list = [ "VG", "VG/LV"]
auto_activation_volume_list = ["@tag1", "@tag2, "@tag3"]
If you leave the brackets empty, the automatic activation functionality is completely disabled.auto_activation_volume_list = []