Difference between Junction & Hardlink or Junction & Symlink?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After checking out http://blogs.msdn.com/junfeng, I found out that Vista
supported symlinks! So I was wondering how do junctions (existed since
Windows 2000) differ from soft and hardlinks?

NOTE: I know that junctions like hardlinks are limited to the same volume,
however, since they're named junctions that has to imply there is a
difference between the two.
 
Junctions are a "link to a folder". They are based on a reparse point.

Soft links are a pointer to a file, and are very similar to shell shortcuts,
except they are implemented at the filesystem level. If the file a softlink
points to is deleted, the softlink still exists, however trying to access
the softlink will result in an error.

Hard links are "another name for a file". If I create a file called "tree",
and make a hard link to that file called "bush", and then deleted "tree",
the file would still exist and be accessible from "bush". The actual file
data is not deleted until all hard links to it have been deleted.

- JB

Vista FAQ
http://www.jimmah.com/vista/
 
| Junctions are a "link to a folder". They are based on a reparse point.
|
| Soft links are a pointer to a file, and are very similar to shell
shortcuts,
| except they are implemented at the filesystem level. If the file a
softlink
| points to is deleted, the softlink still exists, however trying to access
| the softlink will result in an error.
|
| Hard links are "another name for a file". If I create a file called
"tree",
| and make a hard link to that file called "bush", and then deleted "tree",
| the file would still exist and be accessible from "bush". The actual file
| data is not deleted until all hard links to it have been deleted.
|
| - JB

Hey Jimmy...

Thanks for that. My LFWPT tried to explain that to me, but didn't do as
good of a job as you did. I appreciate it.
 
Unfortunately that didn't help much :/ I already know what hard and soft
links are. However, I still don't know what junctions are. If junctions are
simply a link to a folder, that coud mean anything from a shortcut to a
symlink. And what is a reparse point?

Thanks
 
A reparse point is a feature of ntfs that allows third party developers to
extend the functionality of the file system.

Basically, a file is created with a special attribute that marks it as a
reparse point, and contains an application-specific "tag" in it. When ntfs
reaches that entry, it sends a message to all of the plugins that process
reparse points telling them the tag data. The plugin that owns the tag will
recognize it, and then it has control from that point - it can return
whatever files/folders it wants.

Because of this behavior, the reparse point is in essense a FOLDER - because
the plugin will respond with folders and/or files.

Also, since this is all done at the filesystem level, most applications are
unaware that they are even accessing a repearse point. To an application, a
reparse point looks and acts like a normal folder.

Junctions are implemented as a reparse point. When ntfs hits a reparse point
that was stamped as a junction, the junction plugin will detect it.
Contained within the tag data for that reparse point is the target folder
that the junction is pointing to. The junction plugin will then return the
files/folders contained in the target folder.

Volume Mount points are also implemented as reparse points.

- JB

Vista FAQ
http://www.jimmah.com/vista/
 
Also, I didn't mention (but you probably picked up on anyway) is any info
after a reparse point in a path is sent to the reparse point for processing.

For example, if I browsed to c:\jimmah\test\1, and jimmah is a reparse
point, test\1 would be sent to the reparse point for processing.

- JB

Vista FAQ
http://www.jimmah.com/vista/
 
Back
Top