The MASM Forum

Miscellaneous => The Orphanage => Topic started by: sinsi on August 20, 2012, 09:15:37 PM

Title: NTFS junctions
Post by: sinsi on August 20, 2012, 09:15:37 PM
So my hard drive layout in the computer is
- 120GB SSD as C:
- 1TB data drive (VMs, programming, games) as E:
- 1TB drive for win8 as F: (soon to be gone Bill  :biggrin:)
- 1TB sitting there, overspill for my customer images ::)
I bought a 2TB drive and mounted it at e:\games after I moved all the games to it.
Everything has been going swimmingly for the last 12 months, now I decide to trim the 500GB of games...

Uninstall 'Age of Empires Gold' and my junction from 'Volume\blahblah' to 'e:\games' is gone. No games work.
Remade e:\games, re-mounted the drive, all is OK. Got brave, uninstalled 'NFS Most Wanted'.
Same thing happened, except this time the game wasn't deleted from the (presumably unlinked) hard drive.

I thought the whole point of junctions was that they are transparent to the user because of the low level (file system).
Anyone had any problems with junctions disappearing? I just hope the drive isn't bad.
Title: Re: NTFS junctions
Post by: dedndave on August 21, 2012, 01:35:14 AM
i don't use such things - lol
i change out drives often enough that drive letters change, then you are screwed

when you format a new drive, you can use up to 4 physical partitions
i always use all of them, making one of them a small bootable XP partition
i guess there might be some advantage in leaving one free
i think that if you create logical partitions, a free physical partition is required
Title: Re: NTFS junctions
Post by: Vortex on August 21, 2012, 03:12:52 AM
Hi sinsi,

Did you try Mark Russinovich's Junction tool?

http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
Title: Re: NTFS junctions
Post by: Gunther on August 21, 2012, 03:35:20 AM
Hi Vortex,

Quote from: Vortex on August 21, 2012, 03:12:52 AM
Hi sinsi,

Did you try Mark Russinovich's Junction tool?

http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

good hint.  :t I didn't know that tool, but it can be useful. Furthermore: version 1.06 seems to be stable.

Gunther
Title: Re: NTFS junctions
Post by: Vortex on August 21, 2012, 04:00:01 AM
The article below provides tools with source code to create NTFS junctions :

NTFS Hard Links, Directory Junctions, and Windows Shortcuts (http://www.flexhex.com/docs/articles/hard-links.phtml)
Title: Re: NTFS junctions
Post by: sinsi on August 21, 2012, 12:31:34 PM
Windows 7 comes with mklink.exe which can create junctions.
I am more concerned with an uninstall removing the link as well.
Title: Re: NTFS junctions
Post by: Bill Cravener on August 21, 2012, 08:52:08 PM
Quote from: sinsi on August 20, 2012, 09:15:37 PM
So my hard drive layout in the computer is
. . .
- 1TB drive for win8 as F: (soon to be gone Bill  :biggrin:)
. . .

You talkin' to me ? :biggrin:
Title: Re: NTFS junctions
Post by: hutch-- on August 22, 2012, 01:42:59 AM
As long as I am using XP and have Win2000 machines lurking around as backups, I make sure that any disk can be swapped from one machine to another. I originally had 2 x 1 tb and 2 x 500 gig drives on this box, later bought 2 more 1tb drives but made the mistake of using disk caddies which worked OK for a few months then damaged both of the second pair of 1 tb disks. Put the old 500 gig ones back in but recently bought 2 x 2 tb drives off eBay which I put into this box.

I use standard NTFS formatting and absolutely no trickery at all, this way I can move them, take them out if a board fails and put them into another box if I need to to get data off a disk. Long ago I learnt not to run striped disks as while the disks were generally reliable, the raid hardware/software varied from board to board and usually you could not read the disk from another board.

The other thing I always do is name the partition by its drive letter "drv_j" or similar denoting the actual disk "drv_3_k". This is a leftover from the irksome habit of Win2000 if you had to do a re-install where it always messed up the drive order and I always had to manually change all of the drive orders to get them back in the right place. Most of the Microsoft drive gimmicks locked the disks into one machine and you lost the data if the board failed.

Sad to say Win7 64 bit uses a different NTFS to Win XP / 2000 so it sits with 4 x 1 tb drives that cannot be swapped with any of the other machines.
Title: Re: NTFS junctions
Post by: dedndave on August 22, 2012, 03:13:10 AM
hopefully, you can stick an XP-formatted drive into the win7 machine
copy the stuff to it
then stick it back in the XP machine   :shock:
Title: Re: NTFS junctions
Post by: sinsi on August 23, 2012, 10:04:15 PM
>I use standard NTFS formatting and absolutely no trickery at all
A junction isn't trickery, it's a standard NTFS thing. Start an administrator command prompt, have a look at the output from "dir c:\ /l/s". Junctions are everywhere.
     Total Files Listed:
               0 File(s)              0 bytes
              63 Dir(s)  58,109,059,072 bytes free

Title: Re: NTFS junctions
Post by: Vortex on August 24, 2012, 12:53:10 AM
Vista and its predecessors are using a lot of junctions :

http://windowsconnected.com/blogs/joshs_blog/archive/2006/09/28/Windows-Vista-Junction-Points.aspx
Title: Re: NTFS junctions
Post by: sinsi on August 24, 2012, 01:09:05 AM
Because so many programs hard code paths, Microsoft thought it best to work around it.
Even Windows 7 has a junction, "documents and settings", as an alias for "users", for those brain dead XP programmers.

Opening "c:\documents and settings\sinsi\blah.txt" actually opens "c:\users\sinsi\blah.txt".
Notepad doesn't know, even Windows (user mode) doesn't know.
Part of NTFS, even Windows will obey.
Title: Re: NTFS junctions
Post by: dedndave on August 24, 2012, 01:16:38 AM
yes - but they are all on the same volume
when you go across volumes, you are just asking for headaches
Title: Re: NTFS junctions
Post by: sinsi on August 24, 2012, 01:46:43 AM
Quote from: dedndave on August 24, 2012, 01:16:38 AM
yes - but they are all on the same volume
when you go across volumes, you are just asking for headaches
The only restriction is about network drives.

To try it out I created a new user, logged on as that user to create the initial profile, then restarted.
Logged on as my usual account then moved the new user directory to f:
Made a link between c:\users\new and f:\new
Booted to new user no problems, installed stuff OK.

Not just a different volume but a different physical drive.
Title: Re: NTFS junctions
Post by: dedndave on August 24, 2012, 02:12:13 AM
that's wonderful
now start moving drives from one machine to another and see what it gets you
the situation may be better under win 7, but under XP, drive letters change and things get all messed up
Title: Re: NTFS junctions
Post by: Vortex on August 24, 2012, 02:28:55 AM
Hi Dave,

Beside the disk management console option, you can modify the registry branch below to specify drive letters :

HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices