
pvremove Command in Linux
The pvremove command in Linux removes the physical volume (PV) from the LVM (Logical Volume Manager) by erasing its LVM metadata. It erases the label on a device, preventing LVM from recognizing it as a physical volume.
Note: A physical volume cannot be removed from a volume group while an active logical volume is using it.
Table of Contents
Here is a comprehensive guide to the options available with the pvremove command −
Syntax of pvremove Command
The syntax of the pvremove command in Linux is as follows −
pvremove [options] [physical_volumeâ¦]
In the above syntax, the [options] field is used to specify the options to modify the command's output. The [physical_volume] field is used to specify one or more device names ( example: /dev/sdX) from which LVM metadata will be removed.
pvremove Command Options
The options of the Linux pvremove command are listed below −
Flags | Options | Description |
---|---|---|
--commandprofile String | Specifies a command profile for configuration. | |
--devices PV | Specifies devices for the command, and accepts list or multiple entries. | |
--devicesfile String | Specifies a file listing LVM devices (managed by lvmdevices). | |
--driverloaded y|n | Disables device-mapper use when set to n (for testing). | |
-f | --force | Override checks, confirmations, and protections. Use with caution. |
-h | --help | Displays help text. |
--journal String | Logs command information to systemd journal. | |
--lockopt String | Passes special options to lvmlockd. | |
--longhelp | Displays extended help text. | |
--nohints | Disables hints file usage for locating PVs. | |
--nolocking | Disables LVM locking mechanism. | |
--profile String | Alias for --commandprofile or --metadataprofile. | |
-q | --quiet | Suppresses output/log messages. Repeat to suppress prompts. |
--reportformat basic|json | Sets output format (basic table or JSON). | |
--setphysicalvolumesize Size[m|UNIT] | Manually sets PV size, overriding auto-detection. | |
-t | --test | Runs in test mode, preventing metadata updates. |
-v | --verbose | Sets verbosity for detailed messages. |
--version | Displays version information. | |
-y | --yes | Automatically confirms prompts with yes (use with caution). |
Examples of pvremove Command in Linux
In this section, the usage of the pvremove command in Linux will be discussed with examples −
- Removing LVM Metadata of Physical Volumes (PVs)
- Removing LVM Metadata of Physical Volumes (PVs) Forcefully
- Removing LVM Metadata Physical Volumes (PVs) even when Part of an Active Volume Group
- Getting Verbose Output
- Running the pvremove Command in Test Mode
- Displaying Usage Help
Removing LVM Metadata of Physical Volumes (PVs)
To remove the LVM metadata from the specified device, use the command given below −
sudo pvremove /dev/vda3
Note: A physical volume cannot be removed from a volume group while an active logical volume is using it. Using the force option (-ff) removes a physical volume from an existing volume group, but vgreduce is the recommended method.

Similarly, to remove the LVM metadata from multiple devices, use the pvremove command in the following way −
sudo pvremove /dev/vdaX /dev/vdbY
Removing LVM Metadata of Physical Volumes (PVs) Forcefully
The -f or --force option forces the removal of LVM metadata from a PV without confirmation prompts.
sudo pvremove /dev/vdaX /dev/vdbY
Removing LVM Metadata Physical Volumes (PVs) even when Part of an Active Volume Group
If the physical volume (PV) is a part of the active logical volume, use the -ff option to force the removal of PV from the volume group. However, it is safer to use vgreduce in such cases to remove the PV properly.
sudo pvremove -f /dev/vda3

Type y and press Enter to continue the process.
Getting Verbose Output
To get verbose output, use the -v or --verbose option with the pvremove command.
sudo pvremove -ff /dev/vda3
Running the pvremove Command in Test Mode
To dry run the pvremove command, use the -t or --test option −
sudo pvremove -v /dev/vda3
Displaying Usage Help
To display usage help of the pvremove command, use the -h or --help option −
pvremove -h
To display the detailed help, use the --longhelp option −
pvremove --longhelp
Conclusion
The pvremove command is used to disassociate a physical volume from LVM by erasing its metadata. It effectively makes the device a normal block device again. Use caution when applying force options to prevent unintended data loss, especially when the physical volume is part of an active volume group.
It is important to note that a physical volume cannot be removed if it is part of an active volume group with logical volumes in use. Proper care should be taken when using options like --force or -ff to avoid unintended data loss or system issues.