Sunday, September 2, 2007

Bacula to the Rescue

It finally happened - disastrous data corruption.

My mail client of choice - Icedove (the debianized Thunderbird) - started crashing for no apparent reason. It took me a few crashes to figure out that one of my email accounts was probably corrupted somehow - Icedove would crash whenever I tried to get messages for it. It even crashed when I tried to simply select its Inbox folder (I wanted to move the messages to a different folder and then delete and recreate the account).

Find the bad account, record the path of the "Local directory" under "Server Settings"

Exit Icedove

Run bconsole - the bacula command console - in a terminal

Enter the command restore and follow instructions to select the appropriate backup job that should be restored (I picked the latest)

Eventually the command console will enter file selection mode, where you can mark files and directories to restore (hit ? and <Enter> to get a list of available commands). Select the files under the directory recorded at step 2 above.

Run the restore job. Files are restored to a restore directory, so that there's no risk of overwrite.

Replace the content of the bad mail directory with the restored files using