| |

LFCS 83 🐧 LVM — Physical Volumes

ā±ļø Estimated read: 12 min | |

A Physical Volume (PV) is the foundation of the LVM stack. It is a block device—a whole disk, a partition, or a software RAID device—that has been initialized with LVM metadata. The initialization writes a label and a metadata area to the device, which records its identity and its membership in a Volume Group. Until pvcreate runs, the device is just a block device; after it runs, the device is a member of the LVM pool, and its space is divided into Physical Extents that the Volume Group can allocate .

This chapter covers the Physical Volume layer: the commands that create, inspect, modify, and remove a PV, and the failure modes that arise when a PV is removed without evacuating its data. It assumes the conceptual model from the previous chapter—PV, VG, LV, and PE—and focuses on the operational details that the LFCS exam tests: how to verify that a device is a PV, how to move extents off a PV before removing it, and how to repair a PV whose metadata has been corrupted.


Key point: pvremove does not move data. It only removes the LVM label. If the PV still contains allocated extents, the removal either fails or leaves the Volume Group inconsistent. The correct sequence is pvmove first, then vgreduce, then pvremove.


Why the Physical Volume layer exists

The initialization boundary. A raw disk has no LVM identity. pvcreate writes the LVM label to the second sector of the device and initializes the metadata area, which stores the PV’s UUID, size, and the list of Volume Groups it belongs to . This initialization is what allows LVM to recognize the device as a PV during a scan, and it is why pvscan and pvs can list the device even before it is added to a VG.

The extent division. When pvcreate initializes a device, it divides the device’s space into Physical Extents (PEs) of a fixed size. The PE size is determined when the Volume Group is created, not when the PV is created, but the PV’s metadata records the PE size that the VG expects . This division is what allows the VG to allocate the PV’s space in uniform chunks.

The metadata copies. By default, pvcreate stores two copies of the VG metadata on each PV: one at the front and one at the end of the device . The redundancy means that a single corrupted metadata area does not lose the VG’s configuration. The --metadatacopies option controls the number of copies, and setting it to 0 is useful for PVs that are used as mirrors or that have their metadata managed elsewhere.

The removal hazard. A PV that is a member of a VG cannot be removed while the VG contains Logical Volumes that map to its extents. The pvremove command removes the LVM label, but it does not relocate the data. If the PV still has allocated extents, the removal leaves the VG with a mapping to a device that no longer has LVM metadata, and the VG becomes inconsistent . The pvmove command is the mechanism for evacuating the extents before removal.


a. Creating and inspecting Physical Volumes

pvcreate initializes one or more block devices as PVs. The command accepts whole disks, partitions, and RAID devices. It writes the LVM label and metadata to each device, and it refuses to proceed if the device is already a PV or if it contains a filesystem signature that it cannot safely overwrite.

# Initialize two whole disks as Physical Volumes.
# The command writes the LVM label and metadata to each device.
sudo pvcreate /dev/sdc /dev/sdd

# Expected output:
#   Physical volume "/dev/sdc" successfully created.
#   Physical volume "/dev/sdd" successfully created.

pvs provides a compact report of all PVs on the system. The columns show the device name, the Volume Group it belongs to (if any), the format, the attributes, the physical size, and the free space .

# Compact report of all Physical Volumes.
sudo pvs

# Example output:
#   PV         VG       Fmt  Attr PSize  PFree
#   /dev/sda2  cs       lvm2 a--  19.00g     0
#   /dev/sdc            lvm2 ---   5.00g  5.00g
#   /dev/sdd            lvm2 ---   5.00g  5.00g

pvdisplay provides the detailed view. It shows the PV’s UUID, size, PE size, total and free PE count, and the Volume Group it belongs to. The -s flag produces a short format similar to pvs .

# Detailed attributes of a specific Physical Volume.
sudo pvdisplay /dev/sdc

# The output includes the PV UUID, PE size, and extent counts.

pvscan scans all block devices for LVM metadata and reports the PVs it finds. The -v flag adds verbose output, which is useful when a device is not being recognized as a PV .

# Scan for Physical Volumes.
sudo pvscan

b. Moving extents and removing a Physical Volume

pvmove relocates the allocated extents from one PV to other PVs in the same Volume Group. The operation runs while the Logical Volumes are in use, which means it is the mechanism for evacuating a disk without downtime . The command accepts a source PV and an optional destination PV. If no destination is given, LVM chooses any PV in the VG with sufficient free space.

# Move all extents off /dev/sdc to other PVs in the same VG.
# The LV remains available during the move.
sudo pvmove /dev/sdc

# Move extents to a specific destination PV.
sudo pvmove /dev/sdc /dev/sdd

The pvmove command is the first step in the safe removal sequence. After the move completes, the PV has no allocated extents, and it can be removed from the VG with vgreduce. Only then does pvremove have a safe target.

# Remove the PV from its Volume Group.
# This requires that the PV has no allocated extents.
sudo vgreduce vg_data /dev/sdc

# Remove the LVM label from the device.
# The device is no longer a PV.
sudo pvremove /dev/sdc

pvremove does not prompt for confirmation in scripted use, and it does not check whether the PV is still a member of a VG. If the PV is still in a VG with allocated extents, the command may fail, or it may leave the VG in a state that requires repair. The safe sequence is always pvmove, then vgreduce, then pvremove.


c. Modifying and repairing Physical Volumes

pvchange modifies the attributes of a PV. The -x n option disables the allocation of new extents on the PV, which is useful when a disk is showing signs of failure and should not receive new data. The -u option generates a new UUID for the PV .

# Disable allocation on a failing PV.
# Existing extents remain, but new extents are not placed on it.
sudo pvchange -x n /dev/sdc

pvresize resizes a PV after the underlying device has been resized. When a partition is grown with parted or a virtual disk is expanded, the PV’s metadata still records the old size. pvresize updates the PV to use the new space, and the Volume Group’s free space grows accordingly.

# Update the PV to use the new size of the underlying device.
sudo pvresize /dev/sdc

pvck checks the PV metadata for consistency. It is the diagnostic tool for a PV that pvs reports as missing or that causes LVM commands to fail. The -v flag adds verbose output.

# Check the PV metadata for consistency.
sudo pvck /dev/sdc

Complete Example Session

# ============================================
# PART 1: THE STARTING STATE
# ============================================
# List the block devices and identify the candidates.

lsblk

# ============================================
# PART 2: INITIALIZE THE PVS
# ============================================
# pvcreate writes the LVM label and metadata.

sudo pvcreate /dev/sdc /dev/sdd

# ============================================
# PART 3: VERIFY WITH pvs
# ============================================
# The PVs are listed with their size and free space.

sudo pvs

# ============================================
# PART 4: VERIFY WITH pvdisplay
# ============================================
# Detailed attributes: UUID, PE size, extents.

sudo pvdisplay /dev/sdc

# ============================================
# PART 5: CREATE A VG AND LV
# ============================================
# The PVs are added to a VG, and an LV is created.

sudo vgcreate vg_data /dev/sdc /dev/sdd
sudo lvcreate -n lv_app -L 6G vg_data

# ============================================
# PART 6: THE REMOVAL SEQUENCE
# ============================================
# The LV uses extents on both PVs.
# To remove /dev/sdc, the extents must move first.

sudo pvmove /dev/sdc

# ============================================
# PART 7: REMOVE FROM THE VG
# ============================================
# After pvmove, the PV has no allocated extents.

sudo vgreduce vg_data /dev/sdc

# ============================================
# PART 8: REMOVE THE PV LABEL
# ============================================
# The device is no longer a PV.

sudo pvremove /dev/sdc

# ============================================
# PART 9: THE FAILURE CASE
# ============================================
# Attempting pvremove without pvmove fails or
# leaves the VG inconsistent.

# sudo pvremove /dev/sdd
# The command may report that the PV is still in use.

# ============================================
# PART 10: THE FULL PICTURE
# ============================================
# pvcreate initializes.
# pvs and pvdisplay inspect.
# pvmove evacuates.
# vgreduce removes from the VG.
# pvremove removes the label.

echo "PV workflow complete."

The ten parts walk through the full lifecycle: create, inspect, use, evacuate, remove, and the failure case. The sequence is the same for any PV, regardless of whether it is a whole disk, a partition, or a RAID device.


Quick Reference

PV Commands

CommandPurposeChapter
pvcreateInitialize a device as a PV83
pvsCompact report of all PVs83
pvdisplayDetailed attributes of a PV83
pvscanScan devices for PVs83
pvmoveRelocate extents to other PVs83
pvremoveRemove the LVM label83
pvchangeModify PV attributes83
pvresizeUpdate PV size after device resize83
pvckCheck PV metadata83

Safe Removal Sequence

StepCommandEffect
1pvmove /dev/sdXEvacuates allocated extents
2vgreduce vg_name /dev/sdXRemoves PV from the VG
3pvremove /dev/sdXRemoves the LVM label

PV Attributes

AttributeMeaning
PSizeTotal size of the PV
PFreeUnallocated space
PE SizeSize of each Physical Extent
Total PENumber of PEs on the PV
Allocated PEPEs mapped to LVs

Failure Modes

SymptomCauseFix
pvremove failsPV still in a VG with extentspvmove, then vgreduce
pvs shows “unknown” VGMetadata corruption or missing devicepvck, check device
New space not visibleDevice resized but PV not updatedpvresize /dev/sdX

Best Practices

āœ… Do This:

# Initialize whole disks or partitions.
sudo pvcreate /dev/sdc /dev/sdd                                  // āœ…

# Verify with pvs after creation.
sudo pvs                                                          // āœ…

# Move extents before removing a PV.
sudo pvmove /dev/sdc                                              // āœ…

# Remove from the VG before removing the label.
sudo vgreduce vg_data /dev/sdc                                    // āœ…

# Disable allocation on a failing disk.
sudo pvchange -x n /dev/sdc                                       // āœ…

āŒ Don’t Do This:

# Don't run pvremove on a PV that still has extents.
sudo pvremove /dev/sdc  # data loss risk                         // āŒ

# Don't skip pvmove when evacuating a disk.
sudo vgreduce vg_data /dev/sdc  # fails if extents remain        // āŒ

# Don't use a device for both LVM and a filesystem.
# pvcreate overwrites the filesystem signature.                   // āŒ

Common Pitfalls

PitfallWhy It HappensFix
pvremove reports “in use”PV still has allocated extentspvmove first
vgreduce failsPV has extents mapped to LVspvmove first
New disk space not usablePV not resized after device growthpvresize /dev/sdX
PV not recognizedLVM label missing or corruptedpvck, then pvcreate if needed
Wrong device initializedNo lsblk check before pvcreateAlways verify the device

Real-World Examples

1. Create a PV

sudo pvcreate /dev/sdc

2. Compact Report

sudo pvs

3. Detailed Report

sudo pvdisplay /dev/sdc

4. Scan for PVs

sudo pvscan

5. Move Extents

sudo pvmove /dev/sdc

6. Remove from VG

sudo vgreduce vg_data /dev/sdc

7. Remove the Label

sudo pvremove /dev/sdc

8. Disable Allocation

sudo pvchange -x n /dev/sdc

9. Resize the PV

sudo pvresize /dev/sdc

10. Check Metadata

sudo pvck /dev/sdc

Visual

The PV Lifecycle

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  RAW DEVICE                                             │
│  /dev/sdc                                               │
│         │                                               │
│         ā–¼  pvcreate                                     │
│  PHYSICAL VOLUME                                        │
│  LVM label + metadata + PEs                             │
│         │                                               │
│         ā–¼  vgcreate                                     │
│  MEMBER OF A VOLUME GROUP                               │
│         │                                               │
│         ā–¼  lvcreate                                     │
│  EXTENTS ALLOCATED TO AN LV                             │
│         │                                               │
│         ā–¼  pvmove                                       │
│  EXTENTS EVACUATED                                      │
│         │                                               │
│         ā–¼  vgreduce + pvremove                          │
│  RAW DEVICE AGAIN                                       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

The Safe Removal Sequence

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  pvmove /dev/sdc                                        │
│  → Extents moved to other PVs in the VG                 │
│  → PV has no allocated extents                          │
│         │                                               │
│         ā–¼                                               │
│  vgreduce vg_data /dev/sdc                              │
│  → PV removed from the VG                               │
│  → VG size shrinks                                      │
│         │                                               │
│         ā–¼                                               │
│  pvremove /dev/sdc                                      │
│  → LVM label removed                                    │
│  → Device is no longer a PV                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

pvs Output

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  PV         VG       Fmt  Attr PSize  PFree             │
│  /dev/sda2  cs       lvm2 a--  19.00g     0             │
│  /dev/sdc            lvm2 ---   5.00g  5.00g            │
│  /dev/sdd   vg_data  lvm2 a--   5.00g  2.00g            │
│                                                         │
│  VG column: empty means not in a VG                     │
│  PFree: unallocated space on the PV                     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

The Metadata Copies

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  PV: /dev/sdc                                           │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  │
│  │  Sector 1: LVM label                              │  │
│  │  Metadata copy 1                                  │  │
│  │  ...                                              │  │
│  │  Data extents                                     │  │
│  │  ...                                              │  │
│  │  Metadata copy 2                                  │  │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  │
│                                                         │
│  Two copies by default (--metadatacopies 2).            │
│  Redundancy protects against a single corruption.       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Summary

ItemValue
PurposeInitialize a block device for LVM
Createpvcreate /dev/sdX
Compact reportpvs
Detailed reportpvdisplay
Scanpvscan
Move extentspvmove /dev/sdX
Remove from VGvgreduce vg_name /dev/sdX
Remove labelpvremove /dev/sdX
Modify attributespvchange
Resize after growthpvresize

Key takeaways:

  • pvcreate is the initialization step. It writes the LVM label and metadata to the device, which allows LVM to recognize it as a PV .
  • pvs and pvdisplay are the inspection tools. pvs is the compact report; pvdisplay shows the full attributes, including the UUID and the extent counts .
  • pvmove is the evacuation tool. It relocates the allocated extents to other PVs in the same VG, and it runs while the LVs are in use .
  • The removal sequence is pvmove, vgreduce, pvremove. Skipping the first step leaves the VG with a mapping to a device that no longer has metadata, and pvremove may fail or produce an inconsistent VG .
  • pvchange -x n disables allocation. It is the correct response to a disk that is failing but not yet ready to be removed.
  • pvresize updates the PV after the device grows. A partition that is enlarged with parted or a virtual disk that is expanded does not automatically update the PV’s size.

Remember: The Physical Volume is the first layer of LVM. It is the device that LVM has claimed, the container for the Physical Extents that the Volume Group allocates, and the target of the pvmove command that evacuates data before removal. The commands are simple, but the order matters: create, verify, move, reduce, remove. A PV that is removed without evacuating its extents is a PV that leaves the Volume Group inconsistent, and the repair is more expensive than the move would have been.


Was this helpful?


Stop using slow, ad-bloated tool sites! 🤮

šŸ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
āœ… Finance (Mortgage, Interest, Inflation)
āœ… Tech (Base64, JSON, Dev Suite, IP)
āœ… Health (BMI, BMR, TDEE)
āœ… Productivity (Timer, Workspace, QR)

āš”ļø Fast & Private
šŸ”’ No data leaves your device
šŸ’Ž 100% Free

šŸ”— Use it now: https://tools.kandz.me
šŸ”– Bookmark it—you’ll need it later!