[vox-tech] Utility to image a hard drive

Bill Broadley bill at cse.ucdavis.edu
Thu Apr 9 20:08:28 PDT 2009


chris wrote:
> cp -r $1/* $2 

Careful, * can't usually match an infinite number of files.  While I'm not an
expert on which shells, operating systems, and c libraries have which limits,
it's safer to just say:
cp -r $1 $2
or:
cp -r $1/ $2

I have a directory of files I really don't want to lose, so I want to keep
them on 3 machines so I do:

for i in hosta hostb hostc; do
	echo "syncing with host $i";
		if [ ! `hostname` == $i ]; then
			echo "sending files to $i\n";
			rsync $FLAGS . $i:$DIR/;
			echo "retrieving files from $i\n";	
			rsync $FLAGS $i:$DIR/ .;
		fi
done;

That way whichever machine I sit at I can just run the sync script and get the
newest files irregardless of which of the 3 machines I edited those files on last.

But if you don't want to write your own scripts I'd check out rdiff-backup,
it's pretty slick for storing things like a snapshot of your directory daily
for the last 2 weeks, while not costing much more disk than a single copy of
your directory.


More information about the vox-tech mailing list