PVS Command - Display Physical Volume Information
The pvs command is a powerful utility in Linux for
displaying information about physical volumes (PVs) used by the
Logical Volume Manager (LVM). Understanding your physical storage is
crucial for effective disk management, and pvs provides
a concise yet detailed overview.
Basic Physical Volume Information
To display fundamental details about your physical volumes, simply
run the pvs command without any arguments. This will
show essential information such as the physical volume name, volume
group it belongs to, and its size.
pvs
Verbose Physical Volume Details
For a more in-depth look, including unique identifiers like the
UUID, use the verbose option -v. This is particularly
useful when you need to differentiate between similar devices or for
scripting purposes.
pvs -v
Customizing Output Columns
You can tailor the output to show only the specific columns you need, such as the physical volume name, its associated volume group, and its size. This helps in quickly extracting relevant data.
pvs --columns pv_name,vg_name,pv_size
Human-Readable Size Formatting
To make the size information easier to read, use the
--units h option. This will display sizes in
human-readable formats (e.g., KB, MB, GB, TB).
pvs --units h
Sorting Physical Volumes
Organize your physical volume list by size using the
--sort pv_size option. This can be helpful when
analyzing storage allocation and identifying the largest PVs.
pvs --sort pv_size
Filtering by Device
If you want to see information for a specific physical volume or a
set of devices, you can provide the device path as an argument. For
example, to view information about /dev/sdX1:
pvs /dev/sdX1
Displaying Without Headers
For scripting or when integrating pvs output into other
tools, you might want to suppress the header row. Use the
--noheadings option for this purpose.
pvs --noheadings
Size in Megabytes
If you prefer to see all sizes consistently in megabytes, use the
--units M option.
pvs --units M
Checking for Missing Segments
The --segments option can display warnings if any
physical volumes are using missing data segments, which is crucial
for identifying potential storage issues.
pvs --segments
Displaying Allocatable and Missing Status
To get a comprehensive status of your physical volumes, including
whether they are allocatable and if any parts are missing, use the
-o +allocatable,missing option.
pvs -o +allocatable,missing
The pvs command is an essential tool for any system
administrator managing LVM storage. By understanding its various
options, you can efficiently monitor and manage your physical
volumes.