1

I have read lots of posts on What is the difference between soft and hard link but still am a bit vague on the difference. I wonder could somebody give just one or two example(s) of when you would want to use a Hard link instead of a soft? Just a real world example to help people understand.

The answers in the above link may be thorough, but they may be too complex they are for me to really grasp WHY I would want to use one or the other. Also, they are just a bit complex in general :P.

I think this question could help me and a lot of others understand the answers in the link above.

-1

In short: don't bother using the hard links.

Hardlink are rarely used (maybe due to legacy unix bugs, who knows), so let see the advantages of hard links, and what scenario could require that feature.

  1. less space consumption (just the inode entry): could be useful if your requirements impose usage of gazillions of links
  2. file reference counting: Within the same filesystem, you can create multiple directory structures containing hard-linked files. It enables you to:

    • have multiple thematic directory structures (Docs/House/Taxes/fx2015.pdf vs Docs/Taxes/2015/fx.pdf)
    • even create backup snapshots as seen here
    • reorganize, rename and delete your documents without naming troubles

Ohh.. you think it's nice ? perfect directory structures for me ? well no.. It will depends on the application used, but when some paranoïd application will save your files, they will do, instead of overwriting it :

  • create a new file and write to that file
  • on success : swap the new and existing file with renaming, delete the old file
  • on failure, data is left unchanged

So, your multiple file names pointing to the same data are now pointing to different data, and you simply cannot tell the difference.

  • This guy has a great reason IMO to use Hard-Links [mikerubel.org/computers/rsync_snapshots/#Incremental](Rsync Incremental Backups) – FreeSoftwareServers Aug 29 '15 at 4:36
  • @FreeSoftwareServers yeah.. it looked nice 10 years ago. Nowadays you can use ZFS or BTRFS and you have the snapshots for free. But Indeed it's a good reason. – JB. Aug 31 '15 at 8:27
  • Yea i guess, i don' mean to be harrsh but my reason for downvote was that I asked for a reason to USE them, not "in short: don't use them" – FreeSoftwareServers Sep 1 '15 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.