Wednesday, January 03, 2007

 

ZFS stores file creation time

I've probably run across this at some point and forgotten it, but I happened to notice it while looking at something else. ZFS stores the file creation time (crtime) in addition to the traditional atime, mtime, and ctime:
juser@server> sudo zdb -dddd trashme
[ ... ]
    Object  lvl   iblk   dblk  lsize  asize  type
        14    2    16K   128K  3.75M  3.75M  ZFS plain file
                                 264  bonus  ZFS znode
        path    /foo
        atime   Wed Jan  3 16:20:42 2007
        mtime   Wed Jan  3 16:20:42 2007
        ctime   Wed Jan  3 16:20:42 2007
        crtime  Wed Jan  3 15:26:53 2007
[ ... ]

And, of course, this can be seen in the source code:
     87 /*
     88  * This is the persistent portion of the znode.  It is stored
     89  * in the "bonus buffer" of the file.  Short symbolic links
     90  * are also stored in the bonus buffer.
     91  */
     92 typedef struct znode_phys {
     93  uint64_t zp_atime[2];  /*  0 - last file access time */
     94  uint64_t zp_mtime[2];  /* 16 - last file modification time */
     95  uint64_t zp_ctime[2];  /* 32 - last file change time */
     96  uint64_t zp_crtime[2];  /* 48 - creation time */


Comments:
Good observation. Do you know how to import a file system (say a USB drive) into zfs in such a way as to preserve the creation times? When I try rsync from a remote host the creation times end up being the time of transfer.
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?