← 返回命令列表

Linux command

lvs 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

List

sudo lvs

List all

sudo lvs -a

Verbose

sudo lvs -v

Example

sudo lvs -o lv_name,vg_name,lv_size

Append

sudo lvs -o +lv_path

Show available fields

sudo lvs -o help

No headings

sudo lvs --noheadings --separator '|'

Filter

sudo lvs -S 'lv_size>1g'

JSON output

sudo lvs --reportformat json

说明

lvs displays information about logical volumes in a configurable table format. It provides a quick overview of LV names, sizes, attributes, and related volume groups.

参数

-a, --all
Show all logical volumes including internal ones.
-v, --verbose
Increase verbosity and show additional details. Can be repeated up to 4 times.
-o, --options _fields_
Specify which fields to display. Prefix with `+` to append, `-` to remove, `#` to compact empty fields. Use `-o help` to list available fields.
-S, --select _criteria_
Filter output rows matching selection criteria.
-O, --sort _fields_
Sort output by specified fields. Prefix with `-` for reverse order.
--noheadings
Suppress the heading line in output.
--nosuffix
Suppress size unit suffixes in output.
--separator _char_
Use specified character as field separator.
--aligned
Use with --separator to align output columns.
--nameprefixes
Add "LVM2_" prefix to field names, producing field=value pairs.
--segments
Show segment information in default columns.
--rows
Display columns as rows.
--units _units_
Display sizes in specified units (b, s, k, m, g, t, p, e, h, H).
--reportformat _format_
Output format: `basic` or `json`.

FAQ

What is the lvs command used for?

lvs displays information about logical volumes in a configurable table format. It provides a quick overview of LV names, sizes, attributes, and related volume groups.

How do I run a basic lvs example?

Run `sudo lvs` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in lvs?

Show all logical volumes including internal ones.