mtime, atime, ctime

Matt McCutchen matt at mattmccutchen.net
Sun Aug 24 21:01:01 GMT 2008


On Sun, 2008-08-24 at 14:24 +0200, Mikel Jimenez wrote:
> I am making backup of a Plesk Debian server to /backup using Rsync.
> 
> My questioin is how can I preserve the ctime, mtime, and atime of 
> original files?

- Preserving the mtime is just rsync's --times (-t) option.

- To preserve the atime, you'll need a copy of rsync containing the
atimes patch:

http://rsync.samba.org/ftp/rsync/patches/atimes.diff

Then use the --atimes option.  Unfortunately, this patch makes no effort
to avoid hitting the atimes of the source files; you might want to
either hack do_open in syscall.c to add the O_NOATIME flag or enable the
"noatime" mount option on the source filesystem during the backup.

- Linux filesystems generally don't allow the ctime to be set to a time
other than the current one.  I suppose a process running as root could
preserve ctime by repeatedly changing the system clock, but that might
have nasty consequences elsewhere.  If you are sure you need to preserve
ctimes, I would recommend doing a block-level copy of the filesystem.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/rsync/attachments/20080824/4aabc0f4/attachment.bin


More information about the rsync mailing list