Update Jan 2010: DreamHost has discontinued this feature.
I just discovered a cool feature at DreamHost called snapshots. This feature lets you access automatic backups of all of your files without contacting DreamHost tech support. I don't know why DreamHost doesn't advertise this feature more heavily; I bet it would cut down on tech support costs and help them attract customers.
To access the snapshots for files in any directory, type cd .snapshot in that direcory. Alternatively, you can cd .snapshot from any ancestor directory and then cd to the desired directory within the snapshot. Snapshot direcoties are hidden from ls -a, gzip, rm -rf, find, and even tab completion, so they don't get in your way when you're not using them. Inside this directory, you will find directories named hourly.0, hourly.1, daily.0, daily.1, weekly.0, and weekly.1. The hourly snapshots are taken every eight hours, the daily snapshots are taken every two days, and the weekly snapshots are taken every week. The .0 snapshots are newer than the .1 snapshots.
Some things you can do with snapshots:
- See the dates of all snapshot versions of a file
ls -lt .snapshot/*/sidebar.php
By default, ls shows the date the file was modified (before the snapshot was taken). If you add -u, you can see the date the snapshot was taken instead.
- See differences since a snapshot
diff -u .snapshot/nightly.1/sidebar.php sidebar.php | less
- Recover an entire directory, including subdirectories
cp --recursive .snapshot/hourly.0/themes themes-recovered
mv themes themes-die
mv themes-recovered themes
rm -rf themes-die
Snapshots are read-only, so you can't accidentally destroy backups. The permissions displayed when you use ls are the permissions of the original files and do not reflect your ability to modify the backups themselves.
The user interface for DreamHost's snapshots is the same as the user interface described in this paper (HTML version), but I don't know what kind of implementation DreamHost is using. In the system described by the paper, snapshots are implemented using copy-on-write at the block level, so they don't take up much server time and disk space when files change slowly.
I found out about DreamHost's .snapshot feature yesterday by following a link from http://del.icio.us/tag/dreamhost to a DreamHost knowledge base article titled "Backups". I then searched Google for "cd .snapshot" to find out how common this feature is, get ideas for how to use it, and learn how it might be implemented.
If reading about this feature makes you want to use DreamHost as your web host, see Why I love DreamHost for other information about DreamHost and a discount.