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

pvs

Show physical volumes: short table (pvs), full details (pvdisplay), or scan for PVs (pvscan).

Level
RHCSA exam
Group
LVM
Needs root
Yes
Package
lvm2
Also called
pvdisplay, pvscan

What it does

pvs prints one line per PV with its VG, size and free space. pvdisplay shows all details (PE size, total and free PEs, UUID). With -o you choose report columns and with -S you filter. pvscan scans devices for PVs and can trigger auto-activation.

How to write it

pvs [OPTION]... [PV...]
pvdisplay [OPTION]... [PV...]
pvscan [OPTION]...

Options 34

Most used

Report (pvs, also lvs/vgs)

-o, --options COLUMNS
Columns, like pv_name,vg_name,pv_size,pv_free (+col = add).
-O, --sort COLUMNS
Sort by columns (-col = descending).
-S, --select EXPR
Filter, like 'pv_free>1g'.
--units UNIT
Units: h, b, k, m, g, t, s (sectors), e (extents)… capital = powers of 1000.
--nosuffix
No unit letters (for scripts).
--noheadings
No header line.
--separator TEXT
Column separator.
--aligned
Align with a separator.
--nameprefixes, --unquoted
Output as NAME=value pairs.
--rows
Columns as rows.
--segments
One line per segment.
-a, --all
Also devices that are not PVs.
--binary
0/1 instead of words.
--reportformat basic|json
JSON output.
--configreport log|vg|lv|pv|pvseg|seg, --logonly
Report details.
--foreign, --shared, --readonly, --ignorelockingfailure, --unbuffered
Special report settings.

pvdisplay

-m, --maps
Show which extents belong to which LV.
-C, --columns
Report like pvs.
-s, --short
Only the device and size.

pvscan

--cache
Update the device cache and auto-activation.
-a, --activate ay
Activate VGs that become complete.
-n, --novolumegroup
Only PVs without a VG.
-e, --exported
Only PVs of exported VGs.

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 PVs

    pvs
      PV         VG     Fmt  Attr PSize   PFree
      /dev/vda2  rhel   lvm2 a--  <19.00g      0
      /dev/vdb1  vgdata lvm2 a--   <5.00g   1.00g

    PFree = free space on that PV.

  2. 2Details of one PV

    pvdisplay /dev/vdb1

    PE Size, Total PE, Free PE, Allocated PE, UUID.

  3. 3Which LVs use this PV?

    pvdisplay -m /dev/vdb1

    Needed before you remove a disk.

  4. 4Own columns

    pvs -o pv_name,vg_name,pv_size,pv_free,dev_size

    dev_size shows the size of the device itself.

  5. 5PVs with free space

    pvs -S 'pv_free>0'

    Where can new LVs go?

  6. 6Sizes in MiB for scripts

    pvs --units m --nosuffix --noheadings -o pv_free /dev/vdb1

    Just a number.

  7. 7JSON

    pvs --reportformat json

    For automation.

  8. 8PVs not in any VG

    pvscan -n

    New disks ready to use.

  9. 9Scan after adding disks

    pvscan --cache

    Updates LVM's view of devices.

  10. 10Segments of a PV

    pvs --segments -o +lv_name

    Which LV uses which extents.

Exit codes

0Done.
5Error.