LinuxCommandLibrary

vgs

Display volume group information

TLDR

Display information about volume groups

$ vgs
copy

Display all volume groups
$ vgs [[-a|--all]]
copy

Change default display to show more details
$ vgs [[-v|--verbose]]
copy

Display only specific fields
$ vgs [[-o|--options]] [field_name_1],[field_name_2]
copy

Append field to default display
$ vgs [[-o|--options]] +[field_name]
copy

Suppress heading line
$ vgs --noheadings
copy

Use separator to separate fields
$ vgs --separator =
copy

SYNOPSIS

vgs [options] [VolumeGroup [VolumeGroup...]]

PARAMETERS

-o Field[,Field...], --options Field[,Field...]
    Selects specific fields to display in the output. Common fields include vg_name, vg_size, vg_free, lv_count, pv_count.

--noheadings
    Suppresses the display of column headings in the output.

--aligned
    Forces column alignment in the output, which can be useful when piping the output to other commands.

--units Unit
    Specifies the units to use for size fields (e.g., b for bytes, k for kilobytes, m for megabytes, g for gigabytes, t for terabytes). Defaults to human-readable units if not specified.

-v, --verbose
    Increases the verbosity of messages during command execution.

--reportformat basic|json
    Selects the output format for the report. basic is the default human-readable format, json outputs data in JSON format for programmatic use.

VolumeGroup
    Specifies the name(s) of the volume group(s) for which to display information. If no volume group is specified, information for all active volume groups is shown.

DESCRIPTION

The vgs command is a crucial utility within the LVM (Logical Volume Manager) suite in Linux. It's designed to display concise information about LVM volume groups, which are a fundamental building block in LVM's storage abstraction hierarchy.

It provides a quick, tabular overview of key attributes such as the volume group's name, size, free space, number of physical volumes, and number of logical volumes. vgs is frequently used for system monitoring, scripting, and quickly assessing the state and capacity of LVM storage on a system. Its output can be easily customized to include specific fields, making it highly versatile for various administrative tasks.

CAVEATS

vgs typically requires root privileges (or sudo) to run, especially to access detailed or sensitive LVM metadata. Output may not reflect the very latest disk changes until LVM metadata is updated (e.g., after adding/removing physical disks that are not yet known to LVM).

COMMON USAGE EXAMPLES

  • vgs
    Displays a default summary of all volume groups.
  • vgs MyVolumeGroup
    Shows information specifically for the volume group named 'MyVolumeGroup'.
  • vgs -o vg_name,vg_size,vg_free --units g
    Displays the name, total size, and free space of all volume groups, with sizes in gigabytes.
  • vgs --noheadings --options vg_name,vg_size
    Outputs only the volume group name and size without headers, useful for scripting.

LVM HIERARCHY CONTEXT

In LVM, storage is organized hierarchically:
1. Physical Volumes (PVs): Raw disk partitions or whole disks.
2. Volume Groups (VGs): Pools of PVs. vgs reports on these pools.
3. Logical Volumes (LVs): Flexible partitions carved out of VGs.
Understanding this hierarchy is key to interpreting vgs output and managing LVM storage effectively.

HISTORY

vgs is part of the LVM2 suite, the second generation of Logical Volume Manager for Linux, which succeeded the original LVM1. LVM2 was designed to be more robust, scalable, and feature-rich. Commands like vgs were developed to provide a consistent, scriptable interface for querying LVM components, complementing the more detailed, human-readable output of commands like vgdisplay. Its focus is on providing structured data that can be easily parsed and used in automation scripts.

SEE ALSO

lvm(8), pvcreate(8), vgcreate(8), lvcreate(8), pvs(8), lvs(8), vgdisplay(8), pvdisplay(8), lvdisplay(8)

Copied to clipboard