Backup

Backups ensure that, after loss of data, said data can be recovered to either a predefined time or, in some cases, even up to the latest version of the data.

Backup and recovery go together: backups are not taken to not support a recovery, and recovery cannot be done without having a backup to recover from first. For this reason, many methods focus on the recovery side (as that is the most vital part of any backup scheme).

There are several backup methods available, ranging from bare-metal backup (and recovery) to record-based backups in a database system.

Bare metal recovery
In case of bare-metal recovery, software is used that is not installed on the operating system that is under backup/recovery. The result of a bare-metal restore is a fully bootable system again.

Most of these recovery solutions are based on partition imaging (like with CloneZilla or PartImage), although in Gentoo, stage4 snapshots can also be used as some sort of bare-metal recovery solution.

File and directory recovery
For a more selective approach, a file- and directory-based backup/recovery model is used. For such situations, on-system software is responsible for regularly taking copies (or patches/diffs) from a predefined list of files and directories. Many solutions exist, such as Bacula, but simple schemes can also be obtain by properly using rsync or just plain copies.

See also
 * A simple backup scheme using rsnapshot

Application-level backups
Some applications offer a more specific approach on backup and restores. Databases are a prime example (as their job is to guard over data) but others, like version control systems, often have specific backup/restore routines too.

When you host one or more services, it is wise to look at the backup/restore routines for your services and implement them on top of the other backup schemes.

Important principles
A few principles need to be closely guarded when implementing backups:


 * 1) always verify that your backups can be used to restore. Either restore to another location or system, or restore immediately after taking a backup. Too often users forget this and are severly disappointed when they find out that their daily backups didn't do much (wrong directory) or cannot be restored
 * 2) keep your backups on a safe location. Try to have them outside your own house (move them regularly towards your parents or kids' house, or send them over the Internet - you can use password-based encryption schemes here to protect confidentiality)
 * 3) mix backup methods. Take a full system (bare-metal) backup once in a while, with file and directory backups more regularly and application-level backups as fast as possible (since that is most likely where your customers / users will be most angry about if they lose it)
 * 4) mirroring is not having a backup. Mirroring keeps two sides in sync, whereas backups are, once taken, a snapshot of that time.