Inspect LVM Logical Volumes Safely with lvdisplay
You will use lvdisplay to inspect logical volume attributes, narrow the report to one volume, choose output for a script, and investigate physical extent mappings without changing storage. Allow about ten minutes. You need the lvm2 package and access to the volume groups you want to inspect. The examples use LVM 2.03.16(2), installed with library version 1.02.185 on this machine.
The route
Jump straight to the step you need, or tick off Done means at the end.
This is an inspection workflow. It does not create, resize, activate, deactivate or remove a logical volume. Those operations belong to other LVM commands and can interrupt services or destroy data.
1. Confirm the installed command
Start with two read-only checks. These commands normally need no elevated privileges, although an LVM host may restrict device discovery:
$ command -v lvdisplay
/usr/sbin/lvdisplay
$ lvdisplay --version
LVM version: 2.03.16(2) (2022-05-18)
Library version: 1.02.185 (2022-05-18)
The exact path and build details can differ. Check the version before copying output into an operational runbook, because report fields and defaults belong to the installed LVM release.
Checkpoint: if lvdisplay is missing, stop and install or repair lvm2 through your normal package process. Do not substitute a similarly named command without checking its manual page.
2. Read the normal report
Run the command without a positional argument to ask LVM for logical volumes visible to the host:
$ lvdisplay
A populated report is organised by logical volume and includes attributes such as the LV path, read/write state, size, current state and snapshot information when those fields apply. The exact values are host-specific. An empty report is also meaningful: this host may have no visible LVs, the volume groups may be restricted, or the command may not be able to communicate with device-mapper.
If the command reports a locking or device access problem, preserve the diagnostic text. First rerun it with the privilege required by your host's LVM policy:
$ sudo lvdisplay
sudo is not a universal fix. It may allow device discovery on a normally administered host, but it will not make an absent volume group appear. Do not use --nolocking merely to silence a warning. The manual warns that concurrent commands can then produce incorrect results.
3. Target one volume explicitly
Use the volume group and logical volume as a single positional argument. Replace both placeholders with names from your host:
$ lvdisplay VG_NAME/LV_NAME
The positional form avoids scanning a long report while you are checking one object. The manual also permits a volume group or tag as a positional argument. If a name is ambiguous or the command says it cannot find the object, inspect the spelling with the unfiltered report or use the compact lvs command.
Do not infer that a logical volume is mounted just because it is listed. lvdisplay reports LVM metadata and attributes. Confirm filesystem and mount state separately, for example with findmnt, before planning maintenance.
4. Use columns for a compact, repeatable report
The installed manual describes lvs as the preferred, more configurable alternative. For a quick tabular view through lvdisplay, request columns and select fields:
$ lvdisplay --columns \
--options lv_name,vg_name,lv_size,lv_attr,lv_health_status
Field availability depends on the installed LVM report schema and the objects being displayed. Ask the command for its field list before putting a field into automation:
$ lvdisplay --columns --options help
For a stable script interface, add --noheadings, choose a separator, and request units deliberately:
$ lvdisplay --columns --noheadings \
--separator '|' --units b --nosuffix \
--options lv_name,vg_name,lv_size,lv_attr
Here --noheadings removes the heading row, --separator separates columns, and --nosuffix removes the size suffix. The output is still data from LVM, not a promise that values contain no whitespace. Parse it according to the fields and separator you selected, and test the parser against your own volume names.
Do not confuse output units with input units. For output, lower-case units use powers of 1024 and upper-case units use SI multiples. --units b requests bytes; --units B requests SI-style byte scaling. The --nosuffix option is intended for processing output with explicit units.
5. Inspect hidden components only when needed
Some normal logical volumes have internal components, such as mirror parts, that are not independently accessible. Add --all when you need those internal LVs included:
$ lvdisplay --all VG_NAME/LV_NAME
Do not treat an internal LV as a mountable target. It is metadata about how another LV is implemented, not a safe replacement path for the user-facing LV.
To see logical extent mappings, use:
$ lvdisplay --maps VG_NAME/LV_NAME
The result maps logical extents to physical volumes and physical extents. For the reverse direction, the manual points to pvs --segments --options +lv_name,seg_start_pe,segtype. Use that only when you need to start with physical layout; it is a different report and should not be mixed into a script without checking its fields.
6. Read metadata without contacting device-mapper
When you need to inspect on-disk metadata used by a virtual machine image, --readonly is the relevant boundary:
$ lvdisplay --readonly
The manual defines this as a special read-only mode that reads on-disk metadata without taking locks and does not communicate with the device-mapper kernel driver. That makes it useful for a metadata peek, but it also means the report cannot tell you whether an LV is actually in use. Do not use this output alone to decide that a volume can be detached, overwritten or removed.
This option is not a general bypass for every access failure. If the image is incomplete, the metadata is inconsistent, or the required devices are unavailable, capture the error and investigate the storage path before making any change.
7. Diagnose confusing output without changing state
If a volume appears to be missing, check the scope of device visibility. --devices restricts which physical devices are visible to the command, while --devicesfile selects an LVM devices file under /etc/lvm/devices/. A restricted view can make a healthy volume group appear incomplete. Check the host's LVM configuration and devices policy before changing either.
If a volume group is skipped because it belongs to another system or uses shared locking, the manual provides --foreign and --shared for those specific reporting cases. Do not add both options speculatively. Establish whether the host really uses system IDs or shared VGs, then document why the wider visibility is required.
For a machine-readable probe that must not modify metadata, --test is unnecessary here: lvdisplay is a reporting command already. Avoid --yes; it suppresses prompts for commands that can change state, but it adds no value to this inspection workflow.
Done means
- You confirmed the installed LVM version and command path.
- You can read all visible LVs and target a specific
VG/LV. - You selected explicit fields, separators and units before parsing output.
- You know when
--all,--mapsand--readonlychange what the report means. - You treated device visibility, locking and shared-volume warnings as scope problems to investigate, not prompts to disable safeguards.
- No example changed metadata, device mappings, mounts or services.