fixing user, group, and mtime with rsync?

Matt McCutchen matt at mattmccutchen.net
Tue Sep 16 17:35:40 GMT 2008


On Tue, 2008-09-16 at 10:02 +0200, Sven Hartrumpf wrote:
> Mon, 15 Sep 2008 15:21:37 -0400, matt wrote:
> 
> > On Mon, 2008-09-15 at 14:05 +0200, Sven Hartrumpf wrote:
> > > I prepared a mirror (that is intended to be updated by rsync)
> > > by doing the initial copy using cpio (for efficiency on 15 million files).
> > > Unfortunately, user, group, and mtime of some directories and files
> > > was copied incorrectly.
> > >
> > > Can I use rsync (GIT) to fix this?
> >
> > Yes, use rsync with the -a option.  Also pass --size-only to avoid
> > resending the data of regular files due to the difference in mtime.
> 
> Thanks Matt,
> that worked almost perfectly and was very quick for the 15 million files!
> The mtime of soft links was not corrected. Is this expected?

Rsync will preserve symlink mtimes using the lutimes system call if the
C library and kernel on the receiving machine both support it.  Check
that "rsync --version" shows "symtimes", not "no symtimes".  If the
kernel is Linux, it should be 2.6.22 or newer (IIRC).

Matt



More information about the rsync mailing list