I’ve been tasked with migrating an aging Mac Mini’s shared storage off to a new Synology unit. A quick rsync
should take care of this, right?
After firing up rsync
and leaving it to do its thing overnight, I came in to find that I’m missing about 5TB worth of data from the original 35TB. The log file showed that it was unable to copy a number of files with extended attributes. Turns out Finder stores additional metadata such as color tags as extended attributes and this particular production needed them intact at the new location.
Extended attributes can be viewed in the Terminal using the -@
option in ls
. All of the files that failed to transfer had an unknown character within the EA that appeared as a question mark:
Others had a forward slash in the name. Below is a list of some of the affected EA names:
com.apple.metadata_kMDItemUserTags com.apple.metadatakMDItemFinderComment com.apple.metadata/_kMDItemUserTags com.apple.metadatakMDItemIsScreenCapture com.apple.metadatakMDItemScreenCaptureGlobalRect com.apple.metadatakMDItemScreenCaptureType com.apple.metadatakMDItemLastUsedDate com.apple.metadata/kMDItemLastUsedDate com.apple.metadatakMDItemWhereFroms com.apple.metadatakMDItemDownloadedDate com.apple.metadatakMDItemOriginSenderDisplayName
Viewing these through iTerm2 instead of the default Terminal app showed a different icon:
It seems rsync
just couldn’t handle these. After verifying that these files also had additional metadata items without those icons, it was clear that these were not storing any real information – they had to be removed.
Removing the affected EA’s using xattr
:
/usr/bin/xattr -dr com.apple.metadata_kMDItemUserTags /path/to/dir
The above will go through and recursively delete the named attribute from every file in the directory. rsync
was able to complete a run without errors after going through and removing those EA’s.