LinuxCommandLibrary

vgsplit

Split a volume group into multiple groups

SYNOPSIS

vgsplit OldVGName NewVGName [LV_Path...]

PARAMETERS

OldVGName
    The name of the existing Volume Group that will be split. This VG will retain any Logical Volumes not explicitly moved to the new VG.

NewVGName
    The name for the new Volume Group that will be created. The specified Logical Volumes and their associated Physical Volumes will be moved into this new VG.

LV_Path
    One or more full paths to Logical Volumes (e.g., /dev/OriginalVG/my_lv) that will be moved from OldVGName to NewVGName. If multiple LVs are to be moved, list them separated by spaces.

-f, --force
    Forces the operation, bypassing some interactive confirmations or sanity checks. Use with caution.

-t, --test
    Executes the command in test mode. It simulates the split operation without making any actual changes to the Volume Groups or data, displaying what would happen.

-v, --verbose
    Provides more detailed output during the command's execution, showing steps and status.

-q, --quiet
    Suppresses informational messages, showing only critical errors.

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

DESCRIPTION

vgsplit is a powerful LVM2 command used to reorganize storage by dividing a single existing Volume Group (VG) into two distinct new VGs. When executed, it transfers a specified set of Logical Volumes (LVs) from the OriginalVG to a NewVGName. The OriginalVG retains its name and keeps all LVs not explicitly moved. Simultaneously, a new Volume Group is created with the NewVGName, inheriting the specified LVs and their underlying Physical Volumes (PVs). This operation is atomic and ensures data integrity, as LVs are moved by updating LVM metadata rather than copying data blocks. It's an essential tool for re-structuring storage for administrative separation, performance isolation, or preparing for migration, allowing administrators to logically separate workloads or departments into their own volume groups without disrupting existing data.

CAVEATS

Data Integrity: While vgsplit updates LVM metadata without data loss, it's best practice to unmount any filesystems residing on the LVs to be moved and deactivate them before running the command to prevent data corruption during active I/O.
PV Association: Physical Volumes (PVs) that contain extents belonging to the moved Logical Volumes will automatically be reassigned to the NewVGName. PVs are not themselves "split"; their association is updated based on the LVs they host.
Root VG: Splitting the Volume Group that contains your root filesystem is highly risky and generally not recommended without a comprehensive understanding of LVM and system boot processes.
Post-Split Actions: After a successful split, the new Volume Group (NewVGName) might need to be explicitly activated using vgchange -ay NewVGName. Filesystems on the moved LVs will also require updates to their mount points in /etc/fstab to reflect the new VG name.

HOW <I>VGSPLIT</I> WORKS

When vgsplit is executed, it meticulously updates the LVM metadata on the involved Physical Volumes. It identifies the Physical Extents (PEs) that belong to the specified Logical Volumes (LVs) to be moved. These PEs, along with their associated LVs, are then logically transferred from the metadata of the OriginalVGName to the newly created NewVGName. The command ensures that the mapping from LVs to PEs remains consistent. It's a metadata-only operation for the LVs themselves; the actual data blocks on disk are not moved or copied, which makes the operation very fast and minimizes the risk of data loss compared to block-level migrations.

COMMON USE CASES

vgsplit is particularly useful in scenarios where a single large Volume Group has grown to encompass diverse workloads or departments, and a clearer separation is desired for administrative, security, or performance reasons. For example, an administrator might split a VG to: isolate production LVs from development LVs; move specific database LVs to a dedicated VG for better management; or prepare a subset of LVs and their PVs for migration to a different storage system by first creating a standalone VG.

HISTORY

The vgsplit command is an integral part of the LVM2 (Logical Volume Manager version 2) suite of utilities for Linux. LVM2 was a significant re-architecture of the original LVM, introduced to provide greater scalability, flexibility, and robustness for managing storage. While LVM has been a core component of Linux storage for decades, vgsplit specifically emerged in the LVM2 context to provide a dedicated, atomic operation for reorganizing Volume Groups. Prior to such a command, achieving a similar separation of LVs would often involve more manual steps, such as creating new VGs, moving Physical Extents with pvmove, and then re-creating or re-assigning Logical Volumes, which was more complex and prone to error. vgsplit streamlines this advanced storage reorganization task.

SEE ALSO

Copied to clipboard