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.*
/mnt/archives/filelist.11:/var/lib/ucf/cache/:etc:samba:smb.conf
/mnt/archives/filelist.36:/usr/share/man/man5/smb.conf.5.gz
/mnt/archives/filelist.43:/usr/share/doc/samba-doc/htmldocs/manpages/smb.conf.5.html
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/dce-dfs/smb.conf
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/smb.conf.default.gz
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/tridge/smb.conf
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/tridge/smb.conf.fjall
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/tridge/smb.conf.lapland
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/tridge/smb.conf.vittjokk
/mnt/archives/filelist.44:/usr/share/doc/samba-doc/examples/tridge/smb.conf.WinNT
/mnt/archives/filelist.46:/usr/share/doc/smbldap-tools/examples/smb.conf
/mnt/archives/filelist.48:/usr/share/samba/smb.conf
/mnt/archives/filelist.48:/usr/share/samba/smb.conf.dapper
/mnt/archives/filelist.48:/usr/share/samba/smb.conf.etch
/mnt/archives/filelist.48:/usr/share/samba/smb.conf.gutsy
/mnt/archives/filelist.5:/etc/samba/smb.conf
/mnt/archives/filelist.5:/etc/samba/smb.conf.ucf-dist
$

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: