Skip to content

LVM Volume Lifecycle Management

🖧 Infrastructure Context
Network Topology Diagram

Access via SSH from the default terminal. The cluster topology is defined below:

📄 /etc/hosts (Cluster Inventory)

# Management & Controller
10.0.0.15   terminal       # Main Entry Point

# Web & Application Tier
10.0.0.60   web-srv1   # Nginx / Apache
10.0.0.70   app-srv1    # Backend App

# Data Persistence Tier
10.0.0.80   data-001    # Primary DB
10.0.0.90   data-002    # Replica / Backup

# Virtualization & Containers
10.0.0.100  kvm-001        # Libvirt Hypervisor
10.0.0.110  docker-001     # Container Runtime
⚠️
Constraint: Nested SSH is forbidden. Connect directly from terminal to target IPs.

Business Context: A storage optimization initiative requires decommissioning the physical disk /dev/vdh from the existing volume group vol1. This disk must be repurposed to create a new isolated storage group (vol2) for a specific project.

Technical Objectives:

  1. Hot Migration: Evacuate data from /dev/vdh without service interruption using LVM mirroring capabilities.
  2. Topology Change: Remove /dev/vdh from vol1 and initialize a new Volume Group vol2.
  3. Provisioning: Create a Logical Volume p1 (50 MiB) within vol2.
  4. Filesystem: Format the new volume with ext4.

  1. Analyze Storage Topology

    Confirm the current layout and verify /dev/vdh is part of vol1.

    Ventana de terminal
    sudo pvs
    sudo vgs
  2. Data Evacuation (pvmove)

    Relocate allocated physical extents (PE) from the target disk to other free disks within the same Volume Group.

    Ventana de terminal
    # Verify allocation
    sudo pvdisplay -m /dev/vdh
    # Migrate data
    sudo pvmove /dev/vdh
  3. Decommission Disk

    Once the disk is fully free, remove it from the Volume Group.

    Ventana de terminal
    sudo vgreduce vol1 /dev/vdh
  4. Initialize New Storage Group

    Create the new Volume Group vol2 using the reclaimed physical volume.

    Ventana de terminal
    sudo vgcreate vol2 /dev/vdh
  5. Provision Logical Volume

    Allocate the requested storage capacity.

    Ventana de terminal
    sudo lvcreate -n p1 -L 50M vol2
  6. Apply Filesystem

    Format the block device.

    Ventana de terminal
    sudo mkfs.ext4 /dev/vol2/p1
  7. Final Validation

    Verify the new LVM structure and filesystem signature.

    Ventana de terminal
    sudo lvs -o lv_name,vg_name,lv_size,seg_pe_ranges
    lsblk -f /dev/vol2/p1
  • “Physical volume is still in use”: The vgreduce command will fail if you skipped Step 2. You must evacuate data first.
  • “Insufficient free extents”: If vol1 does not have enough free space on other disks (e.g., /dev/vdb) to hold the data from /dev/vdh, the pvmove operation will fail.