FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Mon Nov 19, 2018 18:36



Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2  Next
Get and Set DOS Name for files copied NTFS to NTFS 
Author Message

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Get and Set DOS Name for files copied NTFS to NTFS
I need to be able to preserve the DOS file name when I copy a file from one NTFS volume to another using the NTFS 3G. I'm guessing there must be a way to do this, but I have yet to figure it out.

Can anyone shed some light on how to do this.

Thanks in advance.

Chip


Thu Jun 11, 2009 04:15
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
I need to be able to preserve the DOS file name when I copy a file from one NTFS volume to another using the NTFS 3G

Even Windows cannot do that. It just creates a new DOS file name, which may be different from the original.
You can approximate setting the original DOS name on Linux by creating a hard link.

Regards

Jean-Pierre


Thu Jun 11, 2009 08:14
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Actually you can do it in windows. The information is also returned when you do a ntfsinfo. The field is simply another attribute of the NTFS file record.

The problem I have is that many Widows applications use the DOS "short" name in the registry to know how to start their application. In the case of the Microsoft applications there is always a conflict with the names so you need to make sure you associate the names correctly if you want the duplicated machine to look and feel like the original.

So what I am looking for is a way to get the same information that is returned by ntfsinfo for each file and then have a way of updating the file name attribute.


Thu Jun 11, 2009 15:25
Profile

Joined: Tue Jun 16, 2009 00:02
Posts: 2
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
I am also interested to be able to get or set the 8.3 DOS name using ntfs-3g on Windows XP partitions. In the ideal Linux world it should be possible to copy e.g. the C:\WINDOWS tree (or parts thereof) to another disk and have all file attibutes including 8.3 names intact. (might be possible with s-tar which knows how to handle ACLs and - possibly - attributes).

Reason: right now I am using ntfsclone to generate Win XP system images for a few different hardwares and they have
grown up to almost one GB (gzip -9'd) each. So I am trying to find some way to minimize the total size by having an ntfsclone image which contains the invariants and, after having restored that, adjust the destination by copying the differing files and delete those which should not be present in the destination. (in Linux one would perhaps use a final rsync pass in batch mode for this purpose)

I have already tried xdelta and xdelta3 but this gets easily confused and produces way too large deltas on ntfsclone
images.

Ideas and suggestions appreciated.

Konrad

PS: have read the "using secaudit to transfer acls" thread but if memory serves me, the issue about the 8.3 names was not covered so far.


Tue Jun 16, 2009 00:28
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
I have coded up changes that I believe enhance the ntfs-3g to return the DOS name (or short name) as an extended attribute that responds to the getfattr and setfattr calls when specifying the name system.ntfs_dos_name.

Please take a look at the attached proposed changes and let me know if they are acceptable.

Thanks

Chip


Thu Jun 18, 2009 05:43
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
I tried to update the proposed changes again. Please let me know if they are not coming through.


Thu Jun 18, 2009 05:49
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
Please let me know if they are not coming through.

Apparently not attached....
Possible reason : only a few extensions are allowed (at least .gz is allowed).

Regards

Jean-Pierre


Thu Jun 18, 2009 08:23
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
The tgz appears to be added fine. Now hopefully the submit will work and add the file.


Attachments:
File comment: Proposed changes to support system.ntfs_dos_name for get and set
ProposedChanges.tgz [2.08 KiB]
Downloaded 759 times
Thu Jun 18, 2009 15:59
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
Now hopefully the submit will work and add the file.

Quite so !

This proposal appears to be consistent with existing extended attributes mappings.

I guess people wanting short names want Windows compatibility, so the existing long names should be moved to win32 name space and be rejected if this leads to naming conflicts, but I need to look deeper into it.

Regards

Jean-Pierre


Thu Jun 18, 2009 17:17
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Quote:
I guess people wanting short names want Windows compatibility, so the existing long names should be moved to win32 name space and be rejected if this leads to naming conflicts, but I need to look deeper into it.


I actually don't think that you have to change from the POSIX name. That doesn't seem to cause any issues since the Windows doesn't mind those names at all.

I did do some more testing and found some other problems when dealing with directories with short names. So instead of doing the changes as just snippets, I created another tar file with the modules that were changed.


Attachments:
File comment: Modules with changes for the ntfs_dos_name.
ChangedModules.tgz [72.09 KiB]
Downloaded 716 times
Thu Jun 18, 2009 23:36
Profile

Joined: Tue Jun 16, 2009 00:02
Posts: 2
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi cgman,
I really appreciate your patches. will test as soon as i am back at work.

Did you already manage to get a fully working bootable XP (or Vista) system by merely copying files and adjusting acls and such using only linux?

Konrad


Fri Jun 19, 2009 00:10
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Quote:
Did you already manage to get a fully working bootable XP (or Vista) system by merely copying files and adjusting acls and such using only linux?


Yes. But that was thanks to the work done by the contributors to this project. The only issue I ever ran into was the short names were not present, so some applications had no clue where they were supposed to start.


Fri Jun 19, 2009 00:14
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Apparently, you do not index the short name into the parent directory (the directory used to set the name).
Code:
getfattr -n system.ntfs_dos_name disk/testxattr/test-file-attrib
# file: disk/testxattr/test-file-attrib
system.ntfs_dos_name
[root@dimension ntfsprof]# setfattr -n system.ntfs_dos_name -v 'ATTRIB~1' disk/testxattr/test-file-attrib
[root@dimension ntfsprof]# getfattr -n system.ntfs_dos_name disk/testxattr/test-file-attrib
# file: disk/testxattr/test-file-attrib
system.ntfs_dos_name="ATTRIB~1"
[root@dimension ntfsprof]# ls -li disk/testxattr/test-file-attrib
82 -rw-r--r-- 1 root root 0 2009-04-24 22:17 disk/testxattr/test-file-attrib
[root@dimension ntfsprof]# ls -li disk/testxattr/ATTRIB~1
ls: cannot access disk/testxattr/ATTRIB~1: No such file or directory

Or did I miss something ?
Code:
root@dimension ntfsprof]# ls -ldi "/winxp/Program Files"
14251 dr-xr-xr-x 1 root root 12288 2009-06-07 15:56 /winxp/Program Files
[root@dimension ntfsprof]# ls -ldi "/winxp/PROGRA~1"
14251 dr-xr-xr-x 1 root root 12288 2009-06-07 15:56 /winxp/PROGRA~1

I wonder how useful this can be for legacy applications if they cannot find the short name in directory searches.

Anyway, I will try to fix this. If I succeed, I will integrate this feature in the advanced ntfs-3g.

Regards

Jean-Pierre


Fri Jun 19, 2009 11:40
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Jean-Pierre,

You indeed did not miss something for I didn't even realize I had to index the name. That would explain why I can not see the short names on the Windows machine.

I was going to ask you why I don't see them in hopes that it would be something like this type of oversight.

I appreciate all the help.

Thanks

cgman.


Fri Jun 19, 2009 15:29
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
I was going to ask you why I don't see them in hopes that it would be something like this type of oversight.

There are other shortcomings.
I can fix them, if you allow me to release the fixed result as GPL (use the "pm" for any comments).

Regards

Jean-Pierre


Fri Jun 19, 2009 16:10
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

I have uploaded to http://pagesperso-orange.fr/b.andre/ntf ... 4AA.13.tgz a tarball with the DOS name get and set feature. The removal is not implemented.

This is obviously a test version, so please test.

Regards

Jean-Pierre


Mon Jun 22, 2009 09:22
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hello Jean-Pierre,

Thank you for the updates.

I have tested them out in my environment and they are excellent.

I did a quick look at the code, and I must say I am happy you made the changes, because my attempt seemed to miss quite a few of the nuances. I have one more fairly lengthy test I need to run. It should complete in about an hour or two, but I don't anticipate any issues because the basic tests I ran should have exercised the same code.

I understand that you are on holiday coming up, so I was wondering about the availability of the new version. I notice there is also new encryption handling, so I don't know if that also needs to be checked before the release.

Please let me know your release schedule so I can plan which version I need to make sure we use.

And again this is much appreciated.

Chip


Mon Jun 22, 2009 16:16
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
I understand that you are on holiday coming up, so I was wondering about the availability of the new version.

Release of a new version will depend on testing by users, problems experienced and needs for fixes. Anyway there will be no update before end of June.
Quote:
I notice there is also new encryption handling, so I don't know if that also needs to be checked before the release.

Encryption handling (or more precisely backing up and restoring encrypted files) has been released. The two features are independent.
Quote:
Please let me know your release schedule so I can plan which version I need to make sure we use.

Again this depends on problems reported. If I get no feedback, next release could be in a couple of months,... I would expect some update in July, but you will build a safer schedule by using only what is available in store.

Regards

Jean-Pierre


Mon Jun 22, 2009 16:58
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hello Jean-Pierre,

I am running into an unusual error while doing my complete testing. I get an error while copying file data from the cp command with an error code of "Operation not supported" on what I would believe to be a write command. I changed my code to skip some files, and the error came up on a different file. I have not narrowed down why I am seeing this error, but it is new to new version.

I am going to try to identify the base issue. I guess the question is does it make sense that a write command would be failed with an Operation not supported error?

Actual text of the error message:
cp: writing `/mnt/msdc1/WINDOWS/$NtUninstallKB946648$/msgsc.dll': Operation not supported

Chip


Mon Jun 22, 2009 19:19
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

Quote:
Actual text of the error message:
cp: writing `/mnt/msdc1/WINDOWS/$NtUninstallKB946648$/msgsc.dll': Operation not supported

I am going to try to identify the base issue. I guess the question is does it make sense that a write command would be failed with an Operation not supported error?

Just check the attributes of the file :

Quote:
[root@dimension fedora11]# getfattr -e hex -n system.ntfs_attrib '/winxp/WINDOWS/$NtUninstallKB946648$/msgsc.dll'
getfattr: Removing leading '/' from absolute path names
# file: winxp/WINDOWS/$NtUninstallKB946648$/msgsc.dll
system.ntfs_attrib=0x00080000

You see this is a compressed file... and there are still a few limitations on writing such files : they have to be written sequentially and they cannot be sparse.

Try copying compressed files with the sparse=never option (only for compressed files, or you could end up with huge files).

Regards

Jean-Pierre


Mon Jun 22, 2009 19:50
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Quote:
You see this is a compressed file... and there are still a few limitations on writing such files : they have to be written sequentially and they cannot be sparse.

Try copying compressed files with the sparse=never option (only for compressed files, or you could end up with huge files).


Is this a new limitation or recently exposed?

I am using the standard cp command with no options right now. That is what I was using prior to this version also. I was not seeing this error in the past.

I will investigate what I will need to do to work around the issue.

Thanks

Chip


Mon Jun 22, 2009 20:00
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi

Quote:
Is this a new limitation or recently exposed?

Yes. Previously you could not write compressed files at all.

Quote:
I am using the standard cp command with no options right now. That is what I was using prior to this version also. I was not seeing this error in the past.

You were just not compressing the files. You still can of course (by not requesting compression in the directory attributes).

Regards

Jean-Pierre


Mon Jun 22, 2009 20:11
Profile

Joined: Thu Jun 11, 2009 04:07
Posts: 12
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Jean-Pierre,

I was able to get past the compressed files with your suggestion. Thanks.

I completed my tests and all appears to be in very good working order.

I will continue to test and let you know if I find anything that is out of the ordinary.

Thanks

Chip


Tue Jun 23, 2009 15:29
Profile

Joined: Tue Jan 20, 2009 09:48
Posts: 19
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Hi,

First, thanks for providing the special xattr in the advanced release, it's very useful.

Am trying to backup an ntfs partition, I want to preserve all the attributes so am using system.ntfs_dos_name to preserve the short name. During the backup, I save the value returned when I read "system.ntfs_dos_name" and when I restore I do a setfattr with the value returned before.

The problem is that ntfs-3g often returns a dos_name which is strictly the same as the standard name. And when I try to restore, it refuses to set that name, it fails with EEXIST. So I wonder if it's the expected behavior. Maybe the getfattr on ntfs_dos_name should only return short names when they are different from the standard name. Or is it a problem in the setfattr ?

Maybe I am not using "system.ntfs_dos_name" the right way, but I just want to check that this is normal first.

Also, a getfattr on the root inode returns ".", is that normal ?

Thanks for your help.

Code:
gensys windows # getfattr -h -n system.ntfs_dos_name CONFIG.SYS
# file: CONFIG.SYS
system.ntfs_dos_name="CONFIG.SYS"

gensys windows # setfattr -h -v "CONFIG.SYS" -n system.ntfs_dos_name CONFIG.SYS
setfattr: CONFIG.SYS: File exists

gensys windows # setfattr -h -v "CONFIG.SY2" -n system.ntfs_dos_name CONFIG.SYS

gensys windows # echo $?
0

gensys windows # getfattr -h -n system.ntfs_dos_name CONFIG.SYS
# file: CONFIG.SYS
system.ntfs_dos_name="CONFIG.SY2"

gensys windows # setfattr -h -v "CONFIG.SYS" -n system.ntfs_dos_name CONFIG.SYS
setfattr: CONFIG.SYS: File exists

gensys windows # ls -l
total 65901
-rwxrwxrwx 2 root root        0 2008-08-24 07:59 AUTOEXEC.BAT
-rwxrwxrwx 1 root root      210 2008-08-24 20:36 boot.bak
-rwxrwxrwx 1 root root      210 2009-07-12 18:40 boot.ini
drwxrwxrwx 1 root root        0 2008-08-24 08:22 CanoScan
drwxrwxrwx 1 root root        0 2009-04-17 23:20 Config.Msi
-rwxrwxrwx 2 root root        0 2008-08-24 07:59 CONFIG.SYS
...
...

gensys windows # ntfs-3g --version
ntfs-3g 2009.4.4AR.16 integrated FUSE 27

gensys windows # uname -r
2.6.27.28

gensys windows # getfattr --version
getfattr 2.4.43

gensys windows # getfattr -h -n system.ntfs_dos_name /mnt/windows/
getfattr: Removing leading '/' from absolute path names
# file: mnt/windows/
system.ntfs_dos_name="."


Sat Aug 08, 2009 14:40
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Get and Set DOS Name for files copied NTFS to NTFS
Quote:
Am trying to backup an ntfs partition, I want to preserve all the attributes so am using system.ntfs_dos_name to preserve the short name.

In http://pagesperso-orange.fr/b.andre/tools.zip there is a sample program for that.

Quote:
The problem is that ntfs-3g often returns a dos_name which is strictly the same as the standard name. And when I try to restore, it refuses to set that name, it fails with EEXIST. So I wonder if it's the expected behavior.

You should expect this, because this is what is documented in the web page about it.

When this is the case, there is no point in setting a short name, because the short name is already there. If you really want a short name, a workaround is to differentiate the short name by changing some character to lower case (eg for CONFIG.SYS you set the short name as CONFIG.sys), and the result will be exactly as expected because both names will be merged into a single record with the long name.

This behaviour might be changed in the future (not straightforward).

Quote:
Also, a getfattr on the root inode returns ".", is that normal ?

Yes, "." is the name of the root inode.

Regards

Jean-Pierre


Sun Aug 09, 2009 09:14
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 10 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.