pvremove
Remove LVM physical volumes
TLDR
Remove a LVM label from a physical volume
Display detailed output during the operation
Remove a LVM label without asking for confirmation
Forcefully remove a LVM label
Display output in JSON format
SYNOPSIS
pvremove [options] <PhysicalVolume>
PARAMETERS
<PhysicalVolume>
The path to the physical volume (e.g., /dev/sdb1) from which to remove LVM metadata.
-f, --force
Forces the removal of LVM metadata, overriding certain checks. Use with extreme caution as it can lead to data loss if the PV is still in use.
-y, --yes
Assumes 'yes' to all prompts, allowing the command to run non-interactively.
-v, --verbose
Produces more detailed output, showing progress and additional information.
-Z, --zero y/n
Controls whether the first 4KB of the device (where LVM metadata resides) should be zeroed out. 'y' (yes) is the default; 'n' leaves the metadata untouched, which is rarely desired for a true 'removal'.
-d, --debug
Enables debug logging for diagnostic purposes.
--version
Displays the LVM2 package version.
--help
Prints a help message describing the command's usage and options.
--devices <file>
Only scan devices listed in the specified file for LVM objects.
--config <string>
Configures LVM by overriding global settings. Can be used multiple times.
--commandprofile <profile_name>
Selects a command profile to apply custom settings for the command.
DESCRIPTION
pvremove is a command-line utility used to remove LVM (Logical Volume Manager) metadata from a designated physical volume (PV). A PV is the underlying storage device (e.g., a disk partition or entire disk) that LVM uses. By removing the LVM metadata, pvremove effectively unregisters the device from the LVM system, making it no longer recognizable as an LVM component.
This command is typically used when decommissioning a physical volume from an LVM setup, for instance, before repurposing the disk for non-LVM use or re-adding it to a new LVM volume group. It is crucial to understand that pvremove only removes the LVM metadata; it does not erase any user data stored on the physical volume. If the PV was part of an active Volume Group (VG) and contained Logical Volumes (LVs) with data, those LVs must first be migrated or removed from the VG using commands like vgreduce before pvremove can be safely used. Forcing the removal of an active PV can lead to severe data loss. It is part of the LVM2 suite of tools.
CAVEATS
Data Loss Risk: If the physical volume is still part of an active Volume Group (VG) and contains Logical Volumes (LVs) with data, using pvremove (especially with -f) will lead to severe data loss. Always ensure the PV is removed from its VG using vgreduce before attempting pvremove.
Metadata Only: pvremove only removes the LVM metadata. It does not wipe or zero out the entire physical volume. Any user data residing on the device will remain, though it will no longer be accessible via LVM.
Root Privileges: This command requires root (superuser) privileges to execute successfully.
TYPICAL USAGE WORKFLOW
When decommissioning an LVM physical volume, the typical workflow involves several steps to ensure data integrity:
1. Migrate or Remove Logical Volumes: If the PV contains active Logical Volumes, migrate their data to other PVs in the Volume Group (pvmove) or remove the LVs entirely (lvremove).
2. Remove PV from Volume Group: Detach the physical volume from its Volume Group using vgreduce <VolumeGroup> <PhysicalVolume>.
3. Remove LVM Metadata: Finally, use pvremove <PhysicalVolume> to clear the LVM metadata from the device, making it available for other purposes.
HISTORY
The pvremove command is an integral part of the Logical Volume Manager (LVM) framework, a flexible disk management system for Linux. LVM was initially developed in the late 1990s, with LVM2 (the current prevalent version) significantly improving upon its predecessor. pvremove has consistently served as the command-line utility for de-registering physical volumes from LVM control, essential for system administrators managing dynamic storage.