Over the last few weeks, I've been exploring ways to convert physical Debian Linux boxes into virtual machines. VMWare has a tool
for doing P2V conversions, however, as far as I can
tell, it only supports Windows physical machines. Not good. Any alternatives? Uhmm, how about Mondo Rescue?
Mondo Rescue is a disaster recovery software
developed by Hugo Rabson for GNU/Linux. It allows one to effortlessly
backup and interactively restore Linux systems. And what is most interestingly, it allows you to backup to a variety of media like
CD-R, DVD and NFS shares.
So with Mondo Rescue, a Debian Etch box with two IDE disks (/dev/hda, /dev/hdc), Linux software raid (/dev/md0) and VMWare the process eventually goes like this:
- install Mondo Rescue onto the system you want to convert
- stop all problematic services (eg. databases, ...)
- make sure the following linux kernel modules are loaded
mptspi mptscsih mptbase scsi_transport_spi scsi_mod sd_mod pcnet32
- run "mondoarchive" and let it create a set of ISO images
- boot the new VM with the first ISO image
- at the bootprompt, type "interactive" to get started
- since the device names have changed, mondo will complain about fstab, fix it (eg. repartition /dev/sda)
- continue restoring all data
- intitialize boot loader, set boot device to /dev/sda
- edit grub.conf, update the line starting with "#kopt=root=...", set the boot device to /dev/sda1; also remove kernel options for serial console redirections
- when mondo finishes, DO NOT REBOOT!
- remount your disks (eg. mount /dev/sda1 /mnt, mount /dev/sda2 /mnt/usr and so on)
- chroot into /mnt
- edit /etc/mtab, fix the devices names to match the new installation
- edit /boot/grub/devices.map (eg. echo "(hd0) /dev/sda" > /boot/grub/devices.map)
- create a device node for sda (eg. mknod /dev/sda b 8 0)
- run update-grub and also grub-install hd0
- delete /etc/udev/rules.d/z25_persistent-net rule
- exit, umount & reboot
If all went well, your virtual machine should now successfuly boot. Yay, Mondo Rescue!
Continue reading P2V using Mondo Rescue.