vgreduce
Remove physical volumes from a volume group
SYNOPSIS
vgreduce [options] VolumeGroupName [PhysicalVolumePath...]
PARAMETERS
-a, --all
Reduce all volume groups by removing any empty physical volumes.
-f, --force
Bypass some checks; use with extreme caution as it can lead to data loss.
-t, --test
Run in test mode; actions are not actually performed but printed.
-v, --verbose
Provide more detailed output.
--removemissing
Remove all missing physical volumes from the specified volume group(s).
--noudevsync
Disable udev synchronization. Use if udev is not running or causing issues.
--version
Display the version of LVM2 tools.
-h, --help
Display a help message and exit.
DESCRIPTION
vgreduce is a command-line utility used in Logical Volume Management (LVM) to reduce the size of an existing volume group (VG) by removing one or more physical volumes (PVs) from it. This operation allows an administrator to reclaim PVs for other purposes, such as adding them to different volume groups, using them for non-LVM storage, or physically removing them from the system.
Before a physical volume can be successfully removed from a volume group using vgreduce, all logical volume (LV) extents allocated on that PV must first be moved off. If any logical extents remain on the PV, vgreduce will typically fail, preventing accidental data loss. The pvmove command is commonly used to migrate data from a PV targeted for removal to other PVs within the same volume group. After vgreduce successfully removes a PV, the LVM metadata is updated, and the PV becomes available for new assignments.
CAVEATS
It is critical to ensure that no logical volumes (LVs) are allocated on the physical volume(s) being removed from a volume group. If LVs reside on the PV(s), vgreduce will prevent the operation to avoid data loss, unless overridden by --force, which is highly discouraged. Always use pvmove to migrate data off the PV before attempting to remove it. Removing a PV that still contains data will lead to immediate data corruption and potential loss of the affected logical volumes. You cannot reduce a volume group if the specified physical volume is the last remaining PV, unless it is truly empty.
HANDLING MISSING PHYSICAL VOLUMES
In scenarios where a physical volume has become permanently unavailable (e.g., disk failure, accidental removal) and its data is no longer accessible, vgreduce can be used with the --removemissing option. This option tells LVM to remove references to the missing PVs from the volume group's metadata. This action should only be performed if you are certain the PV is irretrievably lost and any data on it is already accounted for or not needed, as it will likely mark associated logical volumes as invalid or corrupted if they used extents on the missing PV. Before using this, it's crucial to understand the implications for data integrity.
HISTORY
The vgreduce command is an integral part of the Logical Volume Manager (LVM2), which is the standard LVM implementation for Linux systems. LVM itself was initially inspired by proprietary UNIX LVM implementations like those found in HP-UX. LVM2, released in the early 2000s, brought significant improvements over its predecessor (LVM1), including better scalability, robustness, and a more unified command set. vgreduce has been a stable and essential component of LVM2 since its inception, providing administrators with the flexibility to manage and optimize storage resources dynamically by safely shrinking volume groups as needed. Its functionality is fundamental to maintaining efficient and adaptable disk configurations in modern Linux environments.