How to copy user home directories from one system to another while preserving all attributes

aclextended-attributeshigh sierramojave

I am in the process of dismantling an old macOS High Sierra Server and rebuilding it as a macOS Mojave Server.

I've exported Users and Groups from OpenDirectory on the old one and imported them in the new one.

I could move the user's home folders by shutting the old system down, mounting it in Target Disk Mode on the other and using ditto.

But suppose I do not want that and I want both to keep running (e.g. because the old one is still providing services such as mail and DNS) as the new server is still in buildup and contents on it are experimental (final copy done before going live on the new one). The best way I can come up with that preserves everything is creating a DMG on one system, use ditto there and move that to the other and then do the reverse. Both source and target file system are APFS, a DMG will be HFS+.

Is there a better option that preserves 'everything' from the directories copied? It seems to me that tar and zip don't cover everything. I'm uncertain about rsync/rsync --daemon.

Best Answer

rsync can do this. I've installed rsync 3.1.3 via MacPorts at both ends, run one end as a daemon, and used -aX as flags.