 |
|
Page 1 of 1
|
[ 9 posts ] |
|
Setting file ctime on NTFS-3G drive
| Author |
Message |
|
ELBY
Joined: Mon Nov 30, 2009 21:35 Posts: 38
|
 Setting file ctime on NTFS-3G drive
The following code is from lowntfs-3g.c: Code: case FUSE_SET_ATTR_SIZE : res = ntfs_fuse_trunc(&security, ino, attr->st_size, !fi, &stbuf); break; case FUSE_SET_ATTR_ATIME + FUSE_SET_ATTR_MTIME : res = ntfs_fuse_utime(&security, ino, attr, &stbuf); break; default: ntfs_log_error("Unsupported setattr mode 0x%x\n",(int)to_set); res = -EOPNOTSUPP; break;
Here is an excerpt from the latest fuse_lowlevel.h (2.81) Code: /* 'to_set' flags in setattr */ #define FUSE_SET_ATTR_MODE (1 << 0) #define FUSE_SET_ATTR_UID (1 << 1) #define FUSE_SET_ATTR_GID (1 << 2) #define FUSE_SET_ATTR_SIZE (1 << 3) #define FUSE_SET_ATTR_ATIME (1 << 4) #define FUSE_SET_ATTR_MTIME (1 << 5) #define FUSE_SET_ATTR_ATIME_NOW (1 << 7) #define FUSE_SET_ATTR_MTIME_NOW (1 << 8)
It seems that FUSE does not support creation time at all (not birthtime, not in form of ctime - except for non-changing getstat) Which poses some problems - first for networked backup, synchronization, and sorting purposes.
|
| Mon Dec 07, 2009 22:29 |
|
 |
|
jpa
NTFS-3G Lead Developer
Joined: Tue Sep 04, 2007 17:22 Posts: 1010
|
 Re: Setting file ctime on NTFS-3G drive
Hi, Quote: It seems that FUSE does not support creation time at all This is perfectly true. The creation date is not specified by Posix, only modification time (mtime), access time (atime) and change time (ctime) are. BUT ntfs-3g supports these three times AND the creation time. The creation time is set when you create a file and is not changed afterwards (except for the system.ntfs_times extended attribute). Beware of "st_ctime" which has a different meaning in the implementation of stat() for Linux (change time) and stat() for Windows (creation time). Quote: Which poses some problems - first for networked backup, synchronization, and sorting purposes. Networked backup with Unix tools is generally based on change time, not creation time. But networked backup with Windows tools cannot be based on change time, as change time does not exist on Windows, so generally the modification time (or the archive flag) is used. Now, when you access a Linux file from a Windows client, using Samba, you cannot get the change time, because you are using a Windows tool which does not know about it, and you cannot get the creation time either, because you are supposed to access a Posix file system which does not know about the creation time. Samba may have a workaround for that. Regards Jean-Pierre
|
| Tue Dec 08, 2009 10:04 |
|
 |
|
ELBY
Joined: Mon Nov 30, 2009 21:35 Posts: 38
|
 Re: Setting file ctime on NTFS-3G drive
Dear Jean-Pierre, this is definitely a SAMBA issue. I have successfully patched a /source3/lib/time.c from 3.4.2 distributive, and now it seems to show correct dates. Allowing setting ctime however is rather tricky because of POSIX/'ustat' nature of smb'd VFS (there's no separate call for ctime, and FC12 doesn't support ctime setting at all - an exotic st_birthtime still is not shown in any of headers, and is not supported at all, in fact, by FUSE) However, ctime acts very differently if compared to NT creation time: it's changed even on rename operations, what is not good for network backup. I don't see currently any solution except for rewriting all off three  Unfortunately, i have not found yet also a separate distributive for FUSE kernel module source.
Attachments:
Samba-ctime.gif [ 24.3 KiB | Viewed 1696 times ]
|
| Thu Dec 17, 2009 18:29 |
|
 |
|
jpa
NTFS-3G Lead Developer
Joined: Tue Sep 04, 2007 17:22 Posts: 1010
|
 Re: Setting file ctime on NTFS-3G drive
Hi, Quote: However, ctime acts very differently if compared to NT creation time: it's changed even on rename operations, what is not good for network backup. I don't see currently any solution except for rewriting all off three As I already told you, ctime is a very confusing acronym which has different meanings on Linux and Windows : Quote: Now, when you access a Linux file from a Windows client, using Samba, you cannot get the change time, because you are using a Windows tool which does not know about it, and you cannot get the creation time either, because you are supposed to access a Posix file system which does not know about the creation time. You cannot get things right when confusing creation time and change time. Samba can only have workarounds. Quote: FC12 doesn't support ctime setting at all FC12, like all Posix system supports ctime with the meaning of change time. It can be queried, but not set, and there is nothing like st_birthtime in Posix systems. To make decisions for backups, use mtime. Regards Jean-Pierre
|
| Thu Dec 17, 2009 19:07 |
|
 |
|
ELBY
Joined: Mon Nov 30, 2009 21:35 Posts: 38
|
 Re: Setting file ctime on NTFS-3G drive
Yes, it's clear about ctime attribute - the most confusing part was that even a rename op is considered a "node change".
This part is completely different from NT - but NT should consider a network drive as its own. The sad part is that one cannot make decisions for OpenView and other proprietary software, for example. Still seeking for workaround
Sorry for inconvenience.
|
| Thu Dec 17, 2009 19:21 |
|
 |
|
ELBY
Joined: Mon Nov 30, 2009 21:35 Posts: 38
|
 Re: Setting file ctime on NTFS-3G drive
jpa, just notified that an Archive bit cannot be changed on ntfs-3g drive. Completely. ext3 share is ok
|
| Thu Dec 17, 2009 19:38 |
|
 |
|
jpa
NTFS-3G Lead Developer
Joined: Tue Sep 04, 2007 17:22 Posts: 1010
|
 Re: Setting file ctime on NTFS-3G drive
Hi, Quote: jpa, just notified that an Archive bit cannot be changed on ntfs-3g drive. Completely. ext3 share is ok The NTFS archive bit is set whenever you make a change. It is intended for archiving programs (they have to reset it). Do not be confused by Samba which maps its own archive bit to a permission bit (from your other post) Code: dos archive is represented in unix by the user's execute bit Be aware that Samba does not map its own archive bit to NTFS archive bit, and ntfs-3g can do nothing about it. Regards Jean-Pierre
|
| Thu Dec 17, 2009 20:36 |
|
 |
|
ELBY
Joined: Mon Nov 30, 2009 21:35 Posts: 38
|
 Re: Setting file ctime on NTFS-3G drive
Quote: Do not be confused by Samba which maps its own archive bit to a permission bit (from your other post) Code: dos archive is represented in unix by the user's execute bit Be aware that Samba does not map its own archive bit to NTFS archive bit, and ntfs-3g can do nothing about it. Why not mapping this in reverse? Or at least offering a such a option to user? Quote: Quote: jpa, just notified that an Archive bit cannot be changed on ntfs-3g drive. Completely. ext3 share is ok The NTFS archive bit is set whenever you make a change. It is intended for archiving programs (they have to reset it). But regretely i don't see how they can reset it till I cannot (via Samba, of course) It is an ACL issue, or something different? (my case is gid and uid numbers in fstab, single owner)
|
| Thu Dec 17, 2009 21:03 |
|
 |
|
jpa
NTFS-3G Lead Developer
Joined: Tue Sep 04, 2007 17:22 Posts: 1010
|
 Re: Setting file ctime on NTFS-3G drive
Hi, Quote: Why not mapping this in reverse? Or at least offering a such a option to user? This could have been a possibility, but we have opted for a compatibility with Posix and ext3, which much more users want. Moreover reversing the Samba mapping can only produce poor results (no individual ownership, protection mapped to 5 bits, etc). Quote: But regretely i don't see how they can reset it till I cannot (via Samba, of course) ntfs-3g has interfaces to deal with NTFS internal data (including archive bit and creation time), and they can be used through fuse. See http://www.tuxera.com/community/ntfs-3g ... ttributes/Samba could use them, instead of using a mapping intended for ext3, and render a full native NTFS service... If there is enough demand, somebody will surely volunteer. Regards Jean-Pierre
|
| Thu Dec 17, 2009 22:48 |
|
|
|
Page 1 of 1
|
[ 9 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 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
|
|
 |