Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

lvs

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

Niveau
RHCSA-examen
Groep
LVM
Root nodig
Ja
Pakket
lvm2
Ook
lvdisplay, lvscan

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

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).

Zo schrijf je het

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

Opties 28

Meest gebruikt

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.

Voorbeelden 10

$ als gewone gebruiker# als root (of met 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.

Exitcodes

0Done.
5Error.