LVM – How to migrate data between disks?


Red Hat Enterprise Linux Server 6.0


You have a server connected in storage A and need migrate the data to new storage B.

How to migrate data between disks with the server online?

In this article I will explain how migration of data between the disks, without unavailability, remember that in our example we’re using LVM.

This article assumes that the new disk has been installed on the system and is visible to the operating system as /dev/sdb.

Create a new partition of type LVM in new disk:

Create a new PV:

# pvcreate /dev/sdb1

Add the new PV to VG:

# vgextend VG_NAME /dev/sdb1

Move data between disks with command:

# pvmove -v /dev/sda1

The command pvmove will move data from disk sda1 to sdb1:

Check if the PV was released with command:

# pvs

Now remove the old disk from the VG with command:

# vgreduce -a

The option -a remove from VG all the PV free. In our exemple the disk sda1.

Now the disk can be removed from the server.

Leave a Reply

Your email address will not be published. Required fields are marked *