[H-GEN] chestnut

Bruce Campbell bc at humbug.org.au
Thu Mar 27 12:58:46 EST 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

On 27 Mar 2003, Russell Stuart wrote without attributing DavidJ:

> > You could always use rsync, it's neat for this type of operation
> > (especially locally).
> >
> > cd /var/backups/disk2/current
> > rsync -av --delete -b \
> >     --backup-dir /var/backups/disk2/old/$(date +%d-%m-%Y) \
> >     /home/imap /var/backups/disk2/current/
>
> Impressive.  I obviously have never paid enough attention to the rsync
> man page.  This would work well if the mail boxes are stored in maildir
> format, but not if mbox is used.

Sorry?  What you're doing in the above is copying files from /home/imap ,
to /var/backups/disk2/current/ .  If rsync notices that its about to
modify a file (eg, updated or deleted), it copies the previous version of
that file to /var/backups/disk2/old/date-specific-directory , and then
writes the current version to /var/backups/disk2/current/ .

So, you're getting a backup of the current state, you're getting a backup
of the state the files were last time you ran a backup, and you're getting
a nifty directory of stuff thats 'too old' and can be deleted
automatically after a period of time by another cronjob, eg:

	'rm -rf /var/backups/disk2/old/$(date +%d-%m-%Y --date "10 days ago")'

All for a few simple commands (that should really be put in a backup shell
script, rather than on one long cron command line), and, it does still
work if mbox files are used (really, it does), and (but wait, theres more)
you have the possibility of using a remote machine to store the data.
Steak knives not included.

> Since we are now thinking laterally,
> this would cover both cases:

[ snip script, although compressing the date-specific directories above
  after rsync has been run would be good ]

> Getting a file back would require you to run patch for each day you
> wanted to go back:

Painful isn't it.  Actually, speaking of running 'patch' multiple times,
I'm faintly surprised that no-one has mentioned the possibility of using
CVS or RCS to store the old version of the mail files.  Apart from needing
a rcsclean every few weeks to free up disk space, it gives you somewhat
more than the solutions thus proposed, such as being able to capture the
state every 5 minutes.

--==--
Bruce.



--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list