links
300 Images From 1800 Sites
Punctuated Productivity
ascii table
brainjar.com: css positioning
Catman's Reference Guide to XHTML 1.1
Catman's XHTML 1.1 Elements and Attributes Reference Guide
citeseer
Color Scheme Generator
common errors in english
cool images
Copying music between authorized computers with iTunes for Windows
css layout-o-matic
daypop
del.icio.us
elegant hack
emacs wiki
floatutorial
imho...
keystroke shortcuts for windows xp
mozilla keyboard shortcuts
NameVoyager
perldoc.com
programming language popularity
regular expression tester
selectoracle
short url services
simple urls for search engines
the unix acronym list
yahoo dictionary

permalink

got backups?

The hard drive for my web server died last week. Nothing like losing a drive to cause you to examine your backup strategy.

Backup Suggestions

Backups are a challenge. Here are a few suggestions:

  1. Pay Attention to It: I’m busy. I tend to want to click a few times and not really think about it. I suggest that it is worth your while to think about it, try it a few times, and get it right.
  2. Backup to Another Hard Drive: Yes. Forget about tapes, cd’s or dvd’s. Hard drives are relatively inexpensive and backups are much easier. I hope it goes without saying that backing up from one area to another on the same drive is not really backing up. One of the primary threats is a disk failure.
  3. Don’t ‘Backup’ Your Media Files—Sync Them: Your media files are 1) big, and 2) mostly unchanging. Instead of backing them up, sync them with rsync. I have roughly 40GB of mp3s. I now have 2 copies, one on my main drive, and another on my ‘backup’ drive. And if I can’t find it there I can always recreate the mp3 from the original CD.
  4. Automate: Your odds of success increase dramatically when you are not required to remember to do the backup. However, please head 1 first – an automated backup that is wrong will be no better than a non-automated backup that is wrong.
  5. Don’t Do Image Backups: My original goal was to be able to restore to a new disk and boot up and be exactly where I was when I did the original backup. I think this is actually difficult, and any difficulty gets in the way of doing it. Instead, think of it as spring cleaning – when your disk fails you now have an opportunity to do a new install and only restore things that you currently care about.

My Backup Process

Heeding my own advice, here is my process:

  1. I’m backing up to an external usb hard drive. I have a directory named /wd/nobackup. ‘wd’ is basically the drive and ’/wd/nobackup’ is, well, ‘don’t backup up this stuff’. What goes in ‘nobackup’? Well, your backups. In other words, your backups are copies of things and you don’t need to make copies of your copies. The tar script below excludes the ‘nobackup’ directory.
  2. The backups are done by a shell script that runs daily via cron.
  3. The backup script has 3 parts:
    • Most files get tared and gzipped. Several useless directories are excluded, as well as the directories for the MP3 files. Mysql is turned off during the backup so that we get consistent mysql databases.
    • Mysql databases are mysqldumped. This is probably overkill since the mysql databases are backed up by the previous step. However, the previous step makes a binary copy of the databases. This step produces a portable backup that could be restored on another architecture. Basically these dump files are easier to deal with.
    • MP3s are rsynced.

Here’s my script:


	

#!/bin/sh mysqladmin --password=<mysql root pw> shutdown tar –cvpzf /wd/nobackup/backups/full-backup-`date '+%Y-%B-%d'`.tar.gz \   ––directory / \   ––anchored \   ––exclude='./mnt/*' \   ––exclude='./dev/*' \   ––exclude='./proc/*' \   ––exclude='./tmp/*' \   ––exclude='./wd/nobackup/*' \   ––exclude='./home/kellyf/music/*' \   ––exclude='./home/kellyf/audio-save/*' \   . > /wd/nobackup/backups/lastfullbackup.log /etc/init.d/mysql start mysqldump ––all-databases ––password=<mysql root pw> > /wd/nobackup/backups/all-databases-`date '+%Y-%B-%d'`.sql rsync -a --delete /home/kellyf/music /wd/nobackup/ rsync -a --delete /home/kellyf/audio-save /wd/nobackup/

Share this article on post this at del.icio.us post this at Digg post this at Reddit

* * *