LinuxCommandLibrary

lvmconfig

Display LVM configuration

TLDR

Display the effective configuration in use (after merging all config sources)

$ lvmconfig --typeconfig current --mergedconfig
copy

Show only settings that differ from their defaults
$ lvmconfig --typeconfig diff
copy

List all configuration keys
$ lvmconfig [[-l|--list]]
copy

Print the default configuration with full comments and extra spacing
$ lvmconfig --typeconfig default --withcomments --withspaces
copy

Validate the full merged configuration and report errors
$ lvmconfig --mergedconfig --validate
copy

Write the current effective configuration to a file
$ lvmconfig --typeconfig current [[-f|--file]] [path/to/output.conf]
copy

SYNOPSIS

lvmconfig [OPTIONS]

PARAMETERS

--type type
    Specifies the type of configuration to display, such as global, profile, or command.

--config section.key=value
    Sets a specific configuration item. Can be used multiple times to set several items.

--commandprofile profile_name
    Applies a named command profile for the current operation.

--format format
    Defines the output format, such as raw, json, or yaml.

--ignoreunmanaged
    Excludes unmanaged configuration settings from the output.

--merged
    Shows the complete, merged configuration from all active sources.

--profile profile_name
    Reads configuration from a specified profile.

--rename old_key=new_key
    Renames an existing configuration key.

--showempty
    Displays all configuration items, including those with empty or default values.

--unmanaged
    Displays only unmanaged configuration settings.

--validate
    Validates LVM configuration provided via standard input.

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

--version
    Displays the LVM version information and exits.

DESCRIPTION

lvmconfig is a powerful utility within the LVM2 suite designed for inspecting and manipulating the Logical Volume Manager's configuration. It allows administrators to display the current LVM configuration, including default values and any custom settings defined in lvm.conf or files within lvm.conf.d.

Beyond viewing, lvmconfig can also be used to set specific configuration parameters at runtime or to validate configuration files. It supports displaying a merged view of all configuration sources, identifying unmanaged settings, and even renaming configuration keys. This command is crucial for understanding how LVM behaves and for fine-tuning its operations, especially in automated scripting environments or when troubleshooting LVM-related issues.

CAVEATS

Careless modification of LVM configuration through lvmconfig can lead to unexpected LVM behavior or even data inaccessibility if critical parameters are set incorrectly. Changes made directly via --config on the command line are often temporary for the current LVM operation unless explicitly written to a configuration file. It's essential to understand the implications of each configuration setting before altering it.

CONFIGURATION SOURCES

lvmconfig aggregates LVM configuration from various sources, including the main lvm.conf file, supplementary files in lvm.conf.d/ directories, and any command-line options. The order of precedence ensures that more specific settings override general ones, providing flexible and hierarchical configuration management.

COMMAND PROFILES

LVM command profiles allow administrators to define custom sets of configuration options for specific LVM commands or scenarios. These profiles can be activated using the --commandprofile option, enabling tailored LVM behavior without altering the global configuration files.

HISTORY

The ability to centrally manage and inspect LVM configuration has been a continuous area of development within the LVM2 project. While configuration files like lvm.conf have always existed, lvmconfig emerged as a dedicated tool to provide a programmatic and standardized interface for interacting with these settings. This facilitated better scripting, debugging, and consistent management of LVM across different systems, reducing reliance on direct file editing and enhancing operational reliability.

SEE ALSO

lvm(8), lvm.conf(5), vgchange(8), lvcreate(8)

Copied to clipboard