How to Use the Command 'vgdisplay' (with examples)
- Linux
- December 17, 2024
The vgdisplay
command is an essential tool within the Linux environment that provides detailed information about all volume groups managed by the Logical Volume Manager (LVM). LVM is a powerful and flexible disk management system that enables users to allocate, resize, and manage disk space more flexibly than the traditional partitioning scheme. The vgdisplay
command retrieves and presents metadata about the volume groups, including physical volumes associated with each group, capacity, and utilization status. This command is particularly useful for system administrators who need to monitor storage environments, manage volume groups, and troubleshoot any issues related to disk allocations.
Use Case 1: Display information about all volume groups
Code:
sudo vgdisplay
Motivation:
There are numerous situations where a system administrator might need an overview of all the volume groups present in a system. For example, when auditing the system’s storage layout, assessing capacity utilization, or diagnosing issues related to disk space allocation, understanding the current state of all the volume groups is crucial. By using the vgdisplay
command without specific volume group names, administrators can quickly gather a holistic view of the storage layout and make informed decisions accordingly.
Explanation:
sudo
: This command is run with superuser privileges because accessing disk information often requires administrative permissions. Usingsudo
ensures that thevgdisplay
command can retrieve complete information for all volume groups.vgdisplay
: This is the command itself, responsible for displaying information about all the volume groups present on the system. When executed without additional arguments, it lists details for every volume group configured.
Example Output:
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <100.00 GiB
PE Size 4.00 MiB
Total PE 25599
Alloc PE / Size 20479 / <80.00 GiB
Free PE / Size 5120 / <20.00 GiB
VG UUID wLz2hu-3y9D-1gu7-WFx7-uF8J-stvF-K1duX3
Use Case 2: Display information about volume group vg1
Code:
sudo vgdisplay vg1
Motivation:
Sometimes, a system administrator needs to focus on a specific volume group—perhaps to investigate an issue, validate configuration changes, or explore allocation across logical volumes associated with a particular group. By specifying the volume group name as an argument to the vgdisplay
command, the administrator can drill down into the details relevant to that particular group without wading through extraneous information.
Explanation:
sudo
: Again, elevated privileges are necessary to access detailed volume group information, ensuring comprehensive retrieval and display of data.vgdisplay
: The main command that fetches and displays information about volume groups.vg1
: This argument specifies which particular volume group the user intends to inspect. Replacingvg1
with any valid volume group name filters the output to display only the relevant information for that group.
Example Output:
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <50.00 GiB
PE Size 4.00 MiB
Total PE 12799
Alloc PE / Size 10239 / <40.00 GiB
Free PE / Size 2560 / <10.00 GiB
VG UUID 2ZpFJb-C39z-iF2S-vZLu-nT0J-12fX-G4hd5f
Conclusion:
The vgdisplay
command is an invaluable tool for system administrators managing Linux environments with Logical Volume Manager (LVM). Its ability to display comprehensive information about volume groups, either collectively or individually, enables efficient monitoring and management of disk space. By using the use cases provided, administrators can streamline their workflows, quickly assess storage configurations, and effectively troubleshoot any issues that arise. Whether you are performing routine audits or in-depth investigations, vgdisplay
offers a reliable avenue to view and understand the intricacies of your system’s storage volumes.