Recovering backup files

Backup Policy

We use afbackup to make backups. Package successfully ran for 3 years on pc781 cluster. and for 3 years on ckm cluster. BUT as we did not have real disk failures all test were artificial. Artificial tests went fine.

We monitor /var /etc and /home directories and do the following backups:

Full and incremental backups reside on ckm00:/data/afbackup area. But do not directly work with these files (they are not just simple *.tar.gz files).
Daily backups reside on the same computer in /data/daily_backup area. Those files are simple *.tar.gz files - feel free to disect them.

Lost file was accessed less than a week ago.

This task canbe performed by any user who owned the file. Imagine that you have worked with a file bookmarks.html less than a week ago, and 5 minutes ago you have accidently killed it. Your bookmarks are gone and you are lost in the dungeons of Internet. Now try to recover it. This has not been processed by afbackup yet, but it was saved by daily_backup script. Now it sits in /data/daily_backup area. Go there and try to find it in the *.tar.gz files.

 
for i in *.tar.gz; do echo $i; tar -tzvf $i | grep -i bookmarks.html ; done
You may want to be more smart and search only in recent (9-days old) files:

find /data/daily_backup -name '*.tar.gz' -ctime -9 
for i in `find /data/daily_backup -name '*.tar.gz' -ctime -9`; do echo $i; tar -tzvf $i | grep -i bookmarks; done

Once you have located the file of intres extract *.tar.gz file in some temporary storage and disect it:


mkdir /tmp/hehe
cd /tmp/hehe
tar -xzvf /data/daily_backup/bellanto_2003-11-24.tar.gz

Recovering files form afbackup

This task can be done only by root. If you have not touched the file in a while, and yesterday decided to clean up your home tree and accidently killed your 3-month old report, you can get to it by using afbackup files.

First check what backups do you have


  # afverify -lav
In most cases you would like to recover the most recent version (as it was backed up). For example if the directory /home/kushnir/ckm was removed, then do the following:

  # afrestore -l /home/kushnir/ckm/ - list all files that were backed up
  # afrestore -C /tmp /home/kushnir/ckm - do restore but put files not in
                                          their real place but in /tmp directory instead.

There are tons of additional switches to recover from dozens of really weird situations. Then go and check man pages (don't do it unless you have to)


Alexander Kushnirenko
Last modified: Tue Nov 25 07:41:41 CST 2003