Can I exploit rsync to repair the timestamps that Migration Assistant trashed?

Can I exploit rsync to repair the timestamps that Migration Assistant trashed?


“I’ve found the exhausting approach that Apple’s “Migration Assistant” does not all the time protect file timestamps”

Remark: Plainly has turn into Apple’s MO – you will need to uncover all issues the “exhausting approach”.

Caveats: I do not really know what Migration Assistant does as I’ve by no means used it. Nevertheless, based mostly on the rsync instance under, I’ve proven it can protect your timestamps (and different metadata you might have misplaced).

I used rsync ver 3.2.4 for this reply, put in from MacPorts. I can not guess what options your model of rsync contains. You need to think about upgrading rsync with MacPorts or Homebrew. Apple hasn’t upgraded “their” model of rsync in a few years, and it lacks the power to help the strategies and choices used right here.

Background: I started utilizing rsync as my major backup software for macOS a while in the past as a result of I needed to tackle the identical points as you: mangled and lacking metadata. In my case, the difficulty was maybe exacerbated by crossing a file system boundary – from APFS on my native drive to btrfs by way of SMB on a ‘Synology NAS’. In your case, utilizing Migration Assistant, I can’t think about how Apple couldn’t get the timestamp metadata appropriate – however you are not the one one who’s reported this subject.

I made some notes whereas working to resolve my subject, they usually morphed right into a “recipe” on this GitHub repo. I will maintain this reply transient as many of the particulars are lined in that doc.


Q: Can I exploit rsync to repair the timestamps that Migration Assistant trashed?

A: Sure – as proven under and verified

rsync with metadata preservation

rsync successfully copies knowledge from a supply (the “from” location) to a vacation spot (the “to” location). If you’re utilizing a fileserver (NAS) as a backup to your Mac, the GitHub recipe will present full steerage to make and restore an rsync backup with out shedding metadata (attrs & xattrs).

Nevertheless, as you want solely to “migrate” information & folders from an outdated Mac to a brand new Mac, there isn’t any must contain an intermediate NAS. Consequently, the GitHub recipe might be simplified.

The state of affairs under assumes that the distant folders have been mounted (maybe by way of ‘File Sharing’ in ‘System Settings’). Alternatively, in the event you favor to allow ‘Distant Login’ you may run rsync by way of SSH.

The next command code block reveals the command syntax & choices wanted for rsync to carry out an outdated Mac-to-new Mac “migration”:

SCENARIO: from “oldMac” to “newMac”

Assuming the supply & vacation spot folders are:
SOURCE: /Customers/MyHome/oldMacFolder/
DESTINATION: /Customers/MyHome/newMacFolder

From Terminal.app in your “outdated Mac”:

% SRC-FLDR="/Customers/MyHome/oldMacFolder/"
% DST-FLDR="/Customers/MyHome/newMacFolder"
% rsync -rlAXtgoDivv --dry-run -M--fake-super $SRC-FLDR $DST-FLDR

Notes:

  1. --dry-run this feature prevents rsync from really copying any information! It is used in an effort to see what will likely be copied as soon as the choice is eliminated.

  2. When you’ve not arrange file-sharing to mount the distant folder(s), it’s possible you’ll use an SSH connection by including the choice -e ssh to the rsync command. This can require that you have arrange ‘Distant Login’ in ‘System Settings’.

Verifying Outcomes – Preservation of All Metadata:

The GitHub recipe features a brief zsh script that may stat all the information, folders, hyperlinks, and so on between the SOURCE and DESTINATION folders. It could be run after the rsync operations to confirm that the chosen stat attributes have been preserved.

The rsync choices introduced right here will do greater than protect the metadata containing the date-time stamps; they may also protect all prolonged attributes (xattrs) . The GitHub recipe additionally features a easy script to match the output of xattr -lrsvx for all information (which have xattrs) within the SOURCE and DESTINATION directories.

The stat utility that I exploit right here is the GNU coreutils model 9.1. The discover model I exploit is the GNU findutils model 4.9.0. Each are available via MacPorts (and sure via Homebrew) for nearly each model of macOS. The xattr command is a macOS utility.


References and Additional Studying:

  1. There’s extra to information than knowledge: Prolonged Attributes

  2. APFS: Prolonged attributes revisited

  3. From quarantine to provenance: prolonged attributes

  4. From quarantine to provenance: how xattrs are copied

  5. Prolonged attributes

  6. The way to use rsync over ssh

Leave a Reply

Your email address will not be published. Required fields are marked *