-1

Seems most of the people say they use hard link is to do incremental backup 1, but as we already have more advance backup methods such as Duplicity or rdiff-backup, so can I say it is almost useless in today environment now (from the user point of view)?

1 http://www.mikerubel.org/computers/rsync_snapshots/#Incremental

voretaq7
  • 79,879
  • 17
  • 130
  • 214
Ryan
  • 5,831
  • 24
  • 72
  • 91
  • sadly especially rdiff-backup seems to be stagnant [or mature enough].. but interesting question nevertheless. – pQd Jul 05 '12 at 09:37
  • rdiff-backup is a "more advance[d] backup method"? Hahaha. – womble Jul 05 '12 at 11:13
  • @womble, yes, compare to people who are using rsync + hard link – Ryan Jul 05 '12 at 16:04
  • You would sound more convincing if it didn't take several hours to recover from a failed rdiff-backup run, and you could specify a retention policy more complicated than "the last N backups". – womble Jul 06 '12 at 05:05

2 Answers2

2

A link is a directory entry that points to blocks on disk. In other words every file on your system has at least one hard link. When you rm a file the actual system call is unlink(), it removes the directory entry. The blocks on disk haven't changed but the link is gone, thus the file is gone from the directory listing.

You personally may not ever use hard links, but they are all over your system. For example:

$ ls -li /bin | grep 53119771
53119771 -rwxr-xr-x 3 root root  26292 2010-08-18 10:15 bunzip2
53119771 -rwxr-xr-x 3 root root  26292 2010-08-18 10:15 bzcat
53119771 -rwxr-xr-x 3 root root  26292 2010-08-18 10:15 bzip2

You can see that bunzip2, bzcat and bzip all use the same inode. In essence, it is one file with three names. You could have three copies of the file, but why? It would only use up disk space unnecessarily.

bahamat
  • 6,263
  • 24
  • 28
  • Interesting. This seems to be OS-specific, I'm using Ubuntu and looking at all files in /bin and /usr/bin, the only 2 that share an inode are /usr/bin/sudo and /usr/bin/sudoedit. – ThatGraemeGuy Jul 05 '12 at 09:58
  • You can use symbolic link instead, no need to use hard link – Ryan Jul 05 '12 at 16:02
1

on some servers I use dirvish, which is a fully featured backup tool with rotating, etc. It uses hardlinks like you mentioned to create incremental backups.

The nice thing about these Backups is, that you can restore them from scratch with cp in the case of an full failure. And it is set up in minutes.

For example I use this to backup my backup server (only the system) for datacenter wide bare metal recovery

krissi
  • 3,387
  • 1
  • 19
  • 22