LinuxCommandLibrary

pvchange

Change attributes of LVM Physical Volumes

SYNOPSIS

pvchange [OPTIONS] PV_PATH...

PV_PATH...: Specifies one or more paths to the physical volumes whose attributes are to be changed.

PARAMETERS

-x {y|n} or --allocatable {y|n}
    Sets or clears the allocatable attribute for the specified physical volume(s). If 'y', extents can be allocated on the PV. If 'n', no new extents can be allocated on this PV, and existing extents cannot be moved off it unless explicitly specified during an lvmove operation. Setting to 'n' is useful for maintenance purposes.

-u UUID or --uuid UUID
    Allows changing the Universally Unique Identifier (UUID) of a physical volume. This is a very rare and potentially dangerous operation; use with extreme caution as it can corrupt LVM metadata if not managed properly. Typically, LVM assigns UUIDs automatically.

-f or --force
    Suppresses all confirmation prompts and forces the operation to proceed, even if it might seem unsafe. Use with extreme caution, as it can lead to unintended consequences.

-y or --yes
    Answers yes to all questions, allowing the command to proceed without interactive confirmation.

-v or --verbose
    Increases the verbosity of the command's output, providing more detailed information about the operations being performed.

-q or --quiet
    Suppresses most output messages, only showing errors or critical warnings.

--version
    Displays the version of the LVM tools currently installed.

--help
    Displays a help message with available options and usage information for the pvchange command.

DESCRIPTION

pvchange is an essential utility within the Linux Logical Volume Manager (LVM) framework. It allows administrators to modify various attributes of existing Physical Volumes (PVs). The primary function of pvchange is to control the allocatable status of a PV, which dictates whether logical volume extents can be placed on or removed from it. This command is crucial for maintenance operations, such as temporarily taking a PV out of service for underlying storage modifications or when preparing a PV for removal from a Volume Group (VG) without completely deactivating it. While less common, it can also be used to change the Universally Unique Identifier (UUID) of a PV, though this operation should be approached with extreme caution as it can disrupt LVM metadata if not handled correctly. pvchange operates on specified PV paths, applying the desired attribute changes directly to the PV's metadata on disk.

CAVEATS

pvchange directly modifies LVM metadata on disk. Incorrect use, especially with the --uuid option, can lead to data loss or render LVM volumes inaccessible. Always ensure you have backups of critical data before performing LVM metadata changes. This command typically requires root privileges to execute. Setting a PV to non-allocatable (-x n) does not remove existing data; it only prevents new data from being written.

USE CASE: MAINTENANCE

pvchange -x n /dev/sdb1
This command makes /dev/sdb1 non-allocatable. This is useful when you need to perform maintenance on the underlying disk (e.g., SMART tests, firmware updates) but don't want LVM to try allocating new extents on it. After maintenance, you can set it back to allocatable with pvchange -x y /dev/sdb1.

IMPACT OF NON-ALLOCATABLE PV

When a PV is marked as non-allocatable, LVM will not use it for new allocations when creating or extending logical volumes. However, existing logical volumes that span this PV will continue to function normally. To move data off a non-allocatable PV, you would typically use pvmove or other LVM migration tools.

HISTORY

The Logical Volume Manager (LVM) concept originated in Hewlett-Packard's HP-UX operating system. LVM for Linux, often referred to as LVM1, was developed in the late 1990s. The LVM2 iteration, which brought significant improvements in scalability, performance, and flexibility, became the standard in the early 2000s and is the version commonly used today. pvchange has been a fundamental component of LVM since its early days, consistently providing the capability to modify individual physical volume attributes, reflecting the modular design of LVM that separates physical storage management from logical volume organization. Its functionality, particularly the -x (allocatable) option, has remained crucial for managing PV lifecycle within a volume group.

SEE ALSO

pvcreate(8), pvdisplay(8), pvremove(8), pvs(8), vgchange(8), lvchange(8), lvm(8)

Copied to clipboard