Skip to content

Instantly share code, notes, and snippets.

@rctphone
Last active February 14, 2021 06:56
Show Gist options
  • Save rctphone/62f75cf2f0293bdc9dd27eebac1d5c61 to your computer and use it in GitHub Desktop.
Save rctphone/62f75cf2f0293bdc9dd27eebac1d5c61 to your computer and use it in GitHub Desktop.
How to solve "APFS inverter failed to invert the volume" error
After cloning APFS drives using Disk Utility it usually ends with a volume containing ContainerToInvert file with the size of a cloned partition.
Don't be afraid, using the following steps you can mount this file as APFS container and get all partitions.
1. Requirements
We need FUSE and xmount installed
2. Terminal
Open Terminal app and type the following:
$ sudo mkdir /Volumes/apfs_image/
$ sudo mkdir /Volumes/apfs_mounted/
$ sudo xmount --in raw <path to ContainerToInvert file> --out dmg /Volumes/apfs_image/
$ hdiutil attach -nomount /Volumes/apfs_image/ContainerToInvert.dmg
$ diskutil ap list
## this is optional step, I don't need it
$ diskutil ap unlockVolume <Disk GUID> -nomount
$ sudo mount_apfs -o rdonly,noexec,noowners /dev/disk# /Volumes/apfs_mounted/
After that, you will have the original partition mounted to your system.
References and Thank You’s
https://www.mac4n6.com/blog/2017/11/26/mount-all-the-things-mounting-apfs-and-4k-disk-images-on-macos-1013
@dmaksimov
Copy link

Super helpful! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment