LinuxCommandLibrary

vgextend

Add physical volumes to a volume group

TLDR

Add a physical volume to an existing volume group

$ vgextend [vg1] [/dev/sda1]
copy

Add multiple physical volumes to an existing volume group
$ vgextend [vg1] [/dev/sda1 /dev/sda2 ...]
copy

SYNOPSIS

vgextend [OPTIONS] VolumeGroupName PhysicalVolumePath [PhysicalVolumePath...]

PARAMETERS

-f, --force
    Force the operation, overriding certain checks or warnings.

-t, --test
    Perform a dry run; do not make any actual changes. Useful for testing commands without risk.

-v, --verbose
    Display detailed runtime information, showing more of what the command is doing.

-y, --yes
    Assume "yes" to all questions; useful for scripting interactive commands.

--addtag <tag>
    Add a tag to the volume group being extended.

--alloc <policy>
    Specify the allocation policy for physical extents (e.g., contiguous, anywhere, cluster).

--config <config_string>
    Use a specific configuration string for this command execution.

--devices <devices_list>
    Restrict the scan and operation to specified devices only.

--noudevsync
    Do not synchronize with udev. This may cause problems if udev is not aware of the changes.

DESCRIPTION

vgextend is a crucial command in Linux's Logical Volume Manager (LVM) framework, designed to expand the storage capacity of an existing volume group. A volume group (VG) is a collection of one or more physical volumes (PVs), which are typically disk partitions or entire disks. When a volume group's available space becomes insufficient, vgextend allows administrators to incorporate additional PVs, thereby increasing the total pool of storage from which logical volumes (LVs) can be allocated.

Before using vgextend, any new physical devices intended for addition must first be initialized as LVM physical volumes using the pvcreate command. Once prepared, vgextend seamlessly integrates these PVs into the specified volume group, making their storage available. This dynamic resizing capability is a cornerstone of LVM, providing flexibility to adapt storage infrastructure without downtime (for the VG operation itself). It's important to note that extending a volume group only increases the overall capacity; it does not automatically extend any existing logical volumes within that group. Logical volumes must be extended separately using the lvextend command.

CAVEATS

  • Adding PVs to a VG increases its capacity, but does not automatically extend existing Logical Volumes (LVs). LVs must be extended separately using lvextend.
  • The Physical Volumes (PVs) being added must first be initialized using pvcreate and must not already be part of another volume group.
  • vgextend requires root privileges to execute successfully.
  • Ensure the PVs are healthy and accessible before attempting to add them to a volume group.

PREREQUISITES

Before a physical device (like a disk or partition) can be added to a volume group using vgextend, it must first be prepared as an LVM Physical Volume. This preparation is done using the pvcreate command, which initializes the device by writing LVM metadata to it.

CAPACITY VS. LV SIZE

While vgextend increases the overall storage capacity of the volume group, it is crucial to understand that this does not automatically resize any existing logical volumes within that group. The newly added space becomes available for creating new logical volumes or for extending existing ones with lvextend.

HISTORY

The Logical Volume Manager (LVM) for Linux was largely inspired by the LVM implementation found in HP-UX, with initial work beginning in the late 1990s and significant adoption in the early 2000s. vgextend has been a core component of the LVM suite since its early versions, providing the essential capability to dynamically grow storage pools. Its functionality reflects the fundamental need for flexible, scalable storage management in enterprise and general-purpose Linux environments, allowing system administrators to adapt storage capacity on the fly without complex reconfigurations or service interruptions.

SEE ALSO

pvcreate(8), vgcreate(8), vgreduce(8), lvextend(8), lvm(8)

Copied to clipboard