automatic hard linking
VirginSnow at vfemail.net
VirginSnow at vfemail.net
Wed Jul 23 15:05:07 EDT 2008
> From: t.littlefield at comcast.net
> Date: Wed, 23 Jul 2008 17:48:10 +0000
> A co-worker and I were talking about various ways to do 'backups' to try and
> prevent data loss. The topic came around to a file system we had used
> at a previous job. I can't remember the specifics, but we believe it was
> a Network Appliance system.
>
> 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.
>
A hard link "backup" like this will protect you from accidentally
loosing inodes - that is, accidentally removing files you didn't
intend to "rm". It *won't* however protect files from being
overwritten, corrupted, or edited to the point of uselessness (which I
see happen to source code on occasion). That's because a hard link is
just another pointer to the same inode in the fs. Example:
$ echo really important data > /home/me/important.txt
$ ln /home/me/important.txt /backups/home/me/important.txt
$ vi /home/me/important.txt
(type 1GcGmistaken edit^@ZZ to overwrite the file, save, and exit)
$ cat /backups/home/me/important.txt
mistaken edit
This because the primary directory entry and the "backup" entry both
point to the same file. So when you trash one, you also trash all
your "backup"s of it too. :)
One nifty way of "snapshotting" a filesystem like this is with a
feature called, sensibly enough, "snapshotting". If you have an LVM
logical volume, for example, you can take a snapshot of the volume.
If a user tries to edit/modify a snapshotted file, LVM does a
copy-on-write to a new part of the LV. So, with real fs snapshots,
the old "backed-up" files remain intact even if someone trashes the
current version.
Of course, even snapshotting falls far short of being a real "backup"
system because the data is left on the same physical medium. If the
hardware holding the fs dies, so does the snapshot.
More information about the gnhlug-discuss
mailing list