Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

vgs

Show volume groups: short table (vgs), full details (vgdisplay), or scan for VGs (vgscan).

Level
RHCSA exam
Group
LVM
Needs root
Yes
Package
lvm2
Also called
vgdisplay, vgscan

What it does

vgs prints one line per VG: number of PVs and LVs, size and free space. vgdisplay shows the details, including the PE Size and the number of free extents — needed for lvcreate -l.

How to write it

vgs [OPTION]... [VG...]
vgdisplay [OPTION]... [VG...]
vgscan [OPTION]...

Options 28

Most used

Report (vgs)

-o, --options COLUMNS
Columns, like vg_name,vg_size,vg_free,vg_extent_size (+col = add).
-O, --sort COLUMNS
Sort.
-S, --select EXPR
Filter, like 'vg_free>10g'.
--units UNIT
Units: h, b, k, m, g, t, e …
--nosuffix
No unit letters.
--noheadings
No header line.
--separator TEXT
Column separator.
--aligned, --rows, --binary, --nameprefixes, --unquoted
Output styles.
-a, --all
Also empty VGs and orphans.
--reportformat basic|json
JSON output.
--configreport, --logonly, --foreign, --shared, --readonly, --ignorelockingfailure, --unbuffered
Special report settings.

vgdisplay

-v, --verbose
Also list the LVs and PVs of the VG.
-C, --columns
Report like vgs.
-s, --short
Short form.
-A, --activevolumegroups
Only active VGs.

vgscan

--mknodes
Create missing /dev nodes for LVs.
--notifydbusd y|n
Notify the D-Bus service.

Common LVM options

-t, --test
Test only; change nothing.
-v, --verbose
More output (repeat for more).
-q, --quiet
Less output.
-y, --yes
Answer yes to questions.
-d, --debug
Debug output.
--config STRING
Override lvm.conf settings for this command only.
--commandprofile STRING, --profile STRING
Use a configuration profile.
--devices PV, --devicesfile STRING
Limit the devices LVM looks at.
--driverloaded y|n, --nolocking, --lockopt STRING, --nohints, --journal STRING
Special and debug settings.
-h, --help, --longhelp
Show help.
--version
Show the version.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1All VGs

    vgs
      VG     #PV #LV #SN Attr   VSize   VFree
      rhel     1   2   0 wz--n- <19.00g      0
      vgdata   2   1   0 wz--n- <14.99g <9.99g

    VFree = space for new or bigger LVs.

  2. 2Details with PE size

    vgdisplay vgdata

    PE Size, Total PE, Alloc PE, Free PE / Size.

  3. 3Free extents only

    vgs -o vg_name,vg_extent_size,vg_free_count vgdata

    Exactly what lvcreate -l needs.

  4. 4In MiB

    vgs --units m vgdata

    Exact numbers.

  5. 5VG with its LVs and PVs

    vgdisplay -v vgdata

    All in one view.

  6. 6VGs that are almost full (monitoring)

    vgs -S 'vg_free<1g' -o vg_name,vg_free

    Plan to add disks.

  7. 7Script value

    vgs --noheadings --nosuffix --units g -o vg_free vgdata

    A number for checks.

  8. 8JSON

    vgs --reportformat json

    For automation tools.

  9. 9Scan after moving disks between servers

    vgscan; vgchange -ay

    Finds and activates the moved VGs.

  10. 10Check the VG attributes

    vgs -o +vg_attr,vg_systemid

    w = writable, z = resizable, n = normal allocation.

Exit codes

0 :: Done. 5 :: Error.