LinuxCommandLibrary

lvscan

Scan for all existing logical volumes

SYNOPSIS

lvscan [OPTION...]

PARAMETERS

-a, --all
    Include all Logical Volumes, including internal ones like snapshot origins.

-b, --block-device-info
    Display block device major:minor numbers and size.

-C, --columns
    Customize which columns are displayed and their format.

-d, --debug
    Enable debug logging, showing more detailed internal operations.

-h, --help
    Display a help message and exit.

-P, --partial
    Allow commands to proceed with partial LVM metadata (e.g., missing PVs).

-r, --readonly
    Run commands in read-only mode, preventing any modifications.

-S, --select
    Select LVM objects to process using a selection string.

-s, --short
    Show only the LV paths, one per line, simplifying scripting.

-t, --test
    Run in test mode; do not commit any actual changes to the system.

-v, --verbose
    Increase verbosity level, providing more detailed output.

--active
    Filter and display only active Logical Volumes.

--inactive
    Filter and display only inactive Logical Volumes.

--version
    Display version information and exit.

DESCRIPTION

lvscan is a command-line utility used in Linux to scan for and display information about Logical Volumes (LVs) managed by the Logical Volume Manager (LVM) framework. It provides a quick overview of existing LVs, including their paths, volume group, size, and current status (e.g., active, inactive, snapshot). This command is essential for system administrators to quickly ascertain the state and properties of their storage volumes without requiring detailed knowledge of the underlying physical or volume group structures. It's often used as a preliminary step before performing operations like activation, deactivation, or resizing of LVs.

CAVEATS

The output of lvscan typically shows LVs that are known to the LVM cache. If LVM metadata is inconsistent or damaged, the reported status might not accurately reflect the true state of the LV on disk.
Always ensure LVM metadata is backed up before making significant changes to your volume groups or logical volumes.

OUTPUT FORMAT

The default output of lvscan provides a concise summary, typically showing the LV path (e.g., `/dev/volumegroup/logicalvolume`), its access mode (e.g., `read/write`), current state (e.g., `active`), size, and UUID.
The `-s, --short` option simplifies this to just the LV paths, useful for scripting.

SCANNING PROCESS

When executed, lvscan scans all known Volume Groups (VGs) for their constituent Logical Volumes (LVs). It uses the LVM metadata found on disk to build a comprehensive list of all discovered LVs, making it an essential tool for discovering newly added or previously unknown logical volumes.

HISTORY

The Logical Volume Manager (LVM) framework, of which lvscan is a part, has been a standard component of Linux distributions since kernel version 2.4. lvscan specifically gained prominence with LVM2, which introduced many enhancements over the original LVM. Its primary role has consistently been to provide a quick and easy way to list all detected logical volumes on a system, aiding in system inventory and status checks.

SEE ALSO

pvscan(8), vgscan(8), lvs(8), lvcreate(8), lvremove(8), lvm(8)

Copied to clipboard