Guard Against Data Loss with Mondo Rescue

Hugo shows how to use Mondo to restore your system in the event of catastrophic data loss.
Bare-Bones Restore

Imagine that your hard drives happen to be wiped, deliberately or accidentally. Or, imagine that you want to clone your existing operating system. In either case, you want to run in Nuke Mode. After booting from your Mondo CD, type nuke, press Enter and watch the show. That's it.

If you want to see exactly what Mondo is doing while it is restoring, press Alt-A and type

tail -f /tmp/mondo-restore.log

to monitor its progress in detail.

Selective Restore

If you want to restore only some files, or if you do not want to prep/format your drives, then you should boot into interactive mode. Type interactive and then press Enter at boot time. You will be asked to say yes/no to a range of questions: do you want to partition your devices? Do you want to format them? Do you want to restore everything? Do you want to restore something? Do you want to run LILO to set up your boot sectors?

Interactive mode is for people who have lost a subset of data from their live filesystem or perhaps who have lost some data from their latest backup and want to restore a subset of data from an earlier backup.

Using Expert Mode

When you have backed up your system, booted from the CD in compare mode and verified the archives, you are in a position to experiment with your system. You could move partitions around, resize them, enable or disable RAID, play with other boot loaders, etc. That is what Mondo is really good for. The greatest threat to a typical Linux installation, in my opinion, is a careless root user.

If you want to try some of these tricks, boot from your Mondo CD and choose expert mode. This will drop you to a shell prompt. Edit the mountlist file. Then, type mondo-restore and choose Interactively from the pop-up menu. The mountlist is a text file, /tmp/mountlist.txt, located on the RAM disk after you boot from the Mondo CD. It lists the various partitions that will be created, their sizes, their mountpoints and their formats. To change the size or layout of your partitions, just edit that file with pico /tmp/mountlist.txt (or use your favorite editor). Save and close by pressing Ctrl-X and then Enter.

Here is a sample mountlist. The sizes are in kilobytes, so count the zeros carefully when modifying the values. Remember, the new layout will not take effect until you run mondo-restore to repartition and reformat the drives:

/dev/hda1    /mnt/windows       vfat        4096000
/dev/hda2    swap               swap        256
/dev/hda3    /                  ext2        8192000

To change the root partition's size and format, simply alter the relevant fields:

/dev/hda1    /mnt/windows       vfat        4096000
/dev/hda2    swap               swap        256
/dev/hda3    /                  reiserfs    16384000
Or, you could move from using multiple primaries to using a primary partition (hda1), an extended partition (hda2, created/handled by Mondo) and several logical partitions. Note the new /dev/hdaN entries:
/dev/hda1    /mnt/windows       vfat        4096000
/dev/hda5    swap               swap        256
/dev/hda6    /                  reiserfs    8123000
/dev/hda7    /usr               reiserfs    4099000
/dev/hda8    /home              reiserfs    4099000
If you have added a second hard drive (e.g., primary slave) then you could move some of your partitions to that drive. See below and note the changes:
/dev/hda1    /mnt/windows       vfat        4096000
/dev/hda2    swap               swap        256
/dev/hda3    /                  reiserfs    81422000
/dev/hdb1    /home              reiserfs    9481000
/dev/hdb5    /usr               reiserfs    16384000
/dev/hdb6    /tmp               reiserfs    1589000
It is slightly more complicated to move to RAID because you have to create an /etc/raidtab file. You can do this from within Expert Mode. Just type pico /etc/raidtab and create a good raidtab file. (That is beyond the scope of this article.) Then, replace the conventional device with a RAID device (/dev/mdN):
/dev/hda1    /mnt/windows       vfat        4096000
/dev/hda5    swap               swap        256
/dev/md0     /                  reiserfs    16384000
After editing the mountlist, run mondo-restore. When asked if you want to partition and format the drives, say yes. You may want to restore the data or run LILO to initialize the boot sector, depending on what you are doing. If you are simply testing a new partition layout, you probably want to say no when answering the other questions. Otherwise, say yes.