LVM: Replacing a Physical Disk Without Downtime | INTROSERV
EUR
european

EUR

usa

USD

English En
Ex. VAT Ex. VAT 0%

LVM: Replacing a Physical Disk Without Downtime

Introduction

In this guide, you perform LVM data migration on a live system without interrupting services. You learn how to safely migrate LVM volumes, execute a controlled LVM storage migration, and replace a disk while maintaining full system availability. This approach is widely used in LVM disk management to support maintenance, upgrades, and hardware replacement.

End goal: By the end of this tutorial, you will complete a full LVM data relocation process and replace a physical disk without downtime.

Prerequisites

Target audience: Beginner system administrators

Estimated time: 30 to 60 minutes

System requirements

  • Debian 13 (tested), compatible with other Linux distributions with LVM
  • LVM2 version 2.03 or later
  • At least two physical volumes in a single volume group
  • Enough free space to migrate LVM data to new disk

Access requirements

  • Root or sudo privileges

Step 0: Inspect Current LVM Configuration

Verify that LVM is installed:

sudo lvm version

Expected result: You see LVM version details.

Inspect the current configuration:

sudo pvs

sudo vgs

sudo lvs

Expected result: You see all physical volumes, volume groups, and logical volumes.

Info

Important: This is a live LVM disk replacement guide. Mistakes can cause irreversible data loss. Always confirm commands and create backups.

Back up LVM metadata:

sudo vgcfgbackup

Expected result: A backup file is created in /etc/lvm/backup/.

Step 1: Inspect Current Storage Layout

Run:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Expected result: You see all disks and mount points.

Identify:

  • Disk to replace, for example /dev/sdb
  • New disk, for example /dev/sdc

Check usage:

sudo pvs -o+pv_used

Expected result: You see allocated space per physical volume.

Step 2: Initialize New Physical Volume and Add to Volume Group

Initialize the new disk:

sudo pvcreate /dev/sdc

Add it to the volume group:

sudo vgextend <VG_NAME> /dev/sdc

Expected result: The new disk becomes part of the volume group.

Step 3: Ensure Sufficient Free Space

Check available space:

sudo vgs

Expected result: The VFree column shows available capacity.

Tip

Ensure available space is equal to or greater than the used space on the source disk before starting the LVM data movement without downtime.

Step 4: Migrate Data from the Old Physical Volume

Run the LVM pvmove command:

sudo pvmove /dev/sdb /dev/sdc

Expected result: You see progress output indicating active data migration.

Step 5: Verify Data Migration Completion

Run:

sudo pvs -o+pv_used

Expected result: The old physical volume shows 0 used space.

Step 6: Remove the Old Physical Volume

Run:

sudo vgreduce <VG_NAME> /dev/sdb

Expected result: The physical volume is removed from the volume group.

Step 7: Remove LVM Metadata from the Disk

Run:

sudo pvremove /dev/sdb

Expected result: LVM metadata is erased from the disk.

Step 8: Confirm Volume Group Size

Run:

sudo vgs

Expected result: The volume group reflects only active physical volumes.

Step 9 (Optional): Extend Filesystem

Extend the root logical volume:

sudo lvextend -l +100%FREE /dev/<VG_NAME>/root

Expected result: The logical volume uses all available free space.

Verification and Testing

Check volume groups:

sudo vgs

Check logical volumes:

sudo lvs

Check mounted filesystems:

df -h

Test write access:

sudo touch /<MOUNT_POINT>/testfile

ls -l /<MOUNT_POINT>/testfile

Expected result: The file is successfully created.

Reverting Changes

Abort migration if needed:

sudo pvmove --abort

Restore metadata:

sudo vgcfgrestore <VG_NAME>

Expected result: The system returns to the previous state.

Troubleshooting

  • Problem: pvmove is slow
    Reason: Expected behavior during large LVM data migration
  • Problem: Not enough space
    Solution: Add another disk using vgextend
  • Problem: Data still present on old disk
    Solution: sudo pvmove /dev/sdb /dev/sdc
  • Problem: Cannot remove physical volume
    Solution: Ensure no extents remain allocated

Conclusion and Next Steps

You completed a full LVM storage migration, successfully replaced a disk, and maintained uptime. This method is essential for safe LVM disk management and real world infrastructure maintenance.

Next steps

  • Practice this LVM disk replacement guide in a lab environment
  • Explore LVM snapshots for backup strategies
  • Learn about thin provisioning for advanced storage optimization

VAT

  • Other

    Ex. VAT

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    22%
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • germany
  • Español
  • Italiano
  • Poland
  • Русский
  • Slovenski
  • Türkçe
  • ukraine
  • kingdom
  • French
  • Hrvatska
  • Other
  • Austria
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Poland
  • Portugal
  • Romania
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • USA