LinuxCommandLibrary

vgmerge

Merge two volume groups together

SYNOPSIS

vgmerge [-f|--force] [--noudevsync] [--reportformat {basic|json}] SourceVG TargetVG

PARAMETERS

SourceVG
    The name of the volume group to be merged into the TargetVG. This VG will be removed after the merge.

TargetVG
    The name of the volume group that will receive the PVs and LVs from the SourceVG.

-f, --force
    Force the merge operation. Use with extreme caution as it bypasses some safety checks.

--noudevsync
    Do not synchronize with udev. This is typically used in clustered environments to avoid potential conflicts.

--reportformat {basic|json}
    Select the output format for reports generated by LVM commands. While not directly altering the merge, it's a common option for LVM tools.

DESCRIPTION

vgmerge is a crucial LVM (Logical Volume Manager) command used to consolidate storage by merging two existing volume groups into a single, larger one. When executed, it transfers all physical volumes (PVs) and logical volumes (LVs) from the SourceVG to the TargetVG. After a successful merge, the SourceVG ceases to exist, and its resources become part of the TargetVG.

This operation is typically performed to simplify storage management, increase the capacity of an existing volume group, or to decommission a smaller, separate volume group while retaining its data. It's a powerful command that permanently alters your LVM setup, so careful planning and backups are highly recommended before execution.

CAVEATS

The SourceVG must be inactive and have no open logical volumes.
The TargetVG must be active.
All physical volumes of the SourceVG must be present and healthy. Missing PVs will prevent the merge.
Both volume groups must have compatible LVM metadata.
This is a destructive operation for the SourceVG; ensure all data is accounted for or backed up beforehand.

PRE-MERGE CHECKS

Before attempting a merge, always verify the status of both volume groups using vgs, lvs, and pvs. Ensure the SourceVG is deactivated (e.g., vgchange -an SourceVG) and that no logical volumes within it are in use or mounted.

ROLLBACK CONSIDERATIONS

There is no direct 'unmerge' command. If a problem occurs, restoring from backup or manually recreating the volume groups and data might be necessary. This underscores the importance of thorough planning and backup procedures.

HISTORY

vgmerge is an integral part of the LVM (Logical Volume Manager) suite of tools on Linux. LVM was initially developed by Joe Thornber and first released in 1998. It was significantly enhanced with the introduction of LVM2, which provided a more robust and flexible architecture.

vgmerge has been a staple command within the LVM utilities, allowing administrators to dynamically manage and consolidate storage resources, reflecting the ongoing need for flexible storage solutions in evolving IT environments. Its functionality remains critical for maintaining and optimizing complex storage configurations.

SEE ALSO

lvm(8), vgchange(8), vgcreate(8), vgremove(8), vgs(8), lvs(8), pvs(8)

Copied to clipboard