I decided to implement a rsync strategy similar to that suggested by @goldilocks https://raspberrypi.stackexchange.com/a/5492/8697

BACKGROUND I have a Pi, which is mainly used headless via ssh or VNC. I also run netatalk on the Pi so I can mount the home directory in Finder (or QuollEyeTree). I want to run the backup on my Mac.

I have a rsync-exclude.txt which contains:-


and run my rsync with the following script

# script to synchronise Pi files to backup
rsync -av --delete-during --exclude-from=bin/rsync-exclude.txt pi@MYPINAME.local:/ /Volumes/Data/PiBackup

I encountered a number of issues, which are my actual questions (if anyone can help):-

  1. @goldilocks used rsync -aEv ... I tried this and got

    rsync: on remote machine: --extended-attributes: unknown option This confused me; man rsync listed E. I know extended attributes are not often used on Linux, but OS X makes extensive use of them, and if I list files on the Pi home directory (mounted on my Mac) I can see them, and list values.

  2. Initially I used --exclude-from=~/bin/rsync-exclude.txt, but rsync could not find it. I discovered that scp assumes all paths are relative to the home directory, and apparently so does rsync; although this does not seem to be documented.

  3. The script will not delete files from the backup when deleted on the Pi.

    IO error encountered -- skipping file deletion

I assume this is related to file permissions. The backup files are all owned by my Mac user. I wonder what would happen if/when I try to restore the system files.

| improve this question | | | | |
  • 1
    Instead of deleting, consider using rdiff-backup – John La Rooy Feb 11 '14 at 10:31
  • 1
    Try with --progress save the output and search for the IO error mentioned. – GuySoft Mar 10 '14 at 11:02
  • My man rsync calls -E "preserve executability" -- I've stopped using that after someone pointed out -a includes -p, "preserve permissions" (and executability is part of permissions). Of course that's not a solution to the problem and it would be the OSX implementation of rsync that you are using (if they are different)...just read user1133275's answer and sounds like they are. – goldilocks May 14 '15 at 10:33
  • rsnapshot takes most of the horror out of the rsync command line for periodic backups. I've had it running quietly on my Raspberry Pis for years. – scruss May 14 '15 at 12:51
  1. You are using 2 different rsync --versions, the one from apple thinks you want copy extended attributes, resource forks, and the one from Debian thinks you want preserve executability. if you want the former use -X instead, and if you want the latter just don't use -E as it is redundant because it's part of -p which is part of -a so there is no need for you to use it because you are using -a. If you want a more compatable rsync you can get one from macports/homebrew/etc.

  2. Regarding "paths are relative", they are not. It's just that rsync is not expanding ~ to $HOME so you can use absolute --exclude-from=/Users/me/bin/rsync-exclude.txt, relative --exclude-from=bin/rsync-exclude.txt, or pre evaluated variables --exclude-from=$(ls -1 ~/bin/rsync-exclude.txt).

  3. To permit deleting files, run the script as root or prefixed with sudo, or without the -a (equivalent to -rlptgoD) (use -rlt instead)

| improve this answer | | | | |

I am not sure why people are suddenly answering this question more than a year after it was asked.

For the record, I decided that rsync to Mac OS X wasn't going to work (due to different rsync options, but more importantly as with different users on OS X the permissions were not retained).

I now use the procedure outlined in https://raspberrypi.stackexchange.com/a/28087/8697 - this backs up my Pi to an external HDD.

| improve this answer | | | | |

Be aware that --exclude-from=bin/rsync-exclude.txt means the path is relative to your current directory and that --exclude-from=~/bin/rsync-exclude.txt is an absolute path - always targeting the bin folder in your home directory.

So, either you have to put the file with your exclusions in a directory relative to your backup script, or, better, put it in some appropriate directory and give an absolute path.

Hope this could at least minimize some problems with the exclusions.


Just wondering why you put a *.txt file in a directory named bin ... this is somewhat confusing... at least to me.

| improve this answer | | | | |
  • If you tried that with OSX you would know rsync will not work with ~/ – user1133275 May 14 '15 at 12:40
  • Sorry, never used OS X - at least he has the chance to replace ~/ with /home/username – Matthias May 14 '15 at 12:48

Your Answer

