rsync notes

Jump to: navigation, search

file permissions (metadata)

Maybe not... now I have no idea exactly how rsync works. I have experienced numerous situations where rsync appears to refuse to update metadata, but I am unable to reliably reproduce it.

Rsync does not detect changes in metadata (permissions). Rsync primarily uses the modify timestamps to detect changes in files. Changes in permissions do not affect the modify timestamp, it affects the change timestamp. This may sound confusing. Most filesystems store at least three different timestamps related to files; some store four different timestamps. See the man page on the stat command. The ls command by defaults displays the modify timestamp, which is the same as what rsync uses.

Rsync backup

I wrote a small script for managing backups with `rsync`. Click here for the full Rsync backup.

Rsync error 13 permission denied

Sometimes when using `su` to run a script that runs `rsync` you may get an error like this:

rsync: pop_dir "/home/svn" failed: Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at flist.c(1222)

In my case I was starting a script as root and the script was using `su` to change the user to "svn".

su svn -c "/home/svn/"

The fix was simply to tell `su` to use the user's environment. Note the dash after `su`:

su - svn -c "/home/svn/"