Saturday, November 16, 2024

macos – How to randomize UUIDs in an APFS container?

I made a copy of an APFS container using dd. That was some time ago and by now the containers (on separate physical devices) each have different data on them, which I’d prefer to preserve without having to shuffle them. (It’s only become an issue recently because I want to run a machine with both disks connected simultaneously.)

I’ve come across the system-provided apfs.util, whose help output indicates that it’s capable of doing what I want, with the -s option, but I’ve been unable to get it to work. The tool always immediately exits with no error/standard output, and exit code 253.

What I’ve tried:

  • Use synthesized disk as identifier .../apfs.util -s /dev/disk3
  • Use partition on the physical disk as identifier .../apfs.util -s /dev/disk2s2
  • Each of the above, with all volumes of the container unmounted (diskutil umountDisk disk3)
  • Each of the above, after diskutil ejecting the synthesized disk (which didn’t actually remove the synthesized disk, or its volumes, from under /dev or output of diskutil ap list)
  • Use a volume on the affected container, contrary to instructions .../apfs.util -s /dev/disk3s3
  • All of the above, inside a full root shell instead of appended to sudo

Any idea how to run the command, or figure out what the issue might be?

Related Articles

Latest Articles