Hardlinks, symbolic links and junctions

Any other tech-related topics
Message
Author
spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Hardlinks, symbolic links and junctions

#1 Post by spicydog »

Can anybody please suggest me how to make hardlinks and/or symbolic links and/or junctions on XP Pro SP3 32-bit local NTFS disk?

Important: I need to do that for a file (not for a folder) and that the link and the file have to be on the same disk but on different partitions.

Thanks :mrgreen:

User avatar
dany
Posts: 70
Joined: Fri Jun 17, 2011 10:26 pm
Location: netherlands

Re: Hardlinks, symbolic links and junctions

#2 Post by dany »

Code: Select all

fsutil hardlink create c:\foo.txt c:\bar.txt
Where foo.txt is the hardlink and bar.txt the file to be linked to. Try it, I'm not sure if it will work across different partitions though.
Junctions only work with directories and afaik symlinks are only available from Vista and up.
Alternately, maybe NTFS Link could be what you're looking for.

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#3 Post by spicydog »

Thanks for your reply, dany :)

I like fsutil.exe a lot, but the unfortunate limitation of that powerful tool is that the new link and the existing file must be on the same volume :(

linkd.exe (part of Windows Resource Kit Tools) is another interesting tool (that permits to create/manipulate NTFS junction points across partitions) but it handles only folders.

So I thought to combine fsutil.exe and linkd.exe (I suppose that you can imagine how)... Unfortunately it did not work as I expected... But I did not give up yet :mrgreen:

I have also tried NTFS Link v.2.1 (dank je wel voor de tip) but -besides having experienced a nasty crash- it does not appear to handle files but only folders.

BTW, the reason why I mentioned them all (hardlinks, symlinks and junctions) is that -generally speaking- there is plenty of overlapping in the terminology and I thought to purposely gather an unrestricted feedback in this thread.

In elk geval bedankt voor de moeite :mrgreen:

lautrepay
Posts: 715
Joined: Sat Mar 26, 2011 2:31 am

Re: Hardlinks, symbolic links and junctions

#4 Post by lautrepay »

SD, if you have .net 3.5 installed, there's a little and effective tool to create symbolic links, hard links and junctions: Symlinker.
A portable version is available.
Note that hard links can only be created in the same partition and when you delete the link you delete the original file or folder.

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#5 Post by spicydog »

Thanks lautrepay :)

Since I do have .net 3.5 installed and I liked the idea of a simple tool (only 86 KB) able to quickly create files and folders symlinks I have already tried Symlink Creator v.1.1.1.3 despite what I read on the page of Alejandro Mora Díaz:

"This application needs .Net Framework 3.5 to run (SP1 recommended) and as of 7/26/2010 this software will only work under Windows Vista or 7, Windows XP doesn't have the mklink command inside the cmd.exe app. I'll look for a workaround for this, but it isn't promising that I will find it..."

I guess that I was really hoping the latest version would include support for XP... Strange enough the entire procedure can be followed and after clicking the "Creale Link" button the "Link successfully created" screen even pops up... But in the reality no link is created :(

I also tried HardLinkShellExt v.3.6.5.1, which handles nicely both files and folders (directly from the Explorer context menu) but sadly only on the same volume :(

Thanks anyway for your suggestion and have a nice weekend.

PS: And you, often complaining about your Vista... For once I should complain about my XP :mrgreen:

lautrepay
Posts: 715
Joined: Sat Mar 26, 2011 2:31 am

Re: Hardlinks, symbolic links and junctions

#6 Post by lautrepay »

spicydog wrote:Thanks lautrepay :)

Since I do have .net 3.5 installed and I liked the idea of a simple tool (only 86 KB) able to quickly create files and folders symlinks I have already tried Symlink Creator v.1.1.1.3 despite what I read on the page of Alejandro Mora Díaz:

"This application needs .Net Framework 3.5 to run (SP1 recommended) and as of 7/26/2010 this software will only work under Windows Vista or 7, Windows XP doesn't have the mklink command inside the cmd.exe app. I'll look for a workaround for this, but it isn't promising that I will find it..."
Ooops... :oops:
Sorry, SD. I didn't noticed this limitation of XP.
It seems that XP only supports junctions points, which are similar to hard links, but they only can be created in the same volume, so I don't think you can create a junction point across partitions. And you have to be careful when deleting them.
There's a Systenals Suite tool for that purpose: Junction
lautrepay wrote:Thanks anyway for your suggestion and have a nice weekend.

PS: And you, often complaining about your Vista... For once I should complain about my XP :mrgreen:
For you too, thanks. :wink:

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#7 Post by spicydog »

Thanks again lautrepay :)

Yes, I know Junction (very nice tool) but unfortunately it only handles folders and not files :(

BTW, does anybody know what Junction (147 KB) does more than linkd.exe* (11 KB)? My first impression is that they seem to cover the exact same area.

*(part of Windows Resource Kit Tools)

As I mentioned in my previous post I also tried HardLinkShellExt, which works fine for both files and folders but only on the same volume... So it would appear that XP does indeed support hard links but (until now) I did not find any tool to create them on different partitions... I seriously hope that this is not a dead end :(

Please keep the suggestions coming :mrgreen:

PS: lautrepay THANKS again for the tip you gave me about bundle.exe... I used it a few times and with its 304 KB it seems to do quite a nice job!

User avatar
SYSTEM
Posts: 2041
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Hardlinks, symbolic links and junctions

#8 Post by SYSTEM »

spicydog wrote:Can anybody please suggest me how to make hardlinks and/or symbolic links and/or junctions on XP Pro SP3 32-bit local NTFS disk?

Important: I need to do that for a file (not for a folder) and that the link and the file have to be on the same disk but on different partitions.

Thanks :mrgreen:
Sorry, it is impossible. :(

Hard links don't work across different partitions.

Junction points can only point to directories.

Finally, symbolic links were introduced with NTFS 6.0 and Windows Vista. Windows XP can't even read them, let alone creating.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#9 Post by spicydog »

Hey SYSTEM, nice of you to join the thread :mrgreen:

What if I use fsutil to make a link of the specific file on the same volume (say in the "My_File" folder) and then I use linkd to make a junction across partitions of the "My_File" folder?

Do you think that this (sort of file bouncing via link/junction) could work?

Thanks

User avatar
SYSTEM
Posts: 2041
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Hardlinks, symbolic links and junctions

#10 Post by SYSTEM »

spicydog wrote:Hey SYSTEM, nice of you to join the thread :mrgreen:

What if I use fsutil to make a link of the specific file on the same volume (say in the "My_File" folder) and then I use linkd to make a junction across partitions of the "My_File" folder?

Do you think that this (sort of file bouncing via link/junction) could work?

Thanks
Depends on the definition of "work".

If I understand your idea correctly, there is a file (say, "F:\something\myfile.txt"), and you create a hard link to that file (say, "F:\My_File\myfile2.txt"). Finally, you create a junction point in a different partition (say, "G:\My_Folder") that points to the directory where the hard link resides.

The result of the above example is that the content of "F:\something\myfile.txt" will show up in "G:\My_Folder\myfile2.txt". If that is enough for you, then yes, it will work.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#11 Post by spicydog »

When you (SYSTEM) wrote: "...If that is enough for you, then yes, it will work." I was really hoping that you would have been right... (please read further)...

OK, this is what I did:

1) I created 3 folders:

- C:\SOURCE <<-- (this contains the "Test.txt" file)
- C:\TARGET ON THE SAME VOLUME <<-- (this contains nothing)
- E:\TARGET ON ANOTHER VOLUME <<-- (this contains nothing)

2) Then I (successfully) created the hardlink with fsutil in this way:

fsutil hardlink create "C:\TARGET ON THE SAME VOLUME\Test.txt" "C:\SOURCE\Test.txt"

3) When I attempted to create the junction (with either linkd.exe or junction.exe) in this way:

Linkd "C:\TARGET ON THE SAME VOLUME" "E:\TARGET ON ANOTHER VOLUME"

OR

junction "C:\TARGET ON THE SAME VOLUME" "E:\TARGET ON ANOTHER VOLUME"

The error "Cannot create a file when that file already exists" popped up. This would suggest that the junction point source (the "TARGET ON THE SAME VOLUME" folder) should not exist... In fact I noticed that it gets created by the console.

I have tried the other way around (creating first the junction point and then the hardlink) but fsutil returns the infamous error "The new link and the existing file must be on the same volume." :(

Am I doing something wrong? Am I missing something?

User avatar
SYSTEM
Posts: 2041
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Hardlinks, symbolic links and junctions

#12 Post by SYSTEM »

spicydog wrote: Am I doing something wrong?
Yes, you are. :wink:
spicydog wrote: 3) When I attempted to create the junction (with either linkd.exe or junction.exe) in this way:

Linkd "C:\TARGET ON THE SAME VOLUME" "E:\TARGET ON ANOTHER VOLUME"

OR

junction "C:\TARGET ON THE SAME VOLUME" "E:\TARGET ON ANOTHER VOLUME"
The parameters are in a wrong order. The command should be the following (with Junction, I haven't used linkd):

Code: Select all

junction "E:\TARGET ON ANOTHER VOLUME" "C:\TARGET ON THE SAME VOLUME"
I know that the order isn't logical. I often mess the parameters up as well. :mrgreen:
My YouTube channel | Release date of my 13th playlist: August 24, 2020

spicydog
Posts: 262
Joined: Mon Mar 16, 2009 11:56 am

Re: Hardlinks, symbolic links and junctions

#13 Post by spicydog »

Kiitoksia kauhean paljon :D

Illogical indeed, I totally agree with you but... NOW IT WORKS!!! :mrgreen: :mrgreen: :mrgreen:

Thanks for pointing me in the right direction, SYSTEM!

Hopefully this thread will be useful for somebody else who also needs to create the hardlink of a file on a different partition in XP... In fact by combining two tools (fsutil.exe and either linkd.exe or junction.exe) this is indeed possible.

Case solved... Thanks to all participants to the thread ;)

PS: SYSTEM, you might want to reconsider editing your previous post :mrgreen: :mrgreen: :mrgreen: (just kidding)... Actually all the 3 concepts you pointed out are perfectly correct, but the combination of two tools made the difference :wink:
SYSTEM wrote:Sorry, it is impossible. :(

Hard links don't work across different partitions.

Junction points can only point to directories.

Finally, symbolic links were introduced with NTFS 6.0 and Windows Vista. Windows XP can't even read them, let alone creating.

freakazoid
Posts: 1212
Joined: Wed Jul 18, 2007 5:45 pm

Re: Hardlinks, symbolic links and junctions

#14 Post by freakazoid »

Needed to use symbolic links and found a private app in TPFC:

Junction Link Magic - http://www.portablefreeware.com/?id=272

Also I found this Superuser answer useful:
http://superuser.com/questions/260740/a ... 855_260753

That user recommends mklink (the command line version) and Winbolic second.
is it stealth? ;)

User avatar
I am Baas
Posts: 4150
Joined: Thu Aug 07, 2008 4:51 am

Re: Hardlinks, symbolic links and junctions

#15 Post by I am Baas »

freakazoid wrote:Needed to use symbolic links and found a private app in TPFC:

Junction Link Magic - http://www.portablefreeware.com/?id=272
Junction Link Magic 2 requires admin rights + .net framework to run and is not portable;

user.config in AppData\Local\Rekenwonder_Software\

The older version crashed on my win 7.64 machine but also wrote to HKEY_CURRENT_USER\Software\Rekenwonder Software\Junction Link Magic

Post Reply