How to delete a disk from a LVM group while keeping the data

This is the scenario:

I want to remove a old hard disk which is a LVM PV and contains data. There is free space available on other PVs in the VG. It should move the data from the disk to be removed to other PVs and then remove the disk.

The process to remove sdb from VG vg is as follows.

First, distribute old extends from sdb to other PV

# pvmove /dev/sdb

it will take much time.

Second, delete sdb

# vgreduce vg /dev/sdb

Now, you can physically remove the sdb disk.

Then you can add new disks and extend the VGs.

After vgreduce, you may wipe the labels on the disk by

# pvremove /dev/sdb

One comment:

  1. Thank you for this article. It is good.

    Please help me to get the answer.

    Q – Suppose a disk is being used for one vg let’s say “linuxvg” . In addition no filesystem mounted on this. Unknowingly or accidentally I removed the disk. So what disaster will happen?

Leave a Reply

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