2024-03-29
Before we look at lvdisplay
, let’s briefly recap LVM’s structure. LVM organizes storage into three layers:
lvdisplay
The lvdisplay
command is your window into the LVM world. It displays detailed information about your logical volumes, allowing you to monitor their status, size, and usage. It’s an essential command for troubleshooting and managing your storage.
The simplest way to use lvdisplay
is to run it without any arguments. This displays information about all LVs in your system:
lvdisplay
This will output something similar to (the exact output will depend on your system):
LV Name VG Name #PP #LV Size Alloc Origin
------------------- ------------------- ---- ---- ----------- ----------- ------------
mylv myvg 20 1 10.00 GiB 10.00 GiB
anotherlv myvg 10 1 5.00 GiB 5.00 GiB
This shows the Logical Volume Name, Volume Group it belongs to, the number of Physical Extents, number of Logical Volumes (in case of thin provisioning), Size, Allocated space and the origin of the Logical Volume.
To display information about a particular LV, specify its name as an argument:
lvdisplay mylv
This will provide a more detailed report only for mylv
.
lvdisplay
offers many options to customize the output:
-c
or --columns
: This option allows you to specify which columns to display. For example, lvdisplay -c name,size mylv
will only show the name and size of mylv
.
-m
or --major
: This shows the major number assigned to the device. This is important for device access. For example: lvdisplay -m mylv
-o
or --options
: Display more detailed information about LVs, including segmentation details.
Example using -c
and -m
:
lvdisplay -c name,size,major mylv
This will show only the name, size, and major number of mylv
.
If you try to display a non-existent LV, you’ll get an error message:
lvdisplay nonexistantlv
Error: Logical volume "nonexistantlv" does not exist.
This indicates that the specified LV is not found in your system.
lvdisplay
is useful for:
lvdisplay
can help identify problems with LVs, such as errors in the volume group or space allocation issues.By mastering lvdisplay
, you gain essential skills for effectively managing your Linux storage using LVM. The flexibility and detailed information provided by this command make it a cornerstone of LVM administration.