pvdisplay Command
The pvdisplay command is a powerful utility in Linux's Logical Volume Manager (LVM) suite, used to display detailed information about physical volumes (PVs). Physical volumes are the underlying storage devices (like hard drives or partitions) that LVM uses to create volume groups and logical volumes. Understanding the status and attributes of your physical volumes is crucial for effective storage management.
Display All Physical Volume Information
To view comprehensive details for all physical volumes configured in your LVM setup, simply run the command without any arguments:
pvdisplay
This output typically includes the PV name, VG name it belongs to, size, allocation status, and more.
Display Specific Physical Volume Details
If you need information about a particular physical volume, you can specify its device path:
pvdisplay /dev/sdX
Replace /dev/sdX with the actual device name of the physical volume you are interested in.
Show Physical Volumes with Specific Units
You can control the units displayed for size information. For example, to show sizes in megabytes:
pvdisplay --units m
Common unit options include b (bytes), k (kilobytes), m (megabytes), g (gigabytes), t (terabytes), and p (petabytes).
Human-Readable Physical Volume Output
For easier readability, especially with large storage devices, use the --human-readable option:
pvdisplay --human-readable
This will display sizes in a more user-friendly format (e.g., 1.5T, 500G).
Display Only Physical Volume UUIDs
If you only need the UUIDs of the physical volumes, you can combine pvdisplay with awk:
pvdisplay -C --columns | awk '{print $1, $2}'
The -C option lists PVs, and --columns displays them in a columnar format, which awk then parses to extract the first two fields (typically PV name and UUID).
Verbose Output for More Details
To get even more detailed output, including potentially less commonly used attributes, use the verbose flag:
pvdisplay -v
Show Version Information
To check the version of the pvdisplay command and LVM utilities installed on your system:
pvdisplay --version