lvs
List logical volume information
TLDR
Display information about logical volumes
Display all logical volumes
Change default display to show more details
Display only specific fields
Append field to default display
Suppress heading line
Use a separator to separate fields
SYNOPSIS
lvs [OPTIONS] [LV_PATH...]
PARAMETERS
--all | -a
Show information about all logical volumes, including internal ones (e.g., for snapshots).
--aligned
Ensure all output columns are aligned for better readability.
--columns
Specify the columns to display. Common columns include lv_name, vg_name, lv_size, lv_attr, lv_path, data_percent, metadata_percent.
--config
Use a specified configuration string for this command instead of default LVM configuration.
--foreign
Display logical volumes that are not part of known volume groups on the system (e.g., from external arrays).
--nameprefixes
Add 'LVM2_' prefixes to column names when using --columns for easier programmatic parsing.
--noheadings
Do not display header lines in the output.
--reportformat {basic|json}
Select the report output format. 'basic' is the default human-readable format, 'json' outputs structured JSON data.
--rows | -t
Display each logical volume on a separate row, useful for very wide outputs.
--select
Display only rows that match the selection criteria. E.g., lvs -S 'lv_size>10G'.
--separator
Set the field separator for non-aligned output, useful for scripting.
--sort
Sort the output by specified columns. E.g., lvs --sort lv_name.
--segments | -s
Display information about logical volume segments, providing more granular details about LV composition.
--units {B|K|M|G|T|P|E}
Specify the units for size display (Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Petabytes, Exabytes).
--verbose | -v
Increase verbosity level, providing more detailed information about the command execution.
--version
Display version information of the LVM tools.
--help
Display help information and exit.
DESCRIPTION
lvs is a command-line utility used in Linux to display information about logical volumes (LVs) managed by the Logical Volume Manager (LVM). It provides a structured view of LVs, including their names, sizes, volume groups, attributes (such as thin provisioning or snapshots), and allocation details. This command is essential for system administrators to monitor and manage storage configurations, allowing quick inspection of the state and properties of logical volumes without needing to parse output from other LVM tools like lvdisplay. It supports various output formats and powerful filtering options, making it versatile for scripting and detailed reporting.
CAVEATS
lvs relies on the LVM metadata. If metadata is corrupt or inaccessible, lvs might not show accurate information or could fail.
For very large systems with many LVs, running lvs without filters might be slow. Using LV_PATH arguments or --select can speed up queries.
The output of lvs can vary slightly across different LVM versions, especially regarding available columns and their exact names. Always consult the man lvs page for the specific LVM version being used.
CUSTOM OUTPUT FORMATTING
lvs allows users to highly customize its output using the --columns (or -o) option. This is extremely useful for scripting, as specific data points can be extracted precisely. For instance, lvs -o lv_name,lv_size --noheadings will output just the name and size without headers, ideal for piping into other commands or for automated parsing.
FILTERING AND SELECTION
The --select option provides powerful filtering capabilities, allowing users to query LVs based on various criteria like size, attributes, or names using a SQL-like syntax. This is crucial for managing large LVM setups and quickly finding specific volumes. Example: lvs --select 'lv_size > 100G && vg_name=myvg' to find all logical volumes larger than 100GB in 'myvg'.
HISTORY
The Logical Volume Manager (LVM) for Linux was initially developed by Joe Thornber around 1998, drawing inspiration from HP-UX's LVM. It became a standard part of the Linux kernel around version 2.4. lvs is a core utility within the LVM toolset, designed to provide a concise and tabular view of logical volumes. Its design evolved to support increasingly complex LVM features like thin provisioning, snapshots, and RAID LVs, making it an indispensable tool for understanding the storage layout managed by LVM. The command has maintained a consistent interface while adding new columns and filtering capabilities to adapt to new LVM functionalities.
SEE ALSO
pvs(8): Report information about physical volumes., vgs(8): Report information about volume groups., lvcreate(8): Create a logical volume., lvdisplay(8): Display attributes of a logical volume in a more detailed format., lvremove(8): Remove a logical volume., lvextend(8): Extend the size of a logical volume., lvreduce(8): Reduce the size of a logical volume., vgcreate(8): Create a volume group., pvcreate(8): Initialize a physical volume for use by LVM.