Register FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Wed May 22, 2013 15:08



Post new topic Reply to topic  [ 7 posts ] 
Setting the creation time on the ntfs file 
Author Message

Joined: Wed Jul 01, 2009 23:06
Posts: 4
Post Setting the creation time on the ntfs file
Hi,

I have mounted a NTFS USB using ntfs-3g on a linux system.
When copying a file from one usb to another usb I need to preserve all the timestamps of the file.
For this I need to set the creation time of the file on the target usb to be the same as that on the source.
I was looking at the libntfs-3g source code and I found that I could obtain a ntfs inode using something like this --

ntfs_volume *vol = ntfs_mount(device, MS_READONLY);
ntfs_inode *ni = (ntfs_inode *)ntfs_pathname_to_inode((ntfs_volume *)vol, (ntfs_inode *)NULL, (const char *)file);
ni->creation_time = <creation_time_I_need_to_set>
ntfs_inode_sync(ni); ---> this I thought should write out the changed inode.

The ntfs_inode_sync() does not return any error. However the creation time is still not set correctly. It takes the creation time as the current time and not the one set in the ni->creation_time.

Is there anything else I should be doing to set the creation time ?


Thu Jul 02, 2009 00:13
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1008
Post Re: Setting the creation time on the ntfs file
Hi,

Quote:
Is there anything else I should be doing to set the creation time ?

It might be useful to mount the file system as rw.

Regards

Jean-Pierre


Fri Jul 03, 2009 09:58
Profile

Joined: Wed Jul 01, 2009 23:06
Posts: 4
Post Re: Setting the creation time on the ntfs file
The usb is mounted as rw --

/dev/sda1 on /localdevices/JetFlash_Transcend_4GB_TXJEQD75 type fuseblk (rw,allow_other,blksize=4096)


Tue Jul 07, 2009 23:02
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1008
Post Re: Setting the creation time on the ntfs file
Hi,

You might try ntfs-3g-2009.4.4AC.15 from http://pagesperso-orange.fr/b.andre/adv ... g.html#new

Regards

Jean-Pierre


Sat Jul 11, 2009 10:25
Profile

Joined: Wed Jul 01, 2009 23:06
Posts: 4
Post Re: Setting the creation time on the ntfs file
Thanks Jean-Pierre. I downloaded the source for the 2009.4.4AC.15 version and installed it.
The mounting of the NTFS USB goes fine. However when I try to access the mount point it gives

bash# mount -t ntfs-3g /dev/sdd1 /mnt/
bash# ls /mnt
ls: /mnt: Input/output error


I was checking the logs and here is what I found -
Aug 3 16:29:43 l13 ntfs-3g[29842]: Version 2009.4.4AC.15 integrated FUSE 28
Aug 3 16:29:43 l13 ntfs-3g[29842]: Mounted /dev/sdd1 (Read-Write, label "Transcend", NTFS 3.1)
Aug 3 16:29:43 l13 ntfs-3g[29842]: Cmdline options: rw
Aug 3 16:29:43 l13 ntfs-3g[29842]: Mount options: rw,silent,allow_other,nonempty,relatime,fsname=/dev/sdd1,blkdev,blksize=4096
Aug 3 16:29:43 l13 ntfs-3g[29842]: Ownership and permissions disabled

Do these logs indicate that the integrated FUSE version is 2.8 ?
Because I have the fuse version 2.7.4 installed. Is that causing the conflict and so it is giving the input/output error ?

I tried with the earlier version of ntfs-3g too which is ntfs-3g-2009.4.4AR.1 and with this version the mount goes fine and I can access the mount point too.
Why does it not work with the version 2009.4.4AC.15 ?

Thanks.


Tue Aug 04, 2009 01:48
Profile

Joined: Wed Jul 01, 2009 23:06
Posts: 4
Post Re: Setting the creation time on the ntfs file
Mounted the USB with the debug option. Here is the debug information --

[mynode]$ sudo mount -t ntfs-3g -o debug /dev/sdd1 /mnt/
Version 2009.4.4AC.15 integrated FUSE 28
Mounted /dev/sdd1 (Read-Write, label "Transcend", NTFS 3.1)
Cmdline options: rw,debug
Mount options: rw,silent,allow_other,nonempty,relatime,fsname=/dev/sdd1,blkdev,blksize=4096
Ownership and permissions disabled
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.8
flags=0x00000003
max_readahead=0x00020000
INIT: 7.12
flags=0x00000041
max_readahead=0x00020000
max_write=0x00020000
unique: 1, error: 0 (Success), outsize: 40
[kazeon@l13 ~]$



[mynode]$ cd /mnt
unique: 6, opcode: GETATTR (3), nodeid: 1, insize: 40
unique: 6, error: 0 (Success), outsize: 120
fuse: writing device: Invalid argument
[kazeon@l13 mnt]$



[mynode mnt]$ ls -l .
unique: 7, opcode: GETATTR (3), nodeid: 1, insize: 40
unique: 7, error: 0 (Success), outsize: 120
fuse: writing device: Invalid argument
unique: 8, opcode: GETATTR (3), nodeid: 1, insize: 40
unique: 8, error: 0 (Success), outsize: 120
fuse: writing device: Invalid argument
ls: .: Input/output error
[mynode mnt]$


It keeps giving "fuse: writing device: Invalid argument" as the error. What could be the issue given the fact that this works fine with other versions of the ntfs-3g driver ?


Tue Aug 04, 2009 03:58
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1008
Post Re: Setting the creation time on the ntfs file
Hi,

Quote:
Do these logs indicate that the integrated FUSE version is 2.8 ?
Because I have the fuse version 2.7.4 installed. Is that causing the conflict and so it is giving the input/output error ?

Yes, this is the most likely cause. In 2009.4.4AC.15 I integrated a long awaited fuse patch for not applying the umask when there is a default ACL, and this implied an interface change.

In the recently released version 2009.4.4AR.16 I made this interface upgrade conditional, so that people not interested in Posix ACLs need not upgrade fuse. If you upgrade to ntfs-3g-2009.4.4AR.16 it should be ok. Alternatively, you may try to upgrade the fuse kernel module, the shell script for that is available in http://pagesperso-orange.fr/b.andre/fuse-module.tgz

Regards

Jean-Pierre


Tue Aug 04, 2009 08:23
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: idelsoreite and 3 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.