Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Tuesday, January 19, 2016

CentOS V2V | Hyper-V to VMware - The easy way

I had a task to export a Hyper-V, CentOS 6 VM and deploy it to a vSphere cluster. Due to the nature of the VM we had to preserve it because the VM was already set up and it was too long for us to build a new one with the same settings.

Before start I would like to point out that if this is a Linux VM you are doing, then because there will be a complete hardware change you may end up with unbootable clone, which can be fixed. This did not happen to me though, but in the end of this article I will also point those things out as potential issues.


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