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 manage the activation status of a logical volume, do the following:
  1. 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.

  2. To deactivate all logical volumes in a volume group, use the following command:
    lvchange -an VG
  3. 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.
  4. To activate all deactivated logical volumes in a volume group, use the following command:
    lvchange -ay VG
  5. 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 the activation/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:
    volume_list = [ "VG", "VG/LV"]
    You can also use one or more tags to specify which logical devices can be activated. For example:
    volume_list = ["@tag1", "@tag2, "@tag3"]
    If you leave the brackets empty, then no device can be activated.
    volume_list = []
To manage the automatic activation of logical volumes, do the following:
  1. To enable or disable automatic activation for a volume group, use the following command:
    vgchange --setautoactivation <y|n>
  2. To enable or disable automatic activation for a logical volume, use the following command:
    lvchange --setautoactivation <y|n>
  3. 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 the activation/auto_activation_volume_list configuration option:
    auto_activation_volume_list = [ "VG", "VG/LV"]
    You can also use tags to enable autoactivation. For example:
    auto_activation_volume_list = ["@tag1", "@tag2, "@tag3"]
    If you leave the brackets empty, the automatic activation functionality is completely disabled.
    auto_activation_volume_list = []