Register FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Sat May 25, 2013 10:17



Post new topic Reply to topic  [ 13 posts ] 
problem making junction points 
Author Message

Joined: Fri Feb 12, 2010 16:34
Posts: 5
Post problem making junction points
When I create NTFS junction points via ntfs-3g then remount the volume in Windows 7, windows does not recognize the junction point and shows it as a directory.

If I tickle my junction point via "fsutil hardlink list <junction>" it will tickle ntfs in such a way that it (presumably) changes something in the $MFT or $Extend\$Reparse and from that point forward the junction point is correctly shown as a junction point (provided the volume is writable, or you do not reboot). I really need the junction points to be recognized correctly immediately, without any cajoling.

My process to produce this is:
- mount a NTFS volume via ntfs-3g where win7 is installed
- create a directory say "c:\users\default\newjunction"
- copy the junction point information out of "c:\users\default\Recent"
- apply it to "newjunction"... c:\users\default\newjunction should now be a junction point connected to c:\users\default\appdata\roaming\microsoft\windows\recent
- umount, etc
- mount the volume under Win7
- open an cmd window with admin privs, navigate to c:\users\default, do a "dir" and see "newjunction" listed as a directory.
- run "fsutil hadlink list newjunction"
- do a dir and see newjunction listed as a junction point

As far as I can tell, this is not merely a cosmetic issue. My application has problems with these directories until they are "fixed." If you do a similar experiment where the ntfs volume is read-only under windows, you can "fix" the junction point in the same way, but the change does not persist through reboots.


Fri Feb 12, 2010 16:54
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,

Quote:
My process to produce this is:
- mount a NTFS volume via ntfs-3g where win7 is installed
- create a directory say "c:\users\default\newjunction"
- copy the junction point information out of "c:\users\default\Recent"
- apply it to "newjunction"... c:\users\default\newjunction should now be a junction point connected to c:\users\default\appdata\roaming\microsoft\windows\recent
- umount, etc


We cannot guarantee such a procedure to be effective, because Windows uses physical addresses which Linux cannot guess (for pluggable devices, it depends on the socket you use to plug it).

And if you cannot make the Windows fix permanent, I guess you cannot display its parameters either.... and I cannot check anything.

If you created the junction point by Windows, I could check the differences and check whether the copy can be improved... but I am not sure this is even possible.

Regards

Jean-Pierre


Sat Feb 13, 2010 12:21
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,

Quote:
As far as I can tell, this is not merely a cosmetic issue. My application has problems with these directories until they are "fixed." If you do a similar experiment where the ntfs volume is read-only under windows, you can "fix" the junction point in the same way, but the change does not persist through reboots.

Sorry, I misread this paragraph, and thought your fix was never permanent. If it is permanent over read+write mounts, it would be useful if you posted the original reparse data and the fixed one :
Code:
getfattr -h -e hex -n system.ntfs_reparse_data <junction-point>

Please also indicate whether the original junction point, the target and the copy were on a fixed disk or pluggable ones, and in the latter situation whether they are used on the same computer. Also, which ntfs-3g version you are using.

Regards

Jean-Pierre


Mon Feb 15, 2010 12:52
Profile

Joined: Fri Feb 12, 2010 16:34
Posts: 5
Post Re: problem making junction points
Yes I can make the "fix" permanent. Unfortunately, the original and "fixed" reparse points are the same.

Code:
system.ntfs_reparse_data=0x030000a0f800000000007a007c0072005c003f003f005c0043003a005c00550
073006500720073005c00440065006600610075006c0074005c0041007000700044006100740061005c0052006
f0061006d0069006e0067005c004d006900630072006f0073006f00660074005c00570069006e0064006f0077007
3005c0052006500630065006e007400000043003a005c00550073006500720073005c004400650066006100750
06c0074005c0041007000700044006100740061005c0052006f0061006d0069006e0067005c004d006900630072
006f0073006f00660074005c00570069006e0064006f00770073005c0052006500630065006e0074000000


Output from ntfsinfo for both the broken and fixed versions also looks the same.

I've verified the behavior I describe still happens with 2010.1.16AR. Everything I'm doing is on virtual machines in vmware, I believe the disks count as fixed. To produce the behavior, I'm just passing VMDKs back and forth between the linux machine with ntfs-3g and a windows machine.


Mon Feb 15, 2010 21:40
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,

[what's going on with the forum ?]

I have tried to reproduce the behavior you reported, with limited success.
I do not have Win7, I used Vista

First I cloned the reparse data of /vista/Users/Default/Recent
to a directory on another device (a USB key).

On Vista this is recognized as a junction point, but I cannot "follow the link"
(hope the French output is understandable...)

Code:
F:\linux>dir c:\Users\Default\AppData\Roaming\Microsoft\Windows\Recent\try

Répertoire de c:\Users\Default\AppData\Roaming\Microsoft\Windows\Recent

16/12/2009  12:32             9 964 try

F:\linux>dir

Répertoire de F:\linux

16/02/2010  10:46    <REP>          .
16/02/2010  10:46    <REP>          ..
16/02/2010  10:46    <JONCTION>     Recent [c:\Users\Default\AppData\Roaming\Mic
rosoft\Windows\Recent]

F:\linux>dir Recent\try

Répertoire de F:\linux\Recent

Fichier introuvable


So I created on Vista another junction point targetting the same directory :
The result is not similar, and I can "follow the link".

Code:
F:\linux>d:\packages\junction Recent.win c:\Users\Default\AppData\Roaming\Micros
oft\Windows\Recent

Junction v1.05 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2007 Mark Russinovich
Systems Internals - http://www.sysinternals.com

Created: F:\linux\Recent.win
Targetted at: c:\Users\Default\AppData\Roaming\Microsoft\Windows\Recent

F:\linux>dir

Répertoire de F:\linux

16/02/2010  11:44    <REP>          .
16/02/2010  11:44    <REP>          ..
16/02/2010  10:46    <JONCTION>     Recent [c:\Users\Default\AppData\Roaming\Mic
rosoft\Windows\Recent]
16/02/2010  11:44    <JONCTION>     Recent.win [\??\c:\Users\Default\AppData\Roa
ming\Microsoft\Windows\Recent]

F:\linux>dir Recent.win

Répertoire de F:\linux\Recent.win

16/02/2010  11:25    <REP>          .
16/02/2010  11:25    <REP>          ..
16/12/2009  12:32             9 964 try


Back on Linux, I create another directory Recent.lnx and clone the reparse point

Again on Vista I check the result.
The junction point is ok and I can follow the link.

Code:
F:\linux>dir

Répertoire de F:\linux

16/02/2010  11:57    <REP>          .
16/02/2010  11:57    <REP>          ..
16/02/2010  10:46    <JONCTION>     Recent [c:\Users\Default\AppData\Roaming\Mic
rosoft\Windows\Recent]
16/02/2010  11:57    <JONCTION>     Recent.lnx [\??\c:\Users\Default\AppData\Roa
ming\Microsoft\Windows\Recent]
16/02/2010  11:44    <JONCTION>     Recent.win [\??\c:\Users\Default\AppData\Roa
ming\Microsoft\Windows\Recent]

F:\linux>dir Recent.lnx

Répertoire de F:\linux\Recent.lnx
               
16/02/2010  11:25    <REP>          .
16/02/2010  11:25    <REP>          ..
16/12/2009  12:32             9 964 try


This shows a junction point to another volume is different from a junction
point to the same volume, and a junction point can be cloned provided
the clone remains on the same volume as the original.

Also did you really used "fsutil hardlink list <junction>" ?
this command is about hardlinks, not junctions, and on Vista the
command list is not implemented for hardlinks.
I could use "fsutil reparsepoint" which has only two options
(query and delete), and none to create a junction point.

Code:
F:\linux>fsutil reparsepoint query Recent
Valeur de la balise d'analyse : 0xa0000003
Valeur de balise : Microsoft
Valeur de balise : Substitut de nom
Valeur de la balise : Point de montage   
Décalage nom substitut : 0
Longueur nom substitut : 122
Décalage nom affiché :   124
Longueur nom affiché :   114
Nom substitut :       \??\c:\Users\Default\AppData\Roaming\Microsoft\Windows\Rec
ent
Nom affiché :            c:\Users\Default\AppData\Roaming\Microsoft\Windows\Rece
nt


Now, what is different in your situation ?

Regards

Jean-Pierre


Tue Feb 16, 2010 13:45
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi again,

I think I have understood why your procedure was successful

Quote:
- open an cmd window with admin privs, navigate to c:\users\default, do a "dir" and see "newjunction" listed as a directory.
- run "fsutil hadlink list newjunction"
- do a dir and see newjunction listed as a junction point


The "fsutil hardlink" has created "newjunction" as a *hard link* to the original junction point,
it has probably deleted the directory you had created and its cloned junction point.
This is possible because both junction points are on the same volume, but
on Linux you could not have used a plain "ln" because hard links are not
allowed on directories.

You can check this by displaying the inode numbers of original junction point
and hard link (eg by "ls -li")

Regards

Jean-Pierre


Tue Feb 16, 2010 15:35
Profile

Joined: Fri Feb 12, 2010 16:34
Posts: 5
Post Re: problem making junction points
I've gone through the process you gave and still managed to reproduce the issue. The only differences I can concieve of are Win7 vs Vista, possibly we "clone" the junction points differently. I make a directory with the name I want, then use the commands at http://www.tuxera.com/community/ntfs-3g ... ttributes/ to get and set the reparse information. My second filename also doesn't meet 8.3 standards.

Here's what I did:

I used junction to make a new junction under win7

Code:
...
02/16/2010  09:54 AM    <JUNCTION>     MJNJunct.win [\??\c:\users\default\appdat
a\roaming\microsoft\windows\recent]
...


I powered down the machine, moved the vmdk to linux, mounted it with the latest ntfs-3g and cloned the junction. (made a new directory, then set reparse attribute).

Code:
[root@localhost Default]# mkdir MJNJunction.lnx
[root@localhost Default]# REPARSE=`getfattr -h -e hex -n system.ntfs_reparse_data MJNJunct.win | grep '=' | sed -s 's/^.*=//'`
[root@localhost Default]# setfattr -h -v $REPARSE -n system.ntfs_reparse_data MJNJunction.lnx


Linux is happy with the new junction:
Code:
[root@localhost Default]# ls -il
total 1644
...
42508 lrwxrwxrwx 1 root root    142 Feb 16 10:03 MJNJunction.lnx -> /usr/local/dvprog/GoldMount//Users/Default/AppData/Roaming/Microsoft/Windows/Recent/
42878 lrwxrwxrwx 1 root root    142 Feb 16 09:54 MJNJunct.win -> /usr/local/dvprog/GoldMount//Users/Default/AppData/Roaming/Microsoft/Windows/Recent/
...


I unmount the vmdk from linux, move it back to the win7 machine, boot it up and see my same issue.
Code:
C:\Users\Default>dir
Volume in drive C is System Reserved
Volume Serial Number is DC52-4DCD

Directory of C:\Users\Default

...
02/16/2010  09:54 AM    <JUNCTION>     MJNJunct.win [\??\c:\users\default\appdat
a\roaming\microsoft\windows\recent]
02/16/2010  10:03 AM    <DIR>          MJNJunction.lnx
...


I don't think your theory about the hardlink list command is correct. According to the help output it just enumerates existing hardlinks (I would think it just parses the MFT entry for all the FILE_NAME attributes).
This is the help output for the hardlink list command. I do not think it does anything to make a hardlink.

Code:
C:\Users\Default>fsutil hardlink
---- HARDLINK Commands Supported ----

create          Create a hardlink
list            Enumerate hardlinks on a file


If I poke the junction with this command, Windows "fixes" it and is happy again.

Code:
C:\Users\Default>dir
Volume in drive C is System Reserved
Volume Serial Number is DC52-4DCD

Directory of C:\Users\Default

...
02/16/2010  09:54 AM    <JUNCTION>     MJNJunct.win [\??\c:\users\default\appdat
a\roaming\microsoft\windows\recent]
02/16/2010  10:03 AM    <JUNCTION>     MJNJunction.lnx [\??\c:\users\default\app
data\roaming\microsoft\windows\recent]
..l
               1 File(s)         95,616 bytes
              13 Dir(s)  18,364,645,376 bytes free


I think this addresses everything from your last two posts. I'm going to go back to look at the MFT between "fixed" and "unfixed" to see if I can spot a difference in the entries.


Tue Feb 16, 2010 17:26
Profile

Joined: Fri Feb 12, 2010 16:34
Posts: 5
Post Re: problem making junction points
I don't have to use the fsutil to fix the junction point, I can just navigate through it, and on the next directory listing, its fine. That fix is permanent as well.

Comparing the MFT entry for that junction point before and after windows "fixes it," every single byte is the same. That is frustrating. What I did notice though, is that because I am making the new directory in linux, then copying the reparse data into it, it ends up with the old NTFS 1.2 style STANDARD_INFORMATION attribute. Since junction points didn't exist for NTFS 1.2, I wonder if some part in win7 gets a little confused and briefly ignores the reparse information because of the small old style STANDARD_INFORMATION.

If I make a directory in windows 7, then attach the disk to linux and copy reparse data into it, I can bring the volume back to windows and now the junction point displays correctly the first time.


Tue Feb 16, 2010 20:15
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,
Quote:
What I did notice though, is that because I am making the new directory in linux, then copying the reparse data into it, it ends up with the old NTFS 1.2 style STANDARD_INFORMATION attribute.

That is because you did not enable file permissions. You might copy the ACL the way you copied the reparse data to get an ACL stored in a global file and referenced in STANDARD_INFORMATION.
Quote:
If I make a directory in windows 7, then attach the disk to linux and copy reparse data into it, I can bring the volume back to windows and now the junction point displays correctly the first time.

Interesting. So the reparse data cloning is not at stake. This also eliminates the situation in which Windows would need to have some related data in its registry.

The suspicion about name spaces (cf not 8.3 pattern) or ACL location are hardly credible as you do not find a difference in the MFT after the fix is made permanent.

I have no other idea for now.

Regards

Jean-Pierre


Tue Feb 16, 2010 23:29
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,

I have found a difference which can be significant between the original junction point and the clone : the reparse tag is present in the index entry of the parent directory of the original, and it is not in the clone.

Code:
                Allocated Size:          0 (0x0)
                Data Size:               0 (0x0)
                Filename Length:         6 (0x6)
                File attributes:         HIDDEN SYSTEM REPARSE_POINT NOT_CONTEN$
                **** Reparse point tag:       0xa0000003 ****
                Namespace:               Win32 & DOS
                Filename:                'Recent'


Can you check whether your fixing procedure adds this information to the index in the parent directory of the cloned reparse point ?

I will fix that ASAP and propose a patch.

Regards

Jean-Pierre


Wed Feb 17, 2010 11:14
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,

Can you try the attached patch ? (it can be applied to ntfs-3g-2010.1.16AR.1 or ntfs-3g-2010.2.6-RC which are the same)

The patch updates the copy of the reparse tag to the parent directories of a junction point.

After examining the results of my previous tests again, I see that Vista had silently updated the parent directories. So this should definitely be made, and I hope this was the root cause of the behavior you reported.

Regards

Jean-Pierre


Attachments:
inode.c.patch.gz [690 Bytes]
Downloaded 139 times
Wed Feb 17, 2010 15:22
Profile

Joined: Fri Feb 12, 2010 16:34
Posts: 5
Post Re: problem making junction points
Yes, my "fix" sets the Reparse Point tag in the index entry.

I applied the patch, and now when I clone reparse points they show up correctly.

Hooray! Thanks so much for the help!


Wed Feb 17, 2010 20:10
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1012
Post Re: problem making junction points
Hi,


Quote:
I applied the patch, and now when I clone reparse points they show up correctly.


Good news !

Thank you for your report and your help locating the bug and improving ntfs-3g.

Regards

Jean-Pierre


Wed Feb 17, 2010 21:56
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.