Backups

Geoff Holden

gholden@ieee.org

St. John's Linux Users Group

Why Backup?

What Should I Backup?

Types of Backups

Complete/Archival
A full backup of everything that you back up. System can be restored from this backup.
Differential Incremental (Incremental)
Backup of all files modified since the last of either a complete backup, or another incremental. System can be restored from the complete, and then each of the incrementals in order.
Cumulative Incremental (Differential)
Backup of all files modified since the last complete backup. System can be restored from the complete, and then the most recent incremental.

What Should I Store My Backups On?

Media Price Capacity Rewritable
CD-R 59¢/GB Low (700MB/ea) No
DVD-R 21¢/GB Med (4.7GB/ea) No
Tape 36¢/GB Med-High (36GB-160GB) Yes
Hard Drive(s) 80¢/GB High (200GB+) Yes

Where should I store my backups?

Separate Directory
This protects you from accidental deletion/modification, and not much else.
Separate Filesystem
Better than above, because you're protected from filesystem corruption, and you have the option of leaving the backup unmounted (or mounted read-only) most of the time.
Separate Disk
Even better again — protected against disk failure.
Separate Server
Protected against a massive failure of the production server. (Even better in a remote location)

Backup Programs

dump/restore
“anybody who depends on “dump” getting backups right is already playing Russian roulette with their backups.”
—Linus Torvalds
AMANDA
The Advanced Maryland Automatic Network Disk Archiver, a client/server backup application where a single backup server can back up many clients.
tar
Tape ARchiver, the “standard” archiver on a Linux system.

Full quote on dump/restore

Note that dump simply won't work reliably at all even in 2.4.x: the buffer cache and the page cache (where all the actual data is) are not coherent. This is only going to get even worse in 2.5.x, when the directories are moved into the page cache as well.

So anybody who depends on "dump" getting backups right is already playing Russian roulette with their backups. It's not at all guaranteed to get the right results - you may end up having stale data in the buffer cache that ends up being "backed up".

Linus Torvalds

Backup Programs

Dar & KDar
Disk ARchive, a shell command (and KDE frontend) for backing up directory trees and files.
rsync
Fast incremental file transfer program.
Partimage
Partition imager (think Norton Ghost, but free)

AMANDA

Dar & KDar

rsync

Partimage

My Rsync Backup Script

#!/bin/sh

BACKUPS=7

# Remount in R/W mode
mount /backup -o remount,rw

# Delete old backup
rm -rf /backup/backup.$(($BACKUPS-1))

# Increment backup ID
for i in $(seq $(($BACKUPS-2)) -1 0); do
    mv /backup/backup.$i /backup/backup.$(($i+1))
done

# Make next backup
rsync -a --delete --link-dest=../backup.1 /home/ /backup/backup.0/

# Remount in R/O mode
mount /backup -o remount,ro

Links/References