What Does vgs Mean?
This page mentions older exam versions. See the Current Exam Context and Legacy Exam Context sections below for the updated mapping.
On This Page
Quick Definition
The vgs command shows details about volume groups in Linux Logical Volume Manager. It lists the volume group name, physical extent size, total and free physical extents, and other attributes. This helps system administrators quickly see how storage is allocated across groups.
Common Commands & Configuration
vgsvgs vg_datavgs --units gvgs -o vg_name,vg_freevgs --noheadings -o vg_freevgs -O vg_nameMust Know for Exams
The vgs command appears in several IT certification exams, most notably the CompTIA Linux+ (XK0-005), the Red Hat Certified System Administrator (RHCSA, EX200), and the Linux Professional Institute (LPIC-1, exam 101). In these exams, candidates are expected to demonstrate proficiency with LVM commands, including vgs, pvs (physical volume status), and lvs (logical volume status).
For CompTIA Linux+, the exam objectives include "Manage storage volumes" and "Configure Logical Volume Manager (LVM)." Typically, a scenario question may present a system that is low on disk space. The candidate must use vgs to determine which volume group has free space, then create a logical volume or extend an existing one. The exam may be performance-based, requiring the candidate to type the correct command and interpret the output. Multiple-choice questions might test knowledge of what each column represents, such as VFree or Attr.
For the RHCSA, LVM is a core topic. Candidates must be able to create, extend, and reduce volume groups, and vgs is essential for checking the results. The exam often presents a system with specific storage requirements; the candidate must use vgs to confirm that the volume group has enough free extents before creating a logical volume. The Attr column is especially important because a volume group marked with 'x' (exported) cannot be used until it is imported.
In LPIC-1, the exam 101 covers LVM administration. Questions may ask about the command syntax, options like --units, or the meaning of the #PV and #LV columns. The exam may also include troubleshooting: for example, if a logical volume cannot be created due to insufficient space, which command should you run first? The answer is vgs to check free space.
Overall, vgs is not just a trivial command; it is a diagnostic tool that demonstrates a candidate's ability to manage Linux storage logically. Examiners expect candidates to know its output and how to use it in the context of creating, resizing, or moving logical volumes.
Simple Meaning
Imagine you have several hard drives in your computer, and you want to combine them into one big storage space that you can carve up just the way you need. That big combined space is called a volume group. The vgs command is like a dashboard that shows you all the volume groups you have created, how much total space each one has, and how much space is still free to use. For example, if you have two 500GB drives pooled together, the volume group might show 1000GB total, with 600GB used and 400GB free. The command outputs a table with columns like VG (volume group name), #PV (number of physical volumes in the group), #LV (number of logical volumes), and Attr (attributes like whether it is writable or resizable). It is a quick read-only command that does not change anything on your system. System administrators use it to plan storage, check before creating new logical volumes, or troubleshoot when a volume group is full.
In plain English, vgs gives you the big picture of your storage pools without having to dig through multiple commands. It is one of the first commands you run when you need to understand the storage layout on a Linux server. If you have used Windows Disk Management, think of vgs as a summary view of all your disk groups that you set up with Logical Volume Manager.
This command is widely used in IT environments where servers manage large amounts of data, such as databases, file servers, and virtual machine hosts. Knowing how to read the output is a core skill for Linux system administration and is often tested in certification exams like the CompTIA Linux+ and Red Hat Certified System Administrator (RHCSA).
Full Technical Definition
The vgs command is part of the LVM2 (Logical Volume Manager version 2) suite in Linux. It queries the LVM metadata stored on physical volumes to report the current state of volume groups. A volume group (VG) is a collection of one or more physical volumes (PVs), typically whole disks or partitions, that are combined into a single storage pool. From that pool, logical volumes (LVs) are created that act like partitions but can be resized, moved, or snapshotted dynamically.
The vgs command reads the LVM metadata from the /etc/lvm/archive and /etc/lvm/backup directories, as well as directly from the physical volume headers. This metadata contains information about the volume group name, UUID, physical extent size (default 4 MiB), the list of physical volumes, and the logical volumes that reside on them. The output includes the following columns:
VG – the name of the volume group. #PV – the number of physical volumes in that group. #LV – the number of logical volumes created. #SN – the number of snapshots (if any). Attr – a set of attributes such as w (writable), z (resizable), or x (exported). VSize – total size of the volume group. VFree – free space available for new logical volumes.
The command can be used with options like -a (all attributes, including those of inactive volume groups), -o (custom output fields), and --units (to display sizes in human-readable formats like GB). For instance, vgs --units g shows sizes in gigabytes. The command also supports sorting with -O and filtering with -S, which is useful when many volume groups exist.
LVM metadata is stored on each physical volume in a small area at the beginning of the device (the LVM label) and duplicated in the /etc/lvm/backup directory. The vgs command reads both sources to ensure consistency. If a physical volume fails, LVM can still recover the volume group metadata from the remaining volumes or from backups.
In real IT implementation, administrators use vgs to monitor storage usage, plan capacity, and identify volume groups that are nearly full. It is also used in scripts to automate alerts when free space drops below a threshold. The command is available on all major Linux distributions that support LVM, including RHEL, CentOS, Ubuntu, and SUSE.
Real-Life Example
Think of a large apartment complex with several buildings. Each building is a physical volume, a hard drive or partition. The volume group is like the whole apartment complex, which groups those buildings together. The property manager (that's the vgs command) creates a summary board that lists each complex by name, how many buildings are in it, how many apartments (logical volumes) are inside, the total square footage of the complex, and how much of that space is still empty (available for new apartments). If you want to know if you can build a new apartment, you look at the board to see which complex has free space. That is exactly what vgs does, it gives you the high-level view of all your storage complexes without walking into each building.
Now imagine you have a complex called “DataCenter” that has three buildings (three 2TB hard drives). The board says “DataCenter” has 3 buildings, 12 apartments, and 6TB total with 1.5TB free. You can instantly tell that you still have room to add more apartments (logical volumes). The vgs command does the same for your server storage: it tells you the volume group name, the number of physical disks in it, the total capacity, and the remaining free space. This helps you make quick decisions about storage allocation.
Another analogy: consider a shared storage room in an office. The room is the volume group. The shelves, boxes, and filing cabinets inside are the logical volumes. vgs tells you how many shelves and boxes exist, the total cubic feet of storage, and how much empty space remains. Without this command, you would have to measure each shelf and box individually, a slow, error-prone process. So vgs saves time and prevents mistakes.
Why This Term Matters
The vgs command is a fundamental tool for anyone managing Linux storage. It provides a quick, reliable snapshot of how physical storage is aggregated and what capacity remains. In production environments, knowing when a volume group is nearly full is critical to avoid application outages. For example, a database server's volume group may hold the data files; if it fills up, the database can crash. By running vgs regularly, administrators can plan capacity expansion before problems occur.
In practical IT contexts, vgs is used in monitoring scripts. A cron job can run vgs and pipe the output to a script that sends a warning email if VFree drops below a certain percentage. This proactive approach prevents downtime. Vgs is used during troubleshooting: when logical volumes cannot be created because of insufficient space, running vgs reveals exactly how much free space exists and which volume group has room.
The command also plays a role in disaster recovery. If a physical volume fails, vgs can show the remaining volume group status, helping the admin decide whether to replace the failed disk and extend the volume group or to restore from backup. Understanding vgs output is part of the LVM diagnostic workflow.
For IT professionals, mastering vgs means they can quickly assess storage health without using more complex tools. It is one of the few commands that gives a clean summary rather than overwhelming detail. This efficiency is valued in high-pressure situations like server maintenance windows or incident response.
How It Appears in Exam Questions
In certification exams, vgs questions typically fall into three categories: command output interpretation, scenario-based troubleshooting, and configuration verification.
Command output interpretation: A question may show a vgs output table and ask what the VFree column indicates, or what the number 4 in the #PV column means. For example, given:
VG #PV #LV #SN Attr VSize VFree datavg 3 5 0 wz--n- <2.91t <1.20t
The candidate might be asked: "How many logical volumes exist in the datavg volume group?" The answer is 5. Or they might be asked: "What does the 'z' in the Attr column mean?" The answer: the volume group is resizable. These questions test command fluency and the ability to read standard LVM output.
Scenario-based troubleshooting: A scenario might describe a server where an administrator cannot create a new logical volume even though there is a volume group with total space of 2TB. The candidate must run vgs to see that VFree shows 0, indicating the volume group is full. They then need to extend the volume group by adding a physical volume. The question may ask: "Which command would you run first to check available space?" The answer: vgs. Multiple-choice options may include other commands like df -h or fdisk, but the correct answer is vgs because it shows LVM-level free space, not filesystem-level.
Configuration verification: A test might present a scenario where a volume group is created with a specific physical extent size. The candidate uses vgs to confirm the size. For instance, if the admin set the extent size to 8 MiB, vgs will show the VSize in extents. A question might ask: "If a volume group has 2000 free physical extents of 8 MiB each, what is the total free space?" The candidate must calculate 2000 * 8 MiB = 16000 MiB = 15.625 GiB.
some questions combine vgs with other LVM commands. For example: "After running pvcreate /dev/sdb1 and vgextend datavg /dev/sdb1, which command should you use to confirm the volume group was extended?" The answer is vgs. The candidate must know that the #PV column will increase by 1.
These question types require both memorization of syntax and practical understanding of the storage lifecycle.
Practise vgs Questions
Test your understanding with exam-style practice questions.
Example Scenario
You work as a junior system administrator at a medium-sized company. The database team reports that their server is running out of disk space. They need to add 100GB for the new quarterly data. The server uses LVM, and there is one volume group called 'db_vg'. You log in to the server and run the command vgs. The output shows:
VG #PV #LV #SN Attr VSize VFree db_vg 2 3 0 wz--n- <1.00t 50.00g
This tells you that the volume group has a total of 1TB (1.00t), 3 logical volumes are already created, and only 50GB of free space remains. The database team needs 100GB, so there is not enough free space in this volume group. You cannot simply create a new logical volume of 100GB because only 50GB is available.
You then check if there are any unused physical disks. A quick lsblk shows that /dev/sdc is raw and unpartitioned. You decide to add it to the volume group. You run pvcreate /dev/sdc to prepare it, then vgextend db_vg /dev/sdc to add it. After that, you run vgs again to verify:
VG #PV #LV #SN Attr VSize VFree db_vg 3 3 0 wz--n- <1.50t 550.00g
Now the volume group has 1.5TB total, and 550GB free. You can now create a new logical volume of 100GB using lvcreate. This scenario shows how vgs is the first step in checking capacity and confirming that changes have been applied.
In an exam, you might be asked: "After running vgextend, what command would you use to confirm the change?" The answer is vgs. The scenario teaches you to always verify your storage changes with the appropriate status command.
Common Mistakes
Thinking vgs shows filesystem disk usage like df -h
vgs shows LVM volume group capacity, not the actual filesystem usage. A volume group may have free space, but the logical volumes inside may still be full from a filesystem perspective.
Use df -h for filesystem usage. Use vgs to check if the volume group has free extents to allocate to logical volumes.
Confusing #LV with #PV in the output
Getting these numbers swapped leads to incorrect understanding of storage topology. #PV is for physical volumes, #LV is for logical volumes.
Remember: PV starts with P for 'physical' (disks), LV starts with L for 'logical' (virtual partitions). Double-check the column headers.
Assuming VFree represents filesystem free space
VFree is the unallocated space at the volume group level, not the free space inside any logical volume. A volume group can have VFree but logical volumes may be 100% full.
Use lvs or lvdisplay to see the size of logical volumes, then use df -h within the filesystem to see usage.
Believing vgs can modify volume group configuration
vgs is strictly a read-only command. It cannot change anything. Trying to pass options that modify the volume group will fail.
Use vgcreate, vgextend, vgreduce, or vgchange to make changes. Use vgs only to view status.
Ignoring the Attr column
The Attr column shows important flags like 'x' for exported or 'z' for resizable. Overlooking this can lead to trying operations that are not permitted.
Always check Attr. If it shows 'x', import the volume group first with vgimport before modifying it.
Exam Trap — Don't Get Fooled
{"trap":"When a question asks to check free space before creating a logical volume, inexperienced learners may run df -h on the mount point and see 'free space' but then fail to create the LV because the LVM free extents are exhausted.","why_learners_choose_it":"df -h is a familiar command that shows free space in human-readable numbers. Many candidates forget that logical volumes can be thinly provisioned or that the volume group itself may have no free extents even if the filesystem shows free space."
,"how_to_avoid_it":"Always run vgs (or vgdisplay) to confirm free space at the LVM level before creating or extending a logical volume. VFree in vgs is the true unallocated capacity within the volume group."
Commonly Confused With
pvs shows the status of physical volumes (disks or partitions) that have been initialized for LVM. vgs shows the volume groups that group those physical volumes together. vgs gives the aggregate view; pvs gives the individual disk view.
If you have two 500GB disks in one volume group, pvs shows two lines of 500GB each, while vgs shows one line with 1TB total.
lvs shows the logical volumes created within volume groups. vgs shows the volume groups themselves. lvs output includes LV name, VG name, size, and attributes. vgs does not show individual logical volumes.
vgs shows that volume group 'data' has 3 logical volumes. lvs shows each of those three LVs with their sizes and paths.
lvdisplay provides detailed information about a specific logical volume, including its UUID, read/write status, and mapping table. vgs provides summary information about the volume group only, not the details of individual LVs.
lvdisplay /dev/data/mylv shows block start and end sectors; vgs data just shows total size and free space.
vgdisplay gives extensive details for a volume group, including PE size, total PE count, allocated PE, and free PE. vgs gives a concise table with the most important fields. vgdisplay is more verbose; vgs is quicker for a summary.
vgdisplay data shows 'PE Size 4.00 MiB / Total PE 1024'; vgs data shows VSize 4.00g and VFree 2.00g.
Step-by-Step Breakdown
Identify the volume group
When you run vgs without arguments, it lists all volume groups on the system. If you have multiple groups, note which one you need to work with. The VG column identifies the group name.
Read the #PV column
#PV tells you how many physical volumes are part of this volume group. More physical volumes generally mean more storage capacity, but also more complexity if a disk fails. This helps you understand the physical makeup.
Check the #LV column
#LV indicates how many logical volumes exist in this volume group. This is useful to quickly see if a volume group is heavily subdivided. Many LVs can mean many filesystems or swap areas.
Examine the Attr column
The Attr column contains flags like 'w' (writable), 'z' (resizable), or 'x' (exported). A volume group with 'x' cannot be used until it is imported. This step prevents mistakes like trying to create an LV in an inactive group.
Look at VSize and VFree
VSize is the total capacity of the volume group. VFree is the unallocated space. Compare these numbers to decide if you can create a new logical volume or extend an existing one. If VFree is zero, you need to add a physical volume first.
Interpret the output correctly
Understand that VFree is at the volume group level, not per logical volume. A volume group may show 50GB free, but individual logical volumes may still be full. Always use df -h on the mount points for filesystem-level usage.
Practical Mini-Lesson
The vgs command is one of the most frequently used LVM status commands. In practice, system administrators do not just run it once; they build it into their daily checks. For example, a cron script could run vgs --noheadings --units g -o vg_name,vg_free | awk '{print $1 " has " $2 " GB free"}' and send output to a log file or monitoring system. This gives a quick health check of all storage pools.
What professionals need to know is that vgs output can be customized. The -o option lets you specify which fields to display, such as vg_name, vg_size, vg_free, pv_count, lv_count. This is useful when you only need specific information. For instance, vgs -o vg_free --noheadings vg_data returns just the free space number for the vg_data volume group, which can be used in scripts.
Another professional tip: when adding a new physical disk to a volume group, always run vgs both before and after vgextend to confirm the change. The #PV column should increase by one, and VFree should increase by the size of the new physical volume. This simple verification prevents human error, such as adding the wrong disk.
What can go wrong? If the LVM metadata gets corrupted, vgs may fail with an error like "Volume group not found" even though the physical volumes exist. In that case, use vgscan to rescan all devices, then vgcfgrestore to restore from backup. Also, if a physical volume is removed without properly reducing the volume group, vgs may show an inconsistent state. The admin then needs to run vgreduce with the --removemissing flag.
In terms of configuration, vgs parameters can be set in /etc/lvm/lvm.conf. For example, the global_filter setting can exclude certain devices from LVM scanning, which affects what vgs shows. Professionals must be aware of this if they cannot see expected volume groups.
Finally, vgs is often used in combination with watch to monitor free space: watch -n 5 vgs. This updates every 5 seconds, useful during live storage operations.
Troubleshooting Clues
Symptom: vgs returns "No volume groups found"
Symptom: vgs shows VFree as 0 but you know there is free space
Symptom: vgs output shows a volume group with 'x' in Attr
Symptom: vgs shows a volume group with duplicate name
Memory Tip
Think of vgs as a 'volume group summary', just like a chart that shows the big picture of storage pools. The command name itself is a clue: v for volume, g for group, s for summary (or show).
Covered in These Exams
Current Exam Context
Current exam versions that test this topic — use these objectives when studying.
220-1101CompTIA A+ Core 1 →XK0-006CompTIA Linux+ →Legacy Exam Context
Older materials may mention these exam versions, but learners should use the current objectives for their target exam.
XK0-005XK0-006(current version)Related Glossary Terms
A 2-in-1 laptop is a portable computer that can switch between a traditional laptop form and a tablet form, usually by detaching or rotating the keyboard.
The 24-pin motherboard connector is the main power cable that connects the computer's power supply unit (PSU) to the motherboard, supplying electricity to the motherboard and its components.
Two-factor authentication (2FA) is a security method that requires two different types of proof before granting access to an account or system.
A 3D printer is a device that creates physical objects by depositing layers of material based on a digital model.
5G is the fifth generation of cellular network technology, designed to deliver faster speeds, lower latency, and support for many more connected devices than previous generations.
The 8-pin CPU connector is a power cable from the power supply that delivers dedicated electricity to the processor on a computer's motherboard.
802.1Q is the networking standard that allows multiple virtual LANs (VLANs) to share a single physical network link by tagging Ethernet frames with VLAN identification information.
802.1X is a network access control standard that authenticates devices before they are allowed to connect to a wired or wireless network.
Quick Knowledge Check
1.Which column in the vgs output shows how many physical volumes are part of the volume group?
2.What does VFree represent in vgs output?
3.Which command shows only the free space of a volume group named 'prod_vg'?
4.If the Attr column in vgs shows 'x', what does it mean?
Frequently Asked Questions
Is vgs safe to run on a production server?
Yes. vgs is a read-only command and does not change any data. It is safe to run anytime.
Can vgs show the free space inside logical volumes?
No. vgs shows free space at the volume group level. To see free space inside logical volumes, use df -h on the mounted filesystem.
What does it mean if vgs shows no output?
It means either no volume groups exist, or LVM cannot find the metadata. Run vgscan to rescan all devices, or check if the LVM service is running.
How do I interpret the VSize column if it shows '<2.91t'?
The '<' indicates the value is approximate due to rounding. '2.91t' means 2.91 tebibytes (or terabytes depending on units). This is the total capacity of the volume group.
Does vgs work on all Linux distributions?
Yes, vgs is part of the LVM2 package available on all major distributions including RHEL, Ubuntu, Debian, CentOS, and SUSE.
What is the difference between vgs and vgdisplay?
vgdisplay provides detailed information about a specific volume group, including PE size, total PE, and metadata details. vgs gives a concise table with summary fields. vgdisplay is more verbose.
Can I use vgs to see if a volume group is exported?
Yes. Look for the Attr column; if it contains 'x', the volume group is exported.
Summary
The vgs command is an essential tool in the Linux Logical Volume Manager toolkit. It provides a concise table view of all volume groups on a system, showing key metrics like total size, free space, number of physical and logical volumes, and attributes. Understanding its output is fundamental for managing storage in Linux, especially in enterprise environments where LVM is widely used for its flexibility in resizing and managing storage pools.
In certification exams such as CompTIA Linux+, RHCSA, and LPIC-1, vgs is frequently tested. Candidates must be able to interpret its output, use options to customize the display, and apply the command in practical scenarios like checking free space before creating a logical volume or verifying the result of extending a volume group. Mistakes such as confusing VFree with filesystem free space or misreading the #PV and #LV columns are common traps that exam takers should avoid.
The practical takeaway is to use vgs as a first diagnostic step whenever storage issues arise. Combine it with pvs and lvs for a complete picture of the LVM stack. Regular use of vgs in monitoring scripts helps prevent storage outages. Mastering this command is a must for any Linux system administrator aiming to pass storage-related exam questions and manage real-world servers efficiently.