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] [VolumeGroupName...]
PARAMETERS
-a|--activate {y|n|{l|p|r}}
Activates (y) or deactivates (n) volume groups. Options l (local), p (partial), r (read-only) provide more granular control over activation.
-d|--deactivate
Deactivates volume groups (equivalent to -a n).
-K|--ignoreactivationskip
Ignores the 'activation skipped' flag on a volume group, forcing activation.
-p|--partial
Activates VGs with missing physical volumes (PVs), allowing access to remaining LVs. Use with caution as data might be incomplete.
-s|--scan
Scans for all VGs on the system and refreshes LVM's cache without changing their state.
-t|--test
Runs in test mode, showing what would happen without making actual changes to the system.
-v|--verbose
Provides verbose output, showing more details about the operations being performed.
--readonly
Sets the volume group to read-only mode, preventing writes to its logical volumes.
--readwrite
Sets the volume group to read-write mode, allowing writes.
--monitor {y|n}
Enables (y) or disables (n) monitoring of the volume group by lvmetad for event handling.
--poll {y|n}
Enables (y) or disables (n) polling for changes to the volume group, often used with monitoring.
--activationmode {partial|complete}
Controls the activation mode for LVs, affecting how LVs are brought online if physical volumes are missing.
--noudevsync
Disables udev synchronization after activation/deactivation. Use only if udev is not running or if issues arise.
DESCRIPTION
The vgchange command is a fundamental utility in Linux Logical Volume Management (LVM), used to modify the attributes of existing volume groups (VGs). Its primary function is to activate or deactivate VGs, making their logical volumes (LVs) accessible or inaccessible to the system. Activation is crucial for LVs to be mounted and used, while deactivation ensures data integrity before system shutdown or maintenance. Beyond activation, vgchange allows setting a VG to read-only or read-write, enabling monitoring, and managing tags. It is an essential command for managing the lifecycle and state of LVM storage components, particularly after system reboots, hardware changes, or during storage maintenance operations.
CAVEATS
Data Integrity: Deactivating a volume group with active logical volumes can lead to data corruption. Always unmount file systems and stop applications accessing LVs before deactivation.
Partial Activation: Using -p or --activationmode partial can activate LVs even if some underlying physical volumes are missing. While useful for recovery, it can expose incomplete data and should be used with extreme caution.
Cluster Environments: In clustered LVM setups (CLVM), vgchange must be used with care to ensure consistent state across nodes and avoid split-brain scenarios. Proper locking mechanisms are critical.
udev Synchronization: vgchange typically synchronizes with udev to ensure device nodes are correctly created or removed. Disabling this with --noudevsync can lead to stale or missing device nodes.
ACTIVATION MODES
The --activationmode option (e.g., partial, complete) offers fine-grained control over how logical volumes within a VG are activated when not all physical volumes are available. This is crucial for managing degraded arrays or performing recovery operations.
LVMETAD INTERACTION
vgchange often interacts with lvmetad, the LVM metadata daemon. Options like --monitor and --poll control how vgchange communicates with lvmetad to manage VG metadata caching and event handling, improving performance and responsiveness in dynamic LVM environments.
HISTORY
vgchange is an integral part of the Logical Volume Manager (LVM) framework, which has been a core component of Linux kernel distributions for managing storage since its introduction in the late 1990s. The command's functionality, particularly for activating and deactivating volume groups, has remained central to LVM's operation since its inception. Over time, LVM and vgchange have evolved to support advanced features like snapshots, mirroring, striping, and more robust clustering capabilities, with options like --monitor and --activationmode being added to address modern storage requirements and improve system resilience. Its continuous development reflects the ongoing need for flexible and dynamic storage management in Linux systems.