RHEL P2V: Old Way and New Way

Most of this was taken from this site: http://conshell.net/wiki/index.php/Linux_P2V

Up front work

Determine exactly what you’re doing, and the resources you’ll need on the VMware side.

as root:

sfdisk -s
/dev/hda: 39070080
total: 39070080 blocks

To find the size in GB, divide by 1024 twice.
39070080/1024/1024 = 37.260 GB

Partition layout – know exactly the partitions, sizes and FS types. This can be gleaned from the output of `fdisk -l /dev/sda` and the content of /etc/fstab.

Disk types – IDE? SATA?

Downtime – Unfortunately, your source system must be down for the duration of the P2V process.

Have a copy of the system rescue CD ready. Boot the source system to it.

On the source system:
Back up the kernel’s ramdisk
cp /boot/initrd-`uname -r`.img /root/`uname -r`.bak
Make a new ramdisk with VMware-friendly RHEL scsi drivers
mkinitrd -v -f –with=mptscsih /boot/initrd-`uname -r`.img `uname -r`

This command will make SCSI drivers that VMware needs to use available to RHEL at boot time. This should not affect the source system.

md5sum /dev/sda – record the last six characters of the output. This generates a fingerprint used to verify integrity at the end.

On the target system:

Create a new VM
OS: Linux (RHEL 4/5)
Disk slightly larger than source system
NIC: upgrade to VMware tools
CDROM: System Rescue CD ISO
Boot the system, make sure the disks are recognized (sfdisk -s). Verify network is up with ifconfig eth0.

Disk Cloning

This part takes a while. Boot both systems to the system rescue CD. Try making a benchmark.

Make a 1 GB File on the source system, set the target to prepare for an incoming transmission:

Source: dd if=/dev/zero of=bigfile bs=1024 count=1048576
Target: nc -l -p 9001 | dd of=/dev/sda
Write down the start time.
Source: dd if=bigfile | nc 9001
Write down the finish time.
Estimate accordingly. (e.g., 20 gb would be at least 20 times longer)
For the “real” copy, remember you are copying a device to a device.

Target:

nc -l -p 9001 | dd of=/dev/sda
Source:

dd if=/dev/sda | nc 9001
There may be differing builds of nc, so your mileage may vary regarding the switches for ports. use nc –help to find out which version of the rescue CD. To gauge how long this would take you may want to try using pipe viewer.

One the source machine, if you need it to boot again you may need to run this command:
mv /root/`uname -r`.bak /boot/initrd-`uname -r`.img

New Way
VMware vCenter Converter 4.0 supports RHEL P2V. Win.

Advertisements

2 thoughts on “RHEL P2V: Old Way and New Way

  1. Other Old way…

    PlateSpin migrate (or the old name PlateSpin PowerConvert) has been supporting Linux P2V for quite a while already.. (past 3 years or so…)

    And yes.. I work for PlateSpin.. ;)

    Regards,
    Patrick

  2. Patrick,

    That’s what I had heard, but we never had it as a budgeted priority to P2V Linux machines. Now that we are moving to a more RHEL/Oracle environment, it’s becoming more important.

    Thanks!

Comments are closed.