Carl’s Blog

How to remove Linux software RAID1 (md raid) on-the-fly so that VMWare Converter works

by Carl Farrington on Oct.08, 2009, under Computer Stuff, Tips & Tricks

Trying to do a physical to virtual conversion so that this blog can be put on the VMWare ESXi 4 box, and the little HP box can do Asterisk (VMWare didn’t play well with Asterisk).
After much frustration (need 32-bit libs on Fedora for the Converter to run), I still couldn’t quite fathom out why the converted machine failed to boot (“cannot find root”), then it dawned on me that the VMWare converter was not finding the root filesystem because it was on a linux raid1 mirror partition, which the converter doesn’t support.

Rather than transferring manually, here’s what I did:
fdisk
change partition type of RAID partition from type fd (linux raid autodetect) to 83 (linux ext). This might not be necessary, but it should prevent the kernel from auto-configuring RAID for that partition.
cd /etc
mv mdadm.conf mdadm.conf.old (i.e. remove the mdadm.conf configuration file, but keep as a backup just in case).
mkinitrd /boot/initrd-noraid-`uname -r`.img `uname -r`
(basically we’re doing “mkinitrd /boot/initrd-noraid-2.2.15-el5.img 2.2.15-el5″ if 2.2.15-el5 is your running kernel version.. the uname -r substitutes this for us.)
cd /boot/grub
edit grub.conf and change kernel boot parameter root= to reflect partition without raid, e.g. change from /dev/md0 to /dev/sda2, also change the initrd= line to /boot/initrd-noraid-x.x.x.img

Now the initial ramdisk has no mdadm.conf, and the partition type is no longer set to linux raid autodetect (type fd).
Power down, remove one of the RAID1 disks, and the system should boot and run now off the other disk without RAID.

VMWare converter now works. Job’s a good ‘un.


3 Comments for this entry

  • Michael Morel

    Great litle info, but we also had to edit the fstab to change the information there for the root filesystem and the other filesystems so that they did not reference /dev/mdX.

    FYI: The fdisk and changing of the partition types WAS necessary.

    After that the server booted up fine and we were also able to use the Vmware Converter without issue.

  • Carl Farrington

    Awesome. Thanks for the tip re: fstab, I was writing from memory and must’ve done the same but forgotten about it.
    cheers,
    Carl

  • Fredrik Linnander

    Worked for me!

    Insted of removing a physical harddrive I removed the bootflag from one drive using fdisk.

    /F

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...