Rsync, Mac OS, Debian, and Modified Times. Oh My.


2014-04-26

While writing a backup script to back up my data from Mac OS to a Raspberry Pi, I ran into an issue with relative modification times of the files being transferred: rsync thought every file on the Mac side was always more recently updated than on the Debian side.

I was using the -a flag for archive mode, which includes, along with a few other things, rsync's default behavior of comparing file size and last modification time. The two OS's weren't agreeing on the times, however, so each file was copied over every time I ran the backup command.

To avoid this, I started using the -c flag, which compares the checksum of each file on both systems. This resulted in what I wanted: if I changed only one file, then only one file was sent to the backup and it is now very fast. So if you're having this problem, use the -c flag for faster backups. Here's my rsync command and flags in case you're curious:

rsync -rc --progress --delete --exclude-from 'backup_exclude.txt' \
/home/myuser/ /media/treddell/backup_folder/