5

We have following setup:

  1. mountserver - debian linux
  2. fileserver1 - Windows 2008 R2 Storage server
  3. fileserver2 - Celerra NS20 exporting CIFS share
  4. workstation - windows 7 with mapped drive to share on fileserver2

What we are doing:

  • mounted share from fileserver1 on mountserver, e.g. /shared/fileserver1
  • mounted share from fileserver2 on mountserver, e.g. /shared/fileserver2
  • ran rsync on mountserver to sync data from fileserver1 to fileserver2.Used atime as parameter to sync data not older than X
  • after a while tried to delete data older that Y on /shared/fileserver2.

From what I see, linux stat command on mountserver returns following when quering file on /shared/fileserver2:

Linux file timestamp

At the same time when I open property for the same file using mapped drive connected to fileserver2,I see following for the same file:

Windows file timestamp

As you can see, Created date of 12 August shown in Windows Explorer is nowhere to be seen using stat command

Am I missing something here?

Sergei
  • 1,226
  • 16
  • 25

3 Answers3

6

Linux does not store the file creation time. So, you will not be able to view such information on a Linux machine.

Here is a link that shows the inode data structure. You can find:

time_t                       i_atime;
time_t                       i_mtime;
time_t                       i_ctime;

None of these is creation time.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • Thank you.Do you know more details or link that describes it? – Sergei Apr 24 '12 at 11:35
  • @Sergei: I don't have a reference for this now, but at least you can look at `man ls` and `man stat`. You will not find any mention for creation time, but you can find change time, last access time,etc.. – Khaled Apr 24 '12 at 11:40
  • @Sergei: I provided a link. – Khaled Apr 24 '12 at 11:49
  • I have asked because your answer is a bit vague.My understanding it is filesystem related.http://en.wikipedia.org/wiki/Ext4 for example says 'ext4 also adds support for date-created timestamps' – Sergei Apr 24 '12 at 11:52
3

FIle creation time is not stored anywhere in linux partitions so stat is only displayin following :

atime (access time)
mtime (last modification time)
ctime (last status change)
Alan
  • 403
  • 2
  • 11
3

Some newer Linux file systems are supporting information (within their inodes) about file creation time, such as JFS, ext4 or btrfs. But traditional Unix and Linux file system did not support it and so the whole tool chain is not aware of such feature yet.

So eventhough smbfs/cifs could have access to this information, there is no place yet to report this information in the stat structure:

struct stat {
  dev_t     st_dev;     /* ID of device containing file */
  ino_t     st_ino;     /* inode number */
  mode_t    st_mode;    /* protection */
  nlink_t   st_nlink;   /* number of hard links */
  uid_t     st_uid;     /* user ID of owner */
  gid_t     st_gid;     /* group ID of owner */
  dev_t     st_rdev;    /* device ID (if special file) */
  off_t     st_size;    /* total size, in bytes */
  blksize_t st_blksize; /* blocksize for file system I/O */
  blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
  time_t    st_atime;   /* time of last access */
  time_t    st_mtime;   /* time of last modification */
  time_t    st_ctime;   /* time of last status change */
};
Huygens
  • 1,708
  • 3
  • 20
  • 36