Friday, December 31, 2010

Restoring files manually from a mondo backup

As already mentioned in earlier posts, I uses mondo to create system backups of all my systems. By system backups I mean; create a backup of the live system, without any personal data. In short, this is a backup of everything except home folders. The home folders are backed up using rsync and external disks, but this is another story.
Restoring from a mondo backup is easy; simply burn the images, put it in a cd drive and nuke the system (yes, this is a restore option in mondo :) ).
If you just want to restore some files from the backup, without overwriting the whole system, there's an easy way to do this. Suppose you created an ISO a while ago and these are stored on some disk. First, you will need to mount the ISO as a loopback device like so:

mount -o loop MyIso.iso /mnt

The ISO is now mounted in /mnt.
Now locate the file you want to restore (I was going to restore smb.conf):

$ grep smb.conf /mnt/archives/filelist.*

The file I needed was somewhere in an archive identified by number 5.
Now create some folder in a temporary location:

$ mkdir /tmp/restore
$ cd /tmp/restore

Now restore the contents of the archive you want (you might need to download and install afio):

afio -ZP bzip2 -i /mnt/archives/5.afio.bz2

The whole archive is now restored underneath /tmp/restore. So my smb.conf is now located underneath /tmp/restore/etc/samba/smb.conf. Pretty cool eh.

Anyway, I don't deserve any credits for this post, I found a lot of help here.

EDIT: Apparently there is an easier, more graphical way to restore stuff from a mondo archive.

No comments: