On Sun, 23 Mar 2008 02:48:24 +0000, Andrew Gideon wrote:
> On Fri, 21 Mar 2008 16:41:59 +0000, Unruh wrote:
>
>> rsnapshot works well for this kind of backup job. It uses rsync to do
>> the backup but keeps hard linked past backups too. It is like a
>> differential backup but without the downside of having to work you way
>> through the layers.
>
> We do this with rsync using --link-dest (which was added to rsync for
> precisely this purpose, as I understand it). It's incredibly
> convenient.
>
> The only downside is that, while rsync is smart enough to move only the
> parts of a file that have changed, the file system cannot store files
> this way. It's either a single file with multiple hard links or
> multiple files. So something like a log file which gets a little
> appended each day can be wasteful of disk space.
>
> On the other hand, disk space is quite cheap nowadays.
Incredibly cheap. We're moving from tapes to disk-based storage as
quickly as we can.
Unfortunately the --link-dest option isn't available in older versions of
rsync. We still have a half dozen or so rh7.x boxes that I don't have
access to and can't upgrade. I use rsync with the daily snapshot method I
came across on http://www.mikerubel.org/computers/rsync_snapshots/
instead. It looks cumbersome but renaming directories and the cp -al are
actually pretty fast. There are a lot of ways to do this but this is a
simplified version of what I've settled on. It doesn't try to mirror
unless the remote site is up, and if the rsync bombs for whatever reason
the script restores the previous snapshot.
for site in $(ls /Backup); do
if ping -c 8 $site; then
cp -al /Backup/$site/work /Backup/$site/work.tmp
if rsync -Hae ssh --delete $site:/work /Backup/$site/work; then
if [ -d /Backup/$site/work.3 ]; then
rm /Backup/$site/work.3
fi
if [ -d /Backup/$site/work.2 ]; then
mv /Backup/$site/work.2 /Backup/$site/work.3
fi
if [ -d /Backup/$site/work.1 ]; then
mv /Backup/$site/work.1 /Backup/$site/work.2
fi
mv /Backup/$site/work.tmp /Backup/$site/work.1
else
rm -rf /Backup/$site/work
mv /Backup/$site/work.tmp /Backup/$site/work
fi
fi
done