LinuxCommandLibrary

lvmdiskscan

Scan for all LVM disks

SYNOPSIS

lvmdiskscan [options]

PARAMETERS

-h, --help
    Displays a help message and exits.

-V, --version
    Displays the program version number and exits.

-v, --verbose
    Increases the verbosity of the output. Use multiple times for more detail (e.g., -vvv).

-d, --debug
    Enables debugging output, providing more detailed information about the scanning process.

--devices PVs|device_list
    Restricts scanning to a specified list of devices. Devices can be separated by commas.

--ignorelockingfailure
    Continues scanning even if an LVM locking failure occurs, which can be useful in specific recovery scenarios.

--config value
    Overrides configuration settings. This allows specifying LVM configuration parameters directly on the command line.

--reportformat basic|json
    Specifies the output format for the report. 'basic' is the default human-readable format, while 'json' provides machine-readable output.

DESCRIPTION

The lvmdiskscan command is a utility within the Logical Volume Manager (LVM) suite. Its primary function is to scan all accessible block devices on the system for LVM physical volume signatures and metadata. It identifies devices that are currently LVM physical volumes or contain LVM metadata, making them potential candidates for LVM usage. This command is particularly useful for troubleshooting, identifying disks that might have been part of an LVM setup, or simply getting an overview of which disks are LVM-managed on a system.

The output typically lists device paths, indicating their size and whether they are recognized as LVM physical volumes (PV) or just regular disks. It also provides information if LVM filters, defined in the lvm.conf configuration file, are applied, which can affect which devices are scanned and reported. Importantly, lvmdiskscan performs a read-only scan and does not modify any disk data.

CAVEATS

lvmdiskscan only identifies LVM metadata signatures; it does not provide information about filesystems or other partition types. The devices scanned and reported can be significantly affected by device filters defined in the lvm.conf configuration file. For comprehensive scanning, it typically requires root privileges.

LVM FILTERS

The behavior of lvmdiskscan is heavily influenced by the device filters configured in the lvm.conf file (typically located at /etc/lvm/lvm.conf). These filters use regular expressions to include or exclude specific devices from being scanned by LVM commands. For example, if a filter is set to exclude /dev/sdX, lvmdiskscan will not report any LVM metadata found on that device, even if it exists. It's crucial to be aware of these filters when troubleshooting missing LVM devices.

OUTPUT INTERPRETATION

The default output of lvmdiskscan typically shows a list of devices, their size, and a designation indicating whether they are recognized as LVM physical volumes (PV) or simply regular disks. For instance, a line might look like '/dev/sda [ 931.51 GiB] LVM physical volume' or '/dev/sdb [ 232.88 GiB]'. The presence of 'LVM physical volume' indicates that LVM metadata has been detected on that device. The --reportformat json option can provide a more structured and machine-parsable output for scripting purposes.

HISTORY

lvmdiskscan is an integral part of the LVM2 suite, which superseded the original LVM1 implementation and became the standard Logical Volume Manager on Linux. Its core function – to scan for and identify LVM-related block devices – has remained consistent throughout LVM2's development. While more advanced commands like pvs and vgscan often provide more structured and detailed information, lvmdiskscan continues to serve as a quick and simple tool for initial device discovery and sanity checks in LVM environments.

SEE ALSO

lvm(8), pvs(8), vgscan(8), pvcreate(8), vgcreate(8), lvs(8)

Copied to clipboard