This site is now 100% read-only, and retired.

Mondo, RAID, Debian Sarge Workaround

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 mondo
Now 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.txt
Add the following to pretty much anywhere, I put in under the "Covers a multitude of sins" section
mdadm cfdisk
cfdisk 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 4200m
This 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

expert
and hit return. This will get you to a basic shell where you can create your new RAID devices to put the image on.

One in the shell use tools like cfdisk and mdadm to recreate your RAID devices. I assume you have done this before but for record here is the basic instructions for a RAID 1(mirror) setup.
  1. Create partitions of equal size on 2 hardrives.
  2. If booting directly to the raidset without an initrd image (and you recompiled your kernel to allow this) make their type fd
  3. Create the RAID set. (assuming your using drive hda and hdc and its partition one on those drives) - Do the below for each raid device.
  4. mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1
  5. Check /proc/mdstat and wait until they are synced
  6. Create the file system you want, example mkfs -t ext3 /dev/md0 or mkswap /dev/md1
Now run
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.

grub
device (hd0) /dev/hda
root (hd0,0)
setup (hd0)
Now we do the same thing but for the other drive, assuming that your boot partition is mirrored.
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.

 

 


Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (193.219.xx.xx) on Tue 2 May 2006 at 15:29
...Check /proc/mdstat and wait until they are synced...
I think there isn't much reason to wait for syncing, md will continue latter anyway (i.e. after backup is restored/system rebooted).

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Road (67.88.xx.xx) on Tue 2 May 2006 at 17:33
Your absolutly right, it works both ways. When I am making a fresh system I caution on the safe side.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by mangler (130.15.xx.xx) on Wed 3 May 2006 at 20:14
Having had an issue of the system using mdadm, you should really wait for the resync, as mkinitrd will only see drives that are built, and not syncing. Otherwise, the system will always resync on reboots.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (217.168.xx.xx) on Tue 2 May 2006 at 17:42
I followed the steps described but /dev/md0,1,2,3,4 cannot be opened and mdstat doesn't exist.
Anyway, from the interactive mode if i try to recreate raid (ex. md0 with 2 disks and level 1 raid), i get into this message:

"You have chosen a raid personality which is not registered with the kernel. Make another selection?"

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Road (67.88.xx.xx) on Tue 2 May 2006 at 17:56
When you where in the shell what did it say when you ran the mdadm -A /dev/md0 /dev/hd[ac]1

You cannot use any of the gui tools to create the partition or raid devices in mondo, you use it to do the restore, its just broken.

You can also you mdadm --detail /dev/md0 to get a detailed look of your raid device.

Also this tutorial assumes the drive you made the image from was already running raid.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (217.168.xx.xx) on Wed 3 May 2006 at 08:45
>When you where in the shell what did it say when you ran the mdadm -A /dev/md0 >/dev/hd[ac]1

It says: "mdadm: error opening /dev/md0: No such device or address"

>You cannot use any of the gui tools to create the partition or raid devices in >mondo, you use it to do the restore, its just broken.

Yes, i know, so the gui tools are the last resource i tried to create raid after using mdadm from the expert mode.

>You can also you mdadm --detail /dev/md0 to get a detailed look of your raid >device.

It says: "mdadm: cannot open /dev/md0: No such device or address"

>Also this tutorial assumes the drive you made the image from was already running >raid.
Sure, it's for this reason that i'm having trouble during the restore, infact the fstab suggest a md raid structure.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Road (67.88.xx.xx) on Wed 3 May 2006 at 17:48

If you created the raid devices by hand in the expert shell on the mondo disk they should start automatically, but it looks yours have not. Try this:

mdadm -A /dev/md0


It should say something like starting array. You can make sure your array is running by using the mdadm --detail /dev/md0. Start each of your arrays before you try and proceed, they have to be running for mondo to restore to them.



Once the array is started everything should work, if you cannot start your array that would mean that you do not have an array. If thats the case tell me what you did to create the array and I will try and help to see if there is a problem.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (217.168.xx.xx) on Fri 5 May 2006 at 11:05
mdadm -A /dev/md0
tell me: "mdadm: error opening /dev/md0: no such device or address"

>Once the array is started everything should work, if you cannot start your array >that would mean that you do not have an array.
It seems that i don't have an array started, so i saw these messages during boot:

Running 'raidstart /dev/md0'
/sbin/init: 653: raidstart: not found

even if, after creating the backup cd i installed raidtools but this is not enough

>If thats the case tell me what you did to create the array and I will try and >help to see if there is a problem.

this is the original array:
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hde1[0] hdg1[1]
128384 blocks [2/2] [UU]

md3 : active raid1 hde5[0] hdg5[1]
2931712 blocks [2/2] [UU]

md4 : active raid1 hde6[0] hdg6[1]
979840 blocks [2/2] [UU]

md5 : active raid1 hde7[0] hdg7[1]
73063488 blocks [2/2] [UU]

md2 : active raid1 hde3[0] hdg3[1]
1951808 blocks [2/2] [UU]

md1 : active raid1 hde2[0] hdg2[1]
979840 blocks [2/2] [UU]

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (202.10.xx.xx) on Sun 1 Apr 2007 at 02:56
Try running 'modprobe raid1' as root first.

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (87.250.xx.xx) on Fri 20 Jul 2007 at 08:25
you rule!

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (200.68.xx.xx) on Thu 6 Mar 2008 at 18:25
You rule a lot!!!!

[ Parent ]

Re: Mondo, RAID, Debian Sarge Workaround
Posted by Anonymous (80.69.xx.xx) on Tue 11 Jul 2006 at 14:21
You can use /sbin/update-grub to setup grub, so you do not have to use the grubshell.

[ Parent ]