Home / Alt manpages / pvdisplay(8)

  • pvdisplay(8)
  • Admin command
  • linux

Inspect LVM Physical Volumes Safely with pvdisplay

pvdisplay reports the size, allocation state and logical-volume mapping of an LVM physical volume, purely read-only. In about 10 minutes you will be able to identify a PV, check its allocation, and see which logical volumes use its physical extents, all without touching a single byte of metadata.

Before you start

  • You need: the lvm2 package and a device that is already an LVM physical volume.
  • Check the version first. On this system the installed package is lvm2 2.03.16-3ubuntu3.2, reporting LVM version 2.03.16(2). Other releases can add fields or change formatting, so check before depending on exact output in a script.
  • Expect to need sudo. Reading a local PV is usually an ordinary task, but device discovery and LVM locking commonly need elevated privileges. Prefix the examples with sudo when your account cannot read the devices or acquire the LVM lock.
  • Never guess a device path. List the known PVs first with sudo pvs, or ask the system owner.

1. Confirm the tool and find the PV

Check the installed version:

pvdisplay --version

Expected output begins with a line similar to this:

LVM version:     2.03.16(2) (2022-05-18)

Now identify a real PV path. If pvs is available, this is the most compact check:

sudo pvs -o pv_name,vg_name,pv_size,pv_free

Copy one value from the PV column, such as /dev/sdb2, and replace that example with your actual path below. A path that is not a PV produces an error or no useful report; that does not make it safe to initialise.

2. Read the full PV report

Display the attributes of one physical volume:

sudo pvdisplay /dev/sdb2

The report covers the PV size, physical extent size, space used by the volume-group descriptor area, and allocation. It also names the volume group when the PV belongs to one. The exact labels and spacing are presentation details, so use the options below when another program needs stable columns.

To inspect several known PVs, put their paths after the command:

sudo pvdisplay /dev/sdb2 /dev/sdc1

Checkpoint

The paths in the report should be the devices you intended to inspect. If a PV appears missing, stop and investigate device visibility, multipath or the LVM devices file before changing metadata.

3. Use the small reports when you only need one fact

--short prints only the size of the supplied PVs, useful for a quick capacity check:

sudo pvdisplay --short /dev/sdb2

--units controls displayed sizes: lower-case units use powers of 1024, upper-case units use SI multiples of 1000. Human-readable output is the default style, but an explicit unit makes a transcript less ambiguous:

sudo pvdisplay --units g /dev/sdb2
sudo pvdisplay --units G /dev/sdb2

For machine processing, suppress suffixes and use a fixed unit. Input syntax is not the same as output syntax: numbers supplied as size arguments use base-two units, whereas --units G selects SI output.

sudo pvdisplay --units g --nosuffix /dev/sdb2

4. Inspect physical-to-logical mappings

Ask for the mapping from physical extents on the PV to logical and physical extents:

sudo pvdisplay --maps /dev/sdb2

This is the useful view when a disk is nearly full, or you need to know which logical volume occupies a region. It is still an inspection command. Do not infer that an empty or surprising mapping authorises pvremove, pvmove or filesystem changes; those are separate operations with their own data-loss boundaries.

Choose output for scripts carefully

--colon produces colon-separated output, easier to split than the normal report, but still a format defined by this LVM release. If you need selected fields, headings, sorting or a more configurable report, use pvs, which the local manual recommends as the preferred alternative. Start by checking its available fields rather than assuming names:

sudo pvs --options help
sudo pvs --noheadings --separator '|' \
  --options pv_name,vg_name,pv_size,pv_free

Do not parse aligned human output with fixed character positions: names, sizes and spacing can change with device names and LVM version. For a quick one-off shell check, --noheadings and --separator on the report command can help, but validate the result against a known PV before automating an action.

Common failure modes

  • Permission or locking warnings: rerun with sudo. Do not use --nolocking casually; the manual warns that concurrent commands can then produce incorrect results.
  • No PV is shown: verify the path, device visibility and any configured LVM devices file. A restricted view can make devices appear missing without changing the disk.
  • A virtual machine is using the metadata: --readonly reads on-disk metadata without taking normal locks and does not talk to the device-mapper driver. It cannot tell you whether logical volumes are actually in use, so treat it as a metadata peek, not proof a device is safe to modify.
  • You expected a compact table: use pvs instead. pvdisplay is a detailed display command, and its normal report is not intended as a stable API.

Done means

  • Version confirmed. You confirmed the installed LVM version.
  • Path verified. You used a verified PV path rather than guessing a disk.
  • State checked. You checked size and allocation with pvdisplay.
  • Mapping reviewed. You used --maps when physical extent placement mattered.
  • Inspection kept separate. Reading stayed apart from any command that changes metadata or moves data.