Using my own research: backup and recovery


In a twist of fate that I personally found less than humorous, on Tuesday I had to use an article I'd just submitted to linux journal to recover from my own stupidity.

I had just submitted an article on doing automated backups to linux Journal (due out in the March) and was in the process of discussing some minor clean up with them.  That night I started researching another topic for their entertainment issue when I accidentally issued the command:

rm -rf $HOME

It doesn't get any stupider than that when logged in as a non-root user.  I managed to stop the command quickly but not before it had done significant damage, like trash my .bashrc file and associated scripts.  Fortunately, as my article states, I had been doing backups to a remote drive for some time.  I'd never had to use them until now, however.

Reversing my rsync command used to create the backups was all that was required to restore from the backups.  And only the files that had been trashed got restored.  In the process the only files that were permanently lost were two outbound emails sent that day just before I pulled my stupid human trick.  During the restore I never had to log out and the system continued happily as if nothing had happened.

Moral:  do you backups, kiddies.  You only have to muck it up once to know it was worth it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.