Why doesn't Explorer have an interface for creating hard links?

Raymond Chen

Nick asks why Explorer doesn’t have UI for creating hard links. Heck, while you’re at it, why not ask “Why doesn’t Explorer have a UI for hex-editing a file?” Remember, all features start out with minus 100 points. Explorer is not under any obligation to expose every last NTFS feature, and it’s certainly not going to help to expose an NTFS feature that even technical people don’t understand. Just look at all the people who ask questions like “How can I tell if a file name is a hard link instead of a normal file?” or online explanations of hard links which claim that “A hard link is only a reference to the original file, not a copy of the file. If the original file is deleted, the information will be lost.” I mean, if even a techno-geek doesn’t understand hard links, how is your average user supposed to have a chance? First, let’s see how you would explain a hard link to an end user.

When you create a hard link, you give the item an additional name. The file can be accessed by either its old name or its new name; they are equivalent. A file is not deleted until all its names are deleted. If you open a file by one name, make changes, and then save the file, the update is made to the file, and accessing the file by a second name will show the updated file, because the data for a file is separate from its name.

Actually, that paragraph above is only true if the application which saves the file does so by writing directly to the name you used when you opened the file. If the application updates the file by creating a temporary file, then renaming the original to a backup name and renaming the temporary file, then updating a file by one name will sever its connection with other names for the file. The other names will continue to refer to the unmodified file; the name you used for the update will refer to the updated file. Different applications handle this situation differently; consult your application documentation for information on how it treats hard links.

Note also that some backup programs have difficulty with hard links. Consult the documentation for your backup program for information on how it behaves when faced with hard links.

If a file has multiple names, editing the file by using different names simultaneously may result in data corruption.

If a file has multiple names, all the names must exist on the same drive.

Most users clicked Cancel at about the time you said, “When you create a hard link…” You’ll probably lose the rest of them while you are busy warning about the potential problems with hard links, and the brave few who managed to stick it out to the end will be completely confused and hit Cancel. (The ones who hit Cancel early on were the smart ones.) The problem with backup programs is particularly nasty. A backup program that is not hard-link-aware will miscalculate the necessary size of the backup volume, and when it attempts to restore the files, it will not restore the hard links.

There was a Windows XP PowerToy for creating hard links, but the backup team recommended that it not be released because so many third party backup programs exploded when they stumbled across files that had multiple names in the file system.

0 comments

Discussion is closed.

Feedback usabilla icon