FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Mon Sep 23, 2019 17:52



Post new topic Reply to topic  [ 5 posts ] 
hard links and dos short names 
Author Message

Joined: Sat Sep 28, 2013 02:36
Posts: 3
Post hard links and dos short names
Hi there - I've been looking in to the whole issue with fsarchiver and the dos short name thing...

My understanding from posts here is that ntfs-3g now gives an error with "Too many links" whenever an attempt is made to read the dos short name on a file that has >1 hard links.

As a result, fsarchiver fails for any ntfs file with >1 hard links, because it always tries to fetch the dos short short name on every file, and when it gets the error it skips the file. This includes many files in a default Windows 7 / 8 installation.

Of cousre, fsarchiver could be changed to check the number of hard links before attempting to get the dos short name, but it raises the question of whether it's possible in Windows to have a dos short name set for a file with >1 hard links (i couldn't figure that out by googling...)

In another post, forum member jpa said that the bug can't be fixed, and possibly the reason was that the dos short name is stored in the parent directory, and a hard linked file can have multiple parent directories, so it's ambiguous?

So I'm wondering:

- can a >1-hard-linked file ever have a dos short name in Windows? Does it happen?
- if so, how does Windows resolve the ambiguity?
- if so, can ntfs-3g potentially or optionally be improved to resolve it the same way as Windows?

Thanks!
-c


Sat Sep 28, 2013 02:51
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: hard links and dos short names
Hi,

Quote:
Of cousre, fsarchiver could be changed to check the number of hard links before attempting to get the dos short name,..

Moreover, getting the number of hard links is not that easy. the st_link from stat(2) returns the number of names, when getting 2 you cannot determine whether it is a couple of short name and long name, or two different names, and when getting 1 you cannot determine whether there is a single name or a couple of names in the 8+3 form.
Quote:
In another post, forum member jpa said that the bug can't be fixed, and possibly the reason was that the dos short name is stored in the parent directory, and a hard linked file can have multiple parent directories, so it's ambiguous?

And knowing the parent directory of the short name would not be enough, knowing the associated long name is also needed, and there may be several names for the same file in the same directory.
Quote:
can a >1-hard-linked file ever have a dos short name in Windows? Does it happen?

Yes, and most Windows 7/8 hard linked file have a short name. Windows is restricted to a single short name per file.
Quote:
if so, how does Windows resolve the ambiguity?

Windows uses its internal APIs, which care for long and short names. Linux uses its own API with no provision for short names.
Quote:
if so, can ntfs-3g potentially or optionally be improved to resolve it the same way as Windows?

You have to understand that the Linux interface to file system is based on inode numbers, so when the file system gets a request from the kernel, it only gets the inode number of the requested file, without knowing the name or the directory which the application used to designate the file.

On Windows, an application gets the couple long name + short name by issuing a request such as FindFirstFile(), which returns both associated names (or a single name when not associated to a short name). The nearest Linux request is readdir(3), but readdir(3) has no field to return a couple of names, and short names are not returned at all in order to get a behavior similar to other file systems.

wimlib gets around the Linux interface limitations by dynamically linking to libntfs-3g without getting through the kernel and fuse, and accessing the internal variant of readdir(3) which returns long and short names and a flag associated to each name to determine which one is associated to a short name.

Regards

Jean-Pierre


Sat Sep 28, 2013 15:24
Profile

Joined: Sat Sep 28, 2013 02:36
Posts: 3
Post Re: hard links and dos short names
Thanks a lot for the response.

It seems from what you're saying that a filesystem-level backup program like fsarchiver is basically going to be impossible to get working properly on a Linux platform for a windows NTFS partition? You said that Windows uses its own internal APIs to handle all the naming issues, and I guess the implication is that it is not practical to implement a simulation of this API in Linux in order to perfectly preserve all file attributes for files on a windows NTFS filesystem. Sound right?

-c


Sun Sep 29, 2013 23:22
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: hard links and dos short names
Hi,

Quote:
It seems from what you're saying that a filesystem-level backup program like fsarchiver is basically going to be impossible to get working properly on a Linux platform for a windows NTFS partition?

I did no say that. Wimlib relies on ntfs-3g and it can save and restore all the files in an NTFS subtree with all their attributes.
Quote:
You said that Windows uses its own internal APIs to handle all the naming issues, and I guess the implication is that it is not practical to implement a simulation of this API in Linux in order to perfectly preserve all file attributes for files on a windows NTFS filesystem.

ntfs-3g implements an API which contains everything needed, as shown by wimlib. The problem here is to pass data through the Linux kernel and make NTFS appear like a traditional Linux file system.

If you are maintaining fsarchiver, I can participate in identifying a workaround for the short naming issue.

Regards

Jean-Pierre


Mon Sep 30, 2013 09:49
Profile

Joined: Sat Sep 28, 2013 02:36
Posts: 3
Post Re: hard links and dos short names
I'm not maintaining fsarchiver (and my posts probably show that that's a good thing :-) ) -- just a user trying to get to the bottom of a longstanding issue -- but I will pass your offer of assistance to the fsarchiver forums. Many thanks, -c


Tue Oct 01, 2013 00:43
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 5 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.