Wednesday, September 23, 2015

Convert Linux LVM partitions back to normal partitions

There are number of questions online regarding this issue, but I haven't found a concrete solution just untill recently, when I had a task to make a P2V Conversion of a CentoOS Server. If you happen to have a system with a logical volume (LV) but for whatever reasons at a later time you decide that you want to transfer that LV or convert it back to normal partition eg. /dev/sdc1 than I discovered a very easy procedure which can help you to do just that.

You will need a spare drive or a partition with the same size (or bigger) to do that. First make sure that you have your drive ready and with at least one partition table that is the exact same size, or larger then the original LV.

On my system the logical volume is located at: /dev/VolGroup00/LogVol00.
You can use dd to convert the LV back to normal partition.

The procedure to convert the LV to a normal partition is as follows.

# dd if=/dev/VolGroup00/LogVol00 of=/dev/sdc1 bs=4M

Depending on the size of your partitions you will have to wait for some time. Also keep in mind that dd does not produce any output except if something goes wrong. In my case the disks were 230G (the original LV) and 250G (the other disk) respectively, so I've waited for 3 hours at least.

After the process is finished you can mount the /dev/sdc1 partition and you will be able to see all of your files inside. The output of df -h or fdisk -l will show 230G of space instead of 250G as we made a clone of the LV partition.

If you still want to continue to use your old drive where the LV was, than just format that old drive/partition /dev/sdb1 (in my case) and make that same transfer again but in reverse order.

# dd if=/dev/sdc1 of=/dev/sdb1 bs=4M


  1. Thanks Tom, but there's one more step - Don't forget to update your /etc/fstab.