dslreports logo
    All Forums Hot Topics Gallery


how-to block ads

Search Topic:
share rss forum feed

Sunnyvale, CA
reply to Bill_MI

Re: Why ever use a hard link?

Hardlinks are useful whenever you want to be able to preserve many versions of a changing filesystem with minimal storage requirements.

It doesn't mean that the links have to be on the original filesystem that you are backing up, you can use the hardlinks on a remote backup filesystem (using rsync or similar programs to create and maintain the remote copy).

The advantage of creating the hardlinks in the original filesystem is instant access to prior snapshots (you don't have to restore from your backup first). However it is very important to keep in mind that this is no substitute for a proper backup! With hardlinks any damage to the current file also effects all prior snapshots (since there is only one real file with many links to it). Also the snapshots track adding/removing files correctly but not necessarily modifications to individual files. Unless you break the link and make a copy of the file first, modifying a file (depending on how that modification is made) will change the snapshot version too. Some applications (especially editors) always unlink the original and create a new, modified file and therefore those programs work well with hardlink snapshot archiving.

If you are interested in snapshots you may also want to check out a new version of links: reflinks or cowlinks. They behave like a hardlink when you first create them (must be on the same filesystem, all links refer to the same allocated blocks of data in the filesystem) but become separate files when modified. Most filesystems do not support this, but ZFS, Btrfs, Reiser4 and Ext3cow (a modified version of Ext3) do. I have been meaning to experiment with this but haven't done it yet.

Edit: cow = copy on write (the data is initially shared and copied only at the time of writing/modifying).
Got some spare cpu cycles ? Join Team Helix or Team Starfire!

Bill In Michigan
Royal Oak, MI
·WOW Internet and..

Thanks, leibold. The light came on with rsnapshot's words of "creating the illusion of multiple full snapshots". I was missing what the goal was. The use of hardlinks is now obvious.