vgchange
Activate or deactivate volume groups
TLDR
Change the activation status of logical volumes in all volume groups
Change the activation status of logical volumes in the specified volume group (determine with vgscan)
SYNOPSIS
vgchange [options] { -a | --activate } [y|n] VolumeGroupName...
PARAMETERS
-a[y|n]
Activates or deactivates the volume group. 'y' activates, 'n' deactivates. Equivalent to --activate [y|n].
--activate {ay|ey|ly|n}
Specifies the type of activation: 'ay' for auto activation (attempt activation on all disks), 'ey' for exclusive activation (fail if any LV is active elsewhere), 'ly' for logical volume activation (only if LVs can be activated), 'n' for deactivation.
-l | --lockopt String
Used to set the lock options.
-c | --clustered {y|n}
Changes the clustered locking state of a volume group. Use 'y' for clustered locking, 'n' for non-clustered locking.
-p | --partial
Allow activation of a volume group with missing PVs.
--addtag Tag
Adds a tag to the volume group.
--deltag Tag
Deletes a tag from the volume group.
-u | --uuid
Generates a new UUID for the Volume Group.
-h | --help
Displays help text and exits.
-v | --verbose
Enables verbose output.
-t | --test
Run in test mode. No changes are made.
DESCRIPTION
The vgchange command is used to activate or deactivate Logical Volume Manager (LVM) volume groups. Activating a volume group makes its logical volumes accessible for use (e.g., mounting file systems). Deactivating a volume group prevents access to its logical volumes. Activation is typically done at boot time using system init scripts, while deactivation might be used for maintenance, unmounting file systems, or when physically moving the disks. The command also supports changing attributes of a volume group, such as its clustered status or whether it's exported for remote access.
Volume Groups can be activated exclusively and read-only, if they are inactive, or exclusively and read-write if they are currently active.
A volume group can be activated on only one node in a cluster at a time. Activating a volume group makes its logical volumes accessible for use. This command provides a method of changing the attributes of a volume group.
CAVEATS
Activating a volume group with missing physical volumes can lead to data loss if the missing volumes are critical. Clustered volume groups should be carefully managed to prevent split-brain scenarios.
EXAMPLES
To activate a volume group named 'myvg': vgchange -a y myvg
To deactivate a volume group named 'myvg':vgchange -a n myvg
To activate volume group exclusive:vgchange --activate ey myvg
EXIT STATUS
The vgchange command returns an exit code of 0 for success and a non-zero value for failure.
HISTORY
The vgchange command is a standard part of LVM2, which evolved from the original LVM implementation. LVM was created to provide a more flexible and scalable approach to storage management compared to traditional partitioning. vgchange has been consistently updated to support new features and enhancements in LVM over time.