We have a CentOS 5.4 server (build 2.6.18-164.el5xen).

We went to P2V this server so we can have redundancy, the physical only has one PSU.

The P2V only completed 99% of the way, we have a VMWare ticket opened, but they marked the ticket as low priority.

I was able to boot into a rescue disc of Red Hat 5.4 and rebuild the initrd with the help of this blog post.

Now the only issue is the original server had a modified initrd, which was also from a different OS build and made by an outside provider. We do not have a document outlining modifications.

My question is, is it at all possible to copy the initrd off of the physical server and replace it on the virtual and some how have the virtual machine boot?

Thanks for any input.

Edit: I copied the initrd img from the physical and it recreated the original issue. Here is a screen capture of the error. http://i.imgur.com/MqC73.jpg


echo Scanning logical volumes

lvm vgscan --ignorelockingfailure

echo Activating logical volumes

lvm vgchange -ay --ignorelockingfailure VolGroup00

resume /dev/VolGroup00/LogVol01

echo Creating root device.

mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00

echo Mounting root filesystem.

mount /sysroot

  • 1
    Without knowing what errors you're getting when you try to start the VM (and possibly what changes you made), it'll be very difficult to answer this. I mean, you can copy the initrd from /boot (it's just a file), but we have no idea what modifications were done to it or why it's not booting now. – phresus Mar 27 '12 at 19:39
  • @phresus Apologies, my link did not stay in with the formatting. michael.requeny.com/2011/03/25/p2v-volgroup00-linux-lvm My steps were boot up using a RedHat 5.4 installation disc and going into rescue mode. I then copied the initrd off of that installation media. I will try copying the initrd from the physical to the VM and see if it still boots. – Mike Soule Mar 27 '12 at 20:51
  • 1
    You can (and should) just extract the initrd (it's a gzipped cpio archive on RHEL5) and grab whatever modifications they made. Additionally, /init (inside the initrd) is a flat text file. If you compare the new (working) initrd, and the old (busted) initrd, you should be able to find the driver differences which cause the failure, and put them back in: withdevo.net/?p=128 – phresus Mar 28 '12 at 17:18
  • 1
    That part of the initrd is completely normal. It's possible that they added files somewhere inside the initrd (a "find ." on both initrds followed by a diff would clarify that one for sure), but it doesn't much matter at this point. If I had to guess, I'd say it's at the ide/scsi drivers just above the LVM stuff. Take the initrd you rebuilt (that boots) and compare it to the one that doesn't. See if the IDE/SCSI drivers are different. It's entirely possible that it can't load it because vgscan finds nothing (and no disks). Echo fdisk if present in the initrd, or ls /dev – phresus Mar 29 '12 at 16:35
  • 1
    Extract the Redhat initrd. Copy mptspi.ko out of $initrd/lib (/lib inside the initrd is where drivers go). Put it in the other initrd. Change the driver load line in init. Recompress it like the article says, and boot with it. – phresus Mar 29 '12 at 23:10

I have always had much better success booting the physical system with "Parted Magic" USB or CD, imaging the system with Clonezilla (from inside of PMagic), then restoring in the virtual machine with the same Parted Magic disk.

If you are migrating a Windows machine, "mergeide" might also be quite helpful for you.

More on mergeide: http://www.biermann.org/philipp/STOP_0x0000007B/

| improve this answer | |
  • We were able to get a byte by byte image to work as a VM, just this process takes awhile and we are looking for something a little more streamlined. – Mike Soule Mar 29 '12 at 15:21

How did you do P2V? Is it with the converter? For linux vms, you could also just boot up physical and vm both with livecd and do an rsync with grub installation, or dd if the disk sizes are the same. I often find this works better than converter.

You can try copy initr image for sure. initrd image is just an archive that among other things loads modules necessary for booting. Is your customized initrd image for handling nonstandard hardware in the phsical server? In any case, loading the modules without the corresponding hw available should not matter.

| improve this answer | |
  • Yes, the P2V Convertor. Would rsync grab the partition structure? The structure is a little complicated, not just a single volume sadly. I will attempt a copy of the initrd between the two servers. – Mike Soule Mar 27 '12 at 20:55
  • Rsync mah boot records! [endsnark] – Tim Mar 28 '12 at 19:40
  • 1
    Yeah, if you rsync, you need to reinstall grub, which will fix the boot record. rsync will only copy files, not the boot record. dd disks (if the size of old and new are the same) will replicate everything. – johnshen64 Mar 28 '12 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.