Snapshots for DIY raid arrays

	I've been spoiled with NetApp&tm; file system snapshots. Snapshots of
	homedirectorys is a life saver. In my role as a SysAdmin having the 
	ability to recover lost files for users from disk is so far superior
	than having to go to tape. Even more of an advantage is showing a
	user that they have a .snapshot symlink to their snapshot homedir
	so bothering me with the request is not usually necessary.

	I've been running a poor-mans snapshot system under FreeBSD for
	a good while. With the recent release of 5.x this is all no
	longer necessary. I am going to present my original system for
	historical reference.

	FreeBSD 5.x series now supports a utility known as mksnap_ffs
	which appeared somewhere in the 5.0 tree but i'm not certain
	exactly when. It is definatly in 5.1-RELEASE and 5.2-RELEASE but
	if your tree pre-dates these it might not be available. I have
	no experience using it yet so I am currently sticking with my
	tried and true system.


	On my raid array I have a quick and dirty shell script installed
	called snapshot. This script is a much hacked version of 
	Mikes Snapshot Script located on the web here. I have
	made my script available also.

	Some notes are necessary though. I use rsync instead of Mikes cp command
	for several reasons. The version of cp on freebsd does not support the
	necessary options that GNU's cp does. Rsync does. Rsync also
	allows us to, if necessary, copy across via ssh to other systems
	for additional redundancy. It is a tool that offers multiple
	solutions depending on the situation. You might find it unnecessary.

	I run the following cronjob as user root:

		55 23 * * 0 ////snapshot weekly
		57 23 * * * ////snapshot daily
		0 0,4,8,12,16,20 * * * ////snapshot hourly

	Here I run our hourly snapshot every 4 hours starting at midnight.
	My script assumes 6 snapshot intervals a day so if you perform
	more or less a day the script will need updating. 
	
	Next I run a daily snapshot just before midnight which takes the
	oldest snapshot, in theory the one performed at midnight the
	day before and moves it to daily.0. The hourly snapshot deletes
	the oldest (hourly.5) snapshot every time it runs so we need to
	grab it before hand.

	Finally we run a weekly run on Sunday just before midnight.
	It takes the old daily snapshot and stores it as a weekly
	with the date. You can do what you wish with these.
	I gather a few and burn them to cd every month or so but
	Eventually I plan on burning the weekly to a cdrw disc.

	



Copyright © 2003,2004 - Steven St.Laurent - steven@403forbidden.net