7

I am attempting to rsync from a network mounted volume to my Desktop. However some but not alll of the files are not copying because of an rsync error. I am using rsync 3.1.1 from Brew. I'm using this command:

rsync -aXv  /Volumes/Scotts\ Stuff/Backgrounds ~/Desktop/Temp

However, I receive this error for some of the files:

get_xattr_data: lgetxattr(""/Volumes/Scotts Stuff/Backgrounds/chalkboard-black.jpg"","com.apple.ResourceFork",88644) returned 65536

Any ideas? Some files with extended attributes copy just fine but some receive the error. If I leave off the "X" option then rsync works but of course the extended attributes are not preserved.

4
  • what else is different on those files? just the .jpg or others ?
    – Ruskes
    Commented May 2, 2015 at 2:20
  • 2
    Two suggestions. Firstly try reading the extended attributes with another command just to make sure they work okay outside rsync for example ls -al@ "/Volumes/Scotts Stuff/Backgrounds/chalkboard-black.jpg" should print out the attribute names and values for that file. Does that return the name of the attribute(s) okay? Secondly you can run rsync with multiple verbose "v" parameters to get it to give you more detail about the error so rsync -aXvvv /Volumes/Scotts\ Stuff/Backgrounds ~/Desktop/Temp. That might help you identify the source of the problem. Commented May 2, 2015 at 2:41
  • I tried the ls -al@ command it prints out the extended attributes names and sizes. Most of the extended attributes are under 300 bytes in length except for com.apple.ResourceFork which is over 87k. The files that did copy over with rsync also have com.apple.ResourceFork but they are like only 2 bytes. I don't know if the size of the resource fork is part of the issue. Commented May 3, 2015 at 15:48
  • One point I didn't originally mention is that the network volume in question is a Synology NAS volume. Don't know if being a SMB mount has anything to do with it. Commented May 3, 2015 at 15:57

1 Answer 1

5

The problem I reproduced on many versions of MacOS X (Mountain Lion, Mavericks, Yosemite, El Capitan) which are using a much too old version of rsync (2.6.9) and with more recent versions built with Macports (3.x) is solved with version 3.1.2.

Standard MacOS X rsync 2.6.9 → failure

••On_my_Mac••% /usr/bin/rsync -avE example example2
building file list ... done
._example
example/color-profile-1
example/._color-profile-1
example/index.xml.gz
example/Contents/
rsync: recv_generator: mkdir "/Users/Shared/tmp/example2/example/Contents" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
example/QuickLook/
rsync: recv_generator: mkdir "/Users/Shared/tmp/example2/example/QuickLook" failed: Permission denied (13)
*** Skipping everything below this failed directory ***
rsync: mkstemp "/Users/Shared/tmp/example2/example/.color-profile-1.zFdjjF" failed: Permission denied (13)
rsync: mkstemp "/Users/Shared/tmp/example2/example/.._color-profile-1.ySmazZ" failed: Permission denied (13)
rsync: mkstemp "/Users/Shared/tmp/example2/example/.index.xml.gz.zB0WUl" failed: Permission denied (13)
copyfile(/dev/null, example/Contents, COPYFILE_METADATA) failed:2
copyfile(/dev/null, example/QuickLook, COPYFILE_METADATA) failed:13

sent 157793 bytes  received 120 bytes  315826.00 bytes/sec
total size is 461293  speedup is 2.92
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-45/rsync/main.c(992) [sender=2.6.9]
••On_my_Mac••%

Built rsync 3.1.2 → success

••On_my_Mac••% type rsync
rsync is /opt/local/bin/rsync
••On_my_Mac••% rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags,
    HFS-compression

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
••On_my_Mac••%


••On_my_Mac••% /usr/bin/sudo rm -rf example2
••On_my_Mac••% /opt/local/bin/rsync -avAX --fake-super example example2
sending incremental file list
created directory example2
example/
example/color-profile-1
example/index.xml.gz
example/Contents/
example/Contents/PkgInfo
example/QuickLook/
example/QuickLook/Preview.pdf
example/QuickLook/Thumbnail.jpg

sent 462,152 bytes  received 167 bytes  924,638.00 bytes/sec
total size is 461,293  speedup is 1.00
••On_my_Mac••%

2 key details to note:

  • the -E option changed to -AX (ACL & extended attributes)
  • the use of --fake-super to be able to copy file inside read only directories

How to use it on different Macs

If you want to make an rsync on a remote Mac, you will have to explictly call the built rsync on the remote Mac with the --rsync-command option:

/opt/local/bin/rsync -avAX --fake-super --rsync-command=/opt/local/bin/rsync example remote_MAC:/tmp/example2 
2
  • This fails if you try to use it to copy a Time Machine backup, due to SIP. apple.stackexchange.com/questions/366577/…
    – WGroleau
    Commented Aug 13, 2019 at 3:51
  • @dan aren't you missing -M--fake-super on the last command? The man pages for rsync says: “The --fake-super option only affects the side where the option is used. To affect the remote side of a remote-shell connection, use the --remote-option (-M) option…” – I know the question is about reading the extended attribute but isn't it also required to write it on the remote end?
    – mgd
    Commented Oct 27, 2021 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .