
Re: rsync and ntfs-3g mapped xattr
Hi,
Quote:
My problem is that if I rsync back from ext4 to ntfs-3g (or even if the source is ntfs-3g), rsync fails to copy the user.ntfs_dos_name attribute,
*only on files* (directories are fine).
Well, I have been able to replicate the issue. You have used an extended attribute mapping of system.ntfs_dos_name to user.ntfs_dos_name on your work ntfs directory, but not on your backup ntfs directory (and obviously not on your ext4 backup directory). Your backup is probably correct both on ext4 and ntfs.
What happens is that rsync first creates a temporary file and attaches all attributes to the temporary file, then it renames the file to the expected name.
But, in ntfs-3g, renaming a file means linking the new name, and unlinking the old one, including its DOS variant. So the latter is lost in the process.
Keeping the DOS name when renaming would be difficult with the current design of ntfs-3g. It would also break the similarity of long name and DOS name which may be desirable in some situations.
Luckily rsync has an option "--inplace" to create the files without renaming :
Code:
# on source computer (10.0.0.30) :
[linux@pavilion2 doc]$ rm -f test-file
[linux@pavilion2 doc]$ touch test-file
[linux@pavilion2 doc]$ ls -l test-file
-rw-r--r-- 1 linux linux 0 Jun 29 16:27 test-file
[linux@pavilion2 doc]$ setfattr -n user.ntfs_dos_name -v DOS-NAME test-file
[linux@pavilion2 doc]$ getfattr -n user.ntfs_dos_name test-file
# file: test-file
user.ntfs_dos_name="DOS-NAME"
# on target computer :
[linux@dimension ntfs-3g]$ cat /media/tmp/.NTFS-3G/XattrMapping
system.ntfs_dos_name:user.ntfs_dos_name
[linux@dimension ntfs-3g]$ rm -f /media/tmp/testwrite/test-file
[linux@dimension ntfs-3g]$ rsync --inplace -tX 10.0.0.30:/shared/doc/test-file /media/tmp/testwrite/test-file
[linux@dimension ntfs-3g]$ getfattr -n user.ntfs_dos_name /media/tmp/testwrite/test-file
getfattr: Removing leading '/' from absolute path names
# file: media/tmp/testwrite/test-file
user.ntfs_dos_name="DOS-NAME"
[linux@dimension ntfs-3g]$ getfattr -n system.ntfs_dos_name /media/tmp/testwrite/test-file
getfattr: Removing leading '/' from absolute path names
# file: media/tmp/testwrite/test-file
system.ntfs_dos_name="DOS-NAME"
[linux@dimension ntfs-3g]$ ls -li /media/tmp/testwrite/test-file /media/tmp/testwrite/DOS-NAME
82 -rw-r--r-- 2 linux linux 0 Jun 29 16:27 /media/tmp/testwrite/DOS-NAME
82 -rw-r--r-- 2 linux linux 0 Jun 29 16:27 /media/tmp/testwrite/test-file
Quote:
Am I right to ask here or better to direct my requests to rsync support?
I hope the above solves your issue with no need to bother rsync support
Regards
Jean-Pierre