copyfile errors and dot files using rsync I read @SwisherSweet's question of the fastest and safest way to copy massive data from one external drive to another, along with @GrahamMiln's excellent answer.

I'm in a similar situation where I want to copy data from a Firewire 800 connected external hd to Drobo 5N, which is connected to the router that the iMac is connected to:ExternalHd — iMac — Router — Drobo5N

I executed the command (sudo rsync -vaE --progress /Volumes/SourceName /Volumes/DestinationName) and it works for some part, but on occasion I get the following error (I inserted some line breaks for better readability):

Boxx:~ Alex$ sudo rsync -vaE --progress /Volumes/ExternalHd/path/to/MyDirectory /Volumes/Drobo5N/path/to/

building file list ... 
6 files to consider

._MyDirectory
        1104 100%    0.00kB/s    0:00:00 (xfer#1, to-check=5/6)

MyDirectory/._file1.dmg
        1430 100%   34.06kB/s    0:00:00 (xfer#2, to-check=3/6)

MyDirectory/._file2.dmg
        1430 100%   27.38kB/s    0:00:00 (xfer#3, to-check=2/6)

copyfile(.._MyDirectory.drJHX3,./MyDirectory, COPYFILE_UNPACK) failed:45
copyfile(MyDirectory/.._file1.dmg.PQTcsU,MyDirectory/file1.dmg, COPYFILE_UNPACK) failed:45
rsync: rename "/Volumes/Drobo5N/path/to/MyDirectory/.._file1.dmg.PQTcsU" -&gt; "MyDirectory/._file1.dmg": No such file or directory (2)
copyfile(MyDirectory/.._file2.dmg.gx7VTP,MyDirectory/file2.dmg, COPYFILE_UNPACK) failed:45
rsync: rename "/Volumes/Drobo5N/path/to/MyDirectory/.._file2.dmg.gx7VTP" -&gt; "MyDirectory/._file2.dmg": No such file or directory (2)

sent 4369 bytes  received 86 bytes  8910.00 bytes/sec
total size is 48176733  speedup is 10814.08

rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/main.c(992) [sender=2.6.9]


Some questions:


Why do I get these copyfile(...) failed:45 errors?I found the source code for copyfile.c, but could not find out what triggers the error. In there it says about COPYFILE_UNPACK:


  COPYFILE_UNPACK is the undoing of COPYFILE_PACK, obviously.
  The goal there is to take an Apple Double file, and turn it
  into a normal file (with data fork, resource fork, modes,
  extended attributes, ACLs, etc.).


My error message says something about COPYFILE_UNPACK, but what
does it mean and how can I fix the error?
Why does the rsync command create the dot file like ._file1.dmg? When rsync completes successfully I still see the dot file in the synced destination directory (/Volumes/Drobo5N/path/to/) in addition to the actual synced file. Why is that?
Why does rsync create extensions like .drJHX3? Is that a temp name?




P.S.: Sorry if this has been asked elsewhere. I've search for this error using rsync, but couldn't surface any.
I was using the -E option to copy alias files on macOS (as without -E option alias files copy as executable files). The -E Options worked for copying the Alias files, but caused the same error as here on other files (COPYFILE_UNPACK failed:45). Therefore appears error is probably caused by using -E option in macOS.

Fortunately using Homebrew and running brew install rsync to install a more recent version of rsync fixed the problem.

Source: https://bayton.org/2018/07/how-to-update-rsync-on-mac-os-high-sierra/