On 6/30/2014 6:28 PM, deoren wrote:
I'm still pretty new to running a mail server, but one thing I've come to appreciate over the years is a good backup strategy. Since I have always run my own servers for practice and for personal use I don't have access to Enterprise backup solutions. Because of that I usually just fall back to scripts and tarballs and offload the content on a regular basis.
LVM snapshots of the file system combined with rdiff-backup to a second server.
The main advantages over tar/rsync:
Deltas instead of entire file. Plus deltas are compressed.
It handles lots and lots of files well.
You can easily age off older deltas. Not hard to keep 26W or 52W of daily or a few-times-per-day backups.
Metadata such as file permissions / owner / group are stored in regular files in the rdiff-backup target directory, so the destination file system where you store the rdiff-backup files does not matter much.
Files are stored along with a SHA1 hash, making it possible to detect bitrot in your backups.
Downsides:
- Restoring a file more then 10 or 20 deltas old requires a lot of disk activity (putting /tmp on a SSD helps a lot)
Suggestions:
Each mailbox folder should be its own rdiff-backup target. That allows you to only backup mailbox folders which have changed in last N hours/days. It also means that if things go pear-shaped with rdiff-backup, only that one backup target is at risk.
Put /tmp on a SSD, especially if you run rdiff-backup "verify" and validate more then 1-2 revisions into the past.
Once you have your rdiff-backup directories on another server it is trivial to LVM snapshot that and then rsync to either a USB drive or offsite server (or both). The rdiff-backup directory structure is very rsync-friendly.
If you're going to do hourly backups, have (2) rdiff-backup locations. One that deals with the hourly backups and has a short retention cycle of only 3-4 weeks. Another location that deals with daily backups and has a 55W retention cycle. That way you can restore to an hour within the past 3-4 weeks, or any day within the past 55W.