Posted by Road on Tue 2 May 2006 at 07:22
Mondo is a great system duplication/imaging tool. With Mondo you can create a boot disks that will completely restore your system to a previous state. This can be vital in disaster recovery or duplication. I use it for both testing, duplication and disaster recovery in my environment and I would be lost without it.
The problem is that the Debian Sarge package for Mondo does not work well with RAID (it actually does not work at all). This is because Sarge no longer supports raidtools2 but rather mdadm only. Mdadm is better, so if you have not picked it up yet you really should. Until it's patched, here is an easy work around, while not elegant, it should allow you to restore your data on RAID systems.
Prerequisite
The first step is to have a Debian Sarge system running RAID. This can be done via the installer or later by hand whichever you prefer. Now that the installer allows you to create a RAID during the initial install, I imagine more people now run RAID on Debain than before.
Preparation
On the system you plan to clone, you need to install mondo
aptitude install mondoNow we need to edit some configuration files to add a few packages to mindi (part of mondo). Because the default install uses raidtools and Sarge does not have raidtools, we have to tell Mondo to add the package mdadm. Use whatever editor you like and modify
/etc/mindi/deplist.txtAdd the following to pretty much anywhere, I put in under the "Covers a multitude of sins" section
mdadm cfdiskcfdisk is optional but I like using that much more than fdisk.
Create the Image
There are many ways to make a mondo image. You can burn it directly to a CD/DVD but I prefer to create an iso image on the host drive and then transfer and burn it somewhere else.
mondoarchive -Oi -d /var/images/ -S /var/images/ -E /var/images/ -s 4200mThis command creates an archive image in the /var/images/ directory. It also excludes the /var/images directory in the iso it's creating (you dont want an image of your image). The "-s" section is for size, since I am making a DVD it's at 4200 megs, but if it was a cd you leave that switch out. Make sure that the directory is already created and you can pretty much use any location you want as long as it has enough room. After it's done (it could be awhile) you will have a compressed image of you disk, usually called something like 1.iso under the images directory. Burn that disk image to a cd/dvd and you now have a bootable drive you can recover your system from.
Recovery
Put the CD in machine you want to put the image on and boot (make sure boot to cd is enabled in your bios). When the Mondo boot screen appears, type
expertand hit return. This will get you to a basic shell where you can create your new RAID devices to put the image on.
mondorestore-> Interactive -> Ok to mount list -> No to erase and partition -> Say no to format -> Yes to Restore all data
Grub After looking at what I wrote I realized I forgot about grub. It also seems that grub does not always work through mondo when doing it this way. To fix it you just install grub by hand. After the restore has happened it should bounce you out to the shell. This assumes you have 2 drives hda and hdc, with the first partition as the bootable partition.
grubNow we do the same thing but for the other drive, assuming that your boot partition is mirrored.
device (hd0) /dev/hda
root (hd0,0)
setup (hd0)
grub
device (hd1) /dev/hdc
root (hd1,0)
setup (hd1)
Once finished you should have an exact clone of your machine running on RAID devices. You can also restore to non-RAID or visa versa but it's a little bit more tricky. If your interested in that, let me know and I will add it. I hope this helps someone that has also run into the problem with RAID, Mondo and Debian Sarge.
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2006 Road - please ask for permission to republish or translate.