On Wed, Jul 23, 2008 at 05:48:10PM +0000, [EMAIL PROTECTED] wrote:
> One of the cool features it offered was a series of hourly, nightly and
> a monthly backup of files.  We kind of surmised that it was some sort of
> hard linking of the same file name in a different directory...  i.e.
> 
> ~/foo.txt
> 
> hourly.0/~/foo.txt

If it was a NA, that isn't how they do it, what they do is closer to
how LVM snapshots work (copy on write), but at a filesystem level.
That said, you can approximate the result by playing games with hard
links.  Without real copy-on-write support in the FS, you do need to
keep an entire second copy of the data on-disk, though, or some file
changes will modify your 'backups'.

I use this method for keeping daily snapshots of our mail store
around for a few weeks, to make restores easier (fscking scalix
requires a complete copy of the mail store to extract even a single
message for restore, which is nothing if not a massive PITA).  All
of my filesystems are on LVM, which makes it easier.

The basic procedure is:

  1) briefly supsend filesystem writes
  2) make an LVM snapshot of the source filesystem
  3) resume filesystem writes
  4) mount the LVM snapshot
  5) use rsync with the --link-dest option to make your new snapshot copy
  6) umount the LVM snapshot
  7) remove oldest rsync snapshot copy
  8) I forget what 8 was for

If you've never used the rsync --link-dest option, here's an example:

 Say you have two filesystems, mounted as /data and /snapshots.
 /snapshots is a bit larger than /data, to allow for storage of
 multiple snapshots.  Snapshots are taken hourly, kept for 7 days,
 stored in subdirectories of /snapshots named with a timestamp in
 YYYY-MM-DD-hh format.  Your last snapshot was taken at 1400h on
 2008-07-23, so to run the snapshot at 1500h you could use a command
 like:

  rsync -oa --stats --delete --link-dest=/snapshots/2008-07-23-14 /data/ 
/snapshots/2008-07-23-15

 This command will create the directory /snapshots/2008-07-23-15,
 and run an rsync copy from /data/ using /snapshots/2008-07-23-14
 for comparision.  Any files that are unchanged from 
 /snapshots/2008-07-23-14 will be stored in
 /snapshots/2008-07-23-15 as hard links to the copy already stored
 for /snapshots/2008-07-13-14, while new or changed files will be
 stored normally.

That should achieve most of what you're looking for, using as little
additional storage as possible.  How big to make /snapshots (best
to keep it on a separate filesystem, IME--I also like to put the
/snapshots filesystem on cheap SATA NAS (iSCSI) disk, instead of on
the fast SAN disk we use for primary storage), depends on how much
of your data changes, how often it changes, and how many snapshots
you want to keep around.  In my case for a ~1.5TB mail store with
about 50GB of changes daily, I'm comfortably storing a months worth
of snapshots on a 3.2TB filesystem.

-- 
[EMAIL PROTECTED]          OpenPGP KeyID 0x57C3430B
Holder of Past Knowledge           CS, O-
History doesn't repeat itself -- historians merely repeat each other.

_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to