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

lvs

Show logical volumes: short table (lvs), full details (lvdisplay), or list all (lvscan).

Level
RHCSA exam
Group
LVM
Needs root
Yes
Package
lvm2
Also called
lvdisplay, lvscan

What it does

lvs prints one line per LV with its VG, attributes, size, and for snapshots and thin volumes the data use. lvdisplay gives the device path, UUID, status and extent count. lvscan lists all LVs with their state (ACTIVE/inactive).

How to write it

lvs [OPTION]... [VG|VG/LV...]
lvdisplay [OPTION]... [VG|VG/LV...]
lvscan [OPTION]...

Options 28

Most used

Report (lvs)

-o, --options COLUMNS
Columns, like lv_name,lv_size,lv_path,devices (+col = add).
-O, --sort COLUMNS
Sort.
-S, --select EXPR
Filter, like 'lv_size>1g'.
--units UNIT
Units: h, b, k, m, g, t, e …
--nosuffix
No unit letters.
--noheadings
No header line.
--separator TEXT
Column separator.
-a, --all
Also hidden internal LVs (pool data, RAID images).
--segments
One line per segment.
-H, --history
Also removed LVs (if history is on).
--aligned, --rows, --binary, --nameprefixes, --unquoted
Output styles.
--reportformat basic|json
JSON output.
--configreport, --logonly, --foreign, --shared, --readonly, --ignorelockingfailure, --unbuffered
Special report settings.

lvdisplay

-m, --maps
Show which PVs and extents the LV uses.
-C, --columns
Report like lvs.

lvscan

-a, --all
Also internal LVs.
-b, --blockdevice
Show device numbers.

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 LVs

    lvs
      LV     VG     Attr       LSize   Pool Origin Data%  Meta%
      root   rhel   -wi-ao---- <17.00g
      swap   rhel   -wi-ao----   2.00g
      lvdata vgdata -wi-ao----   5.00g

    a = active, o = open (mounted).

  2. 2Details with path

    lvdisplay /dev/vgdata/lvdata

    LV Path, UUID, LV Size, Current LE.

  3. 3Which disks does an LV use?

    lvs -o +devices

    Important before removing a PV.

  4. 4Size in MiB or extents

    lvs --units m; lvs -o lv_name,seg_size_pe

    Check exam tasks with extents.

  5. 5Snapshot and thin use

    lvs -o lv_name,origin,data_percent,metadata_percent

    A full snapshot becomes invalid; a full thin pool stops writes.

  6. 6All LVs including hidden ones

    lvs -a

    Pool data, metadata and RAID images.

  7. 7Extent map

    lvdisplay -m /dev/vgdata/lvdata

    Which PV ranges are used.

  8. 8List with state

    lvscan
      ACTIVE            '/dev/rhel/root' [<17.00 GiB] inherit

    Inactive LVs cannot be mounted (vgchange -ay).

  9. 9JSON

    lvs --reportformat json -o lv_name,lv_size,vg_name

    For automation.

  10. 10Large LVs only

    lvs -S 'lv_size>10g'

    Filter the report.

Exit codes

0 :: Done. 5 :: Error.