3

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.

4
  • 1
    Any reason that Migration Assistant doesn't do exactly this?
    – benwiggy
    Commented Aug 24, 2019 at 9:27
  • Why use a DMG? Just enable sharing and use ditto.
    – nohillside
    Commented Aug 24, 2019 at 11:48
  • Actually, I'm having serious problems with sharing between both. Dropped connections, unable to connect, etc.
    – gctwnl
    Commented Aug 24, 2019 at 12:19
  • Migration Assistant works in target disk mode, direct connect ethernet / thunderbolt networking, etc... if your network isn't reliable enough for this.
    – bmike
    Commented Aug 25, 2019 at 16:07

3 Answers 3

5

There is just ONE way for doing that, and it is via Finder.

No command line can do it. Some command line tools preserve almost all attributes, but loose APFS extended attributes. Check all attributes after copying via terminal by using ls -leah@O

This is correctly done via Finder using Copy/Paste.

  1. Copy the folder or files you want using Finder

  2. Then go to the destination directory, select Edit menu, hold SHIFT+Option+Command, and select "Paste Item Exactly"

Image below:

enter image description here

This fully preserve All extended attributes, file owner, file access flags, users permissions, ACLs... everything.

To move to another system, I suggest copying it to any external USB disk formatted with APFS. Paste the files on the external disk, then to the same to copy/paste them on the destination machine.

2
  • Are you sure ditto isn't able to do exactly the same? And does this transgress copying across file systems, e.g. via DMG or via network sharing?
    – gctwnl
    Commented Aug 30, 2019 at 10:38
  • 1
    @gctwnl I will do a complete validation test of ditto, your question put me in doubt now, because you seems to be sure about it. So lets validate it. I will update my answer in case of yes or no, with the results. I will post it here in a few moments.
    – Prado
    Commented Aug 30, 2019 at 16:41
2

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.

0
1

Try to ssh into one machine and use cp -avi -p. -i = interactive, -p = preserve directory attributes , -v = verbose. I almost always use cp -avi which preservers structures and attributes of files being copied , with the exception of directory attributes. From man cp

 -p: Cause cp to preserve the following attributes of each source
 file in the copy: modification time, access time, file flags,
 file mode, user ID, and group ID, as allowed by permissions.
 Access Control Lists (ACLs) and Extended Attributes (EAs),
 including resource forks, will also be preserved....

...continued

1
  • If the -a option in cp implies -pPR then why do you have the extra -p?
    – fd0
    Commented Aug 26, 2019 at 13:35

You must log in to answer this question.

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