3 ms·
Reverse question: why use symlinks when you can get away with hard links?
by vundercind 3y ago
Reverse question: why use symlinks when you can get away with hard links?
- AtlasBarfed 3y agoMain thing I've seen with hard links is that deletions delete the source file which about 90% of the time isn't what an end user wants
- whartung 3y agoOnly if its the last hard link. If nothing else, its a wee bit of insurance from deletion since no single link removal should remove the file. Anecdote, eons ago, we had a problem where the vendor needed to log in to the machine with the intent that they were going to upload some utilities, fix a problem, and then delete them. Before I let them in, I set up a script that constantly scanned the directory tree they were in, and hard linked everything so I could look at what they were using later.
- cpach 3y agoClever solution!
- rcxdude 3y agothat isn't generally how hardlinks work: you need to delete all instances of it to delete the file, as opposed to having one 'real' file like with symlinks.
- wizzwizz4 3y agoThat's a problem with directory hardlinks: a recursive deletion will wipe the directory (in the same way that truncate will destroy a file regardless of how many hardlinks it has). But we don't usually allow directory hardlinks these days.
- wakawaka28 3y agoIt's more of a problem that changes to one linked file change the only copy. But this depends on your filesystem. Not all work this way.
- jesse9766 3y agoHard links only work in the same filesystem. If your system only has one volume with one filesystem (e.g. a PC) that's fine, but not a very portable option for servers.
- hn92726819 3y agoEvery one of those files is in /sbin though