Better get back to the topic of this post though: Hardlinks vs Softlinks. What prompted me to look more into this is a post on Command Line Kung Fu that talks about file linking. Paul started off talking about how to link files on *nix platforms, and then Ed comes back and talks about how windows doesn't have a way to do this.
This caught me way off guard. I thought "What about using fsutil to create a hardlink? For example, you could use something similar to the example below to create a hardlink to a file:
C:\>fsutil hardlink create newfile.txt oldfile.txt Hardlink created for C:\newfile.txt <<===>> C:\oldfile.txt
After re-reading the post, I noticed a special requirement at the beginning that said there should be only one original of the file(s)/directory. From what I knew about hardlinks and fsutil, new files that are hardlinks to an existing file also become "originals." This means that deleting the original file that hardlinks were made from will not make the hardlinked files useless. They each will still maintain a copy of the file contents and will still be linked to eachother.
After a little more research into the matter, I came up with several main differences between hardlinks and softlinks.
- Softlinked files create something more akin to a shortcut to a file. This maintains only one original file.
- Deleting a hardlinked file does not delete all other hardlinked files, and a file is never "fully" deleted until all hardlinks to it are deleted.
- Softlinked files are useless without the original file
- Hardlinks cannot be made to directories
- Softlinks can be made to directories
- Hardlinks must exist in the same filesystem
As it turns out, I was right in assuming that Ed knows what he is talking about :)
No comments:
Post a Comment