Recovering Mailbox Data
Prev | Appendix C. Data Recovery | Next

## Recovering Mailbox Data

Mailbox data is gathered by the Cedar Backup mbox extension. Cedar Backup will create either full or incremental backups, but both kinds of backups are treated identically when restoring.

Individual mbox files and mbox directories are treated a little differently, since individual files are just compressed, but directories are collected into a tar archive.

First, find the backup or backups you are interested in. Typically, you will need the full backup from the first day of the week and each incremental backup from the other days of the week.

The mbox extension creates files of the form `mbox-*`. Backup files for individual mbox files might have a `.gz` or `.bz2` extension depending on what kind of compression you specified in configuration. Backup files for mbox directories will have a `.tar`, `.tar.gz` or `.tar.bz2` extension, again depending on what kind of compression you specified in configuration.

There is one backup file for each configured mbox file or directory. The backup file name represents the name of the file or directory and the date it was backed up. So, the file `mbox-20060624-home-user-mail-greylist` represents the backup for `/home/user/mail/greylist` run on 24 Jun 2006. Likewise, `mbox-20060624-home-user-mail.tar` represents the backup for the `/home/user/mail` directory run on that same date.

Once you have found the files you are looking for, the restoration procedure is fairly simple. First, concatenate all of the backup files together. Then, use grepmail to eliminate duplicate messages (if any).

Here is an example for a single backed-up file:

    root:/tmp# rm restore.mbox # make sure it's not left over
    root:/tmp# cat mbox-20060624-home-user-mail-greylist >> restore.mbox
    root:/tmp# cat mbox-20060625-home-user-mail-greylist >> restore.mbox
    root:/tmp# cat mbox-20060626-home-user-mail-greylist >> restore.mbox
    root:/tmp# grepmail -a -u restore.mbox > nodups.mbox

At this point, `nodups.mbox` contains all of the backed-up messages from `/home/user/mail/greylist`.

Of course, if your backups are compressed, you'll have to use zcat or bzcat rather than just cat.

If you are backing up mbox directories rather than individual files, see the filesystem instructions for notes on now to extract the individual files from inside tar archives. Extract the files you are interested in, and then concatenate them together just like shown above for the individual case.

Prev | Up | Next
Recovering Subversion Data | Home | Recovering Data split by the Split Extension