LinuxCommandLibrary

lvmchange

Modify attributes of LVM logical volumes

SYNOPSIS

lvmchange [options] LogicalVolumePath [LogicalVolumePath...]

PARAMETERS

-a | --available y | n
    Set the availability of the Logical Volume. 'y' activates the LV, 'n' deactivates it.

-l | --size Size[m|g|t|p]
    Change the size of the Logical Volume.

-r | --read-only y | n
    Set the read-only status of the Logical Volume. 'y' makes it read-only, 'n' makes it read-write.

--permission rw | r
    Set the read write permission of the Logical Volume. 'rw' grants both read and write permissions, 'r' grants only read permissions.

-C | --contiguous y | n
    Set or clear the contiguous allocation policy (y/n). Contiguous allocation can improve performance in some situations.

--noudevsync
    Disable udev synchronisation. The process will not wait for events dispatched by udev. Only use this in exceptional circumstances.

--poll y|n
    Enable or disable the polling of an LV for device status changes (such as errors). Can be useful in conjunction with multipath devices.

-p | --permission r|rw
    Set the permissions on the block device to be read-only or read-write

--addtag Tag
    Add the specified tag(s) to the Logical Volume.

--deltag Tag
    Remove the specified tag(s) from the Logical Volume.

-h | --help
    Display help text and exit.

-v | --verbose
    Increase the level of verbosity.

DESCRIPTION

The lvmchange command is a powerful tool used to modify the attributes of Logical Volumes (LVs) within a Linux Logical Volume Manager (LVM) setup. It allows administrators to change various properties, such as the LV's activation state (active or inactive), read-only status, permissions, and other operational characteristics. By using lvmchange, you can tune your LVM storage environment to meet specific performance, security, or operational requirements. Changes are applied immediately and reflect in the system. A common use case involves activating/deactivating LVs for maintenance or backup purposes, preventing accidental writes to a logical volume by setting it to read-only, or controlling LV accessibility by adjusting permissions. It is important to exercise caution when using lvmchange, as incorrect modifications can potentially impact the availability and integrity of data stored on the affected LVs.
Note that some attributes require the LV to be inactive (unmounted) before they can be changed.

CAVEATS

Modifying a Logical Volume while it is in use can lead to data corruption. Deactivate the LV before making changes whenever possible. Incorrect size changes can also lead to loss of data.

ACTIVATION

When a Logical Volume is activated (lvmchange -a y), the system makes the underlying block device accessible. Deactivation (lvmchange -a n) removes the device from the system, preventing access. This is crucial for tasks like snapshots and backups.
It is usually needed to deactivate the logical volume before other changes are applied.

SIZE CONSIDERATIONS

When resizing an LV, ensure that the underlying file system can handle the new size. For example, you might need to use file system-specific tools like 'resize2fs' (for ext4) or 'xfs_growfs' (for XFS) after increasing the LV size. Decreasing size may result in data loss.

HISTORY

LVM has been a core component of Linux distributions for many years, providing a flexible way to manage storage. lvmchange's development mirrors the evolution of LVM, adapting to changing storage needs and technologies. It has been crucial for enabling dynamic resizing and management of LVs without requiring reboots or system downtime.

SEE ALSO

lvcreate(8), lvremove(8), lvs(8), vgchange(8)

Copied to clipboard