Home / Alt manpages / pvremove(8)

  • pvremove(8)
  • Admin command
  • linux

Remove an LVM PV Label Safely with pvremove

You will finish with an LVM physical volume label removed from a deliberately verified device, so LVM no longer recognises that device as a PV. Allow 15 minutes for a straightforward retirement, plus whatever time you need to confirm that the data is no longer required. This guide uses the installed pvremove from LVM 2.03.16(2), package lvm2 version 2.03.16-3ubuntu3.2.

Warning

This is a destructive storage operation. Removing the label changes how LVM discovers the device. It does not securely erase all blocks, and it does not replace the steps needed to move or back up data. Do not use the examples against a device until you have identified it by a stable path and confirmed that no required volume depends on it. The final removal normally needs root.

1. Confirm the installed command

Start by checking which executable your shell will use and record its version. This is an ordinary, read-only check:

$ command -v pvremove
/usr/sbin/pvremove
$ pvremove --version
  LVM version:     2.03.16(2) (2022-05-18)

The version output also includes library and build details. The important checkpoint is that the command is the expected LVM utility, not a script or an unexpected installation.

2. Identify the exact device

Replace /dev/EXAMPLE in the commands below with the real physical volume path. Use a stable path from your machine, such as a persistent device link, rather than guessing from a changing device number. Check the path and its filesystem view before doing anything that writes:

$ ls -l /dev/EXAMPLE
$ lsblk -o NAME,PATH,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/EXAMPLE

Do not proceed if the path is a mounted filesystem, belongs to a multipath or clustered arrangement you have not accounted for, or is not the disk you intended. Keep the original path in your change record. A shell variable can make later commands easier to read, but it does not make an unsafe device safe:

pv=/dev/EXAMPLE
printf 'Target: %s\n' "$pv"
test -b "$pv"

Checkpoint: the printed target, its size, and its transport should match your maintenance plan. If they do not, stop and resolve the identity problem first.

3. Check whether the PV is still in a volume group

A PV cannot normally be removed from a volume group while it is used by an active logical volume. The usual administrative route is to move extents away, then use vgreduce to remove the PV from the group. pvremove is the last step that wipes the LVM label, not a shortcut for safely evacuating data.

Use your normal LVM inventory procedure to confirm that the device is unused, unmounted where appropriate, and absent from any volume group that must remain operational. If the device is still part of a group, investigate that group before continuing. Do not jump to repeated force flags because a normal check refuses the operation.

For a PV that was removed from its group but still carries its old label, record the intended end state and take a current backup of any metadata you may need for recovery. Once the label is removed, ordinary LVM discovery will no longer treat the device as that PV.

4. Dry-run the exact removal

The installed command provides --test, short form -t. It disables metadata writing while allowing the command path to be exercised. Run it with the exact target and without --yes:

$ sudo pvremove --test /dev/EXAMPLE
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.

Output varies with the device state and LVM configuration. A test run is useful for finding locking, visibility, or permission problems, but it is not proof that the target is correct. Re-check the path after the command if there is any doubt. The manual notes that test mode can produce unusual messages in multi-stage operations because later stages may expect metadata that was not actually changed.

Checkpoint: the test command used the intended path, returned a result you understand, and did not change the device label. If it reports that the PV belongs to an existing volume group, stop and use the group-removal workflow instead.

5. Remove the label after the final review

When the device identity and data decision are both confirmed, run the real command as root:

$ sudo pvremove /dev/EXAMPLE
  Labels on physical volume "/dev/EXAMPLE" successfully wiped.

The exact success wording can differ with the installed build and output settings. The useful result is a successful exit status and a subsequent check showing that LVM no longer finds the old PV label. Do not add --yes casually: it answers confirmation prompts automatically. Interactive confirmation is a useful final pause for a destructive command.

If the command refuses because the PV belongs to an existing volume group, the manual documents repeated force flags, -ff, for forcibly removing a PV from an existing group. Treat that as an exceptional recovery action only. Normally use vgreduce, and do not use -ff merely to make a planned storage change finish faster. Force mode can bypass protections that are there to prevent data loss.

6. Verify the new state

After a successful removal, run your LVM inventory check again and confirm that the old PV is no longer listed. Also inspect the device identity and partition or filesystem state with the same read-only tools used earlier:

$ lsblk -o NAME,PATH,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/EXAMPLE
$ sudo pvremove --test /dev/EXAMPLE

The second command is a diagnostic, not an undo operation. A device with no LVM label may produce an error saying it is not an LVM physical volume. That is consistent with the intended result, provided the first command confirms that you checked the right device. Keep the old metadata backup and the original change record until the storage is formally retired.

There is no general undo command for a wiped label. Recovery depends on what happened afterwards, available LVM metadata backups, and whether the data blocks were overwritten. If the wrong device was targeted, stop all writes to it, preserve it, and begin recovery work from backups or specialist support rather than trying more LVM commands.

Done means

  • The installed pvremove version and target path were recorded.
  • The device identity, mount state, volume-group membership, and data requirement were checked.
  • The exact command was dry-run with --test before any metadata write.
  • The real removal was authorised and run with the intended device path only.
  • LVM inventory no longer recognises the old PV, and the backup or recovery record is retained.