APFS inverter failed to invert the volume error solved by calling apfs_invert?

Hi,


I recently had the same problem as described here:

https://discussions.apple.com/thread/8384650

Unfortunately it is not possible to reply there, it suggested me to open a new question, so here I am. :)

The process of cloning an apfs volume with disk utility led to the error in the title and left

me with a volume with only one file "ContainerToInvert" in it.

I did some googling and found that there's an utility apfs_invert. So I played around and found

that this command would make the copy work:

sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_invert -d /dev/disk3s3 -n ContainerToInvert -s 1


(where /dev/disk3s3 is the device of the container partition (check with "diskutil list" or "diskutil apfs list" for the right name).


Is it possible that one can circumvent the error that easily? If yes, couldn't Apple simply fix Disk Utility?

MacBook Pro Retina

Posted on Dec 18, 2018 5:32 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 28, 2018 2:20 PM

Hi astirusty, thanks for the info. But why don't they just give an error message then right at the start instead of cloning and verifying several hours and then giving a cryptical error message? This makes no sense to me... Anyway, I got it to work with my method stated above. As I suspected, I had to

  1. Disable automatic updates in time machine preferences
  2. Remove local time machine snapshots with " tmutil listlocalsnapshots" and then "tmutil deletelocalsnapshots <date>" for every entry from the list
  3. Do the cloning with disk util (in my case I had to boot from another drive because it was the system disk) until the error message.
  4. Then (in my case after a reboot) _eject_ or unmount the disk or apfs_invert will get an error
  5. sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_invert -d /dev/disk3s3 -n ContainerToInvert -s 1
  6. In one case that was all, in another case I had an "inactive" apfs container and had to do "first aid" in disk util to get the partition back.


In any case it might be better and safer to use Cabon Copy Cloner, as some other people pointed out, but I just didn't want to give up :)

10 replies
Question marked as Top-ranking reply

Dec 28, 2018 2:20 PM in response to astirusty

Hi astirusty, thanks for the info. But why don't they just give an error message then right at the start instead of cloning and verifying several hours and then giving a cryptical error message? This makes no sense to me... Anyway, I got it to work with my method stated above. As I suspected, I had to

  1. Disable automatic updates in time machine preferences
  2. Remove local time machine snapshots with " tmutil listlocalsnapshots" and then "tmutil deletelocalsnapshots <date>" for every entry from the list
  3. Do the cloning with disk util (in my case I had to boot from another drive because it was the system disk) until the error message.
  4. Then (in my case after a reboot) _eject_ or unmount the disk or apfs_invert will get an error
  5. sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_invert -d /dev/disk3s3 -n ContainerToInvert -s 1
  6. In one case that was all, in another case I had an "inactive" apfs container and had to do "first aid" in disk util to get the partition back.


In any case it might be better and safer to use Cabon Copy Cloner, as some other people pointed out, but I just didn't want to give up :)

Dec 19, 2018 7:25 AM in response to BDAqua

I have to add that it didn't work yet for my boot drive because of this error:

[michael.teske@MichaelsMacbook conf]$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_invert -d /dev/disk3s3 -n ContainerToInvert -s 1

Password:

lookup_topology:1189: raw cont: disk3s3

lookup_topology:1190: synth container: disk4

lookup_topology:1191: synth vol: disk4s1

lookup_topology:1197: encrypted: no

*** Mounting outer volume (/dev/disk3s3 s1)...

nx_kernel_mount:1359: /dev/disk3s3: checkpoint search: largest xid 489, best xid 489 @ 137

nx_kernel_mount:1423: /dev/disk3s3: sanity checking all nx state... please be patient.

spaceman_metazone_init:476: metazone for device 0 of size 1780847 blocks (encrypted: 0-890423 unencrypted: 890423-1780847)

spaceman_trim_free_blocks:3009: scan took 0.000675 s, trims took 0.000000 s


*** Getting image dstream info...

ContainerToInvert: dstream_id=16, size=431894802432


*** Mounting inner volume (ContainerToInvert)...

nx_kernel_mount:1359: : checkpoint search: largest xid 280390, best xid 280390 @ 134

nx_kernel_mount:1423: : sanity checking all nx state... please be patient.

sanity_check_alloced_blocks:261: fs_alloc_count mismatch: fs root nodes 369462 extent 41 omap 5683 snap_meta 1 er: 0 udata: 92443598 fs_alloc_count 92883346

mount_inner_volume:872: Inner volume has snapshots


These are probably the time machine local snaphots, I just deleted them but it will take some time to try again.


Jan 19, 2019 1:34 PM in response to astirusty

I found a workaround the drive inverter failed in my case... The clone I made from my MacBook Pro was named Macintosh HD, and prior to restore I would erase the internal disk with the name Macintosh HD and APFS format.

What I did next was to name the next clone macOSMojave and restore it to my Macintosh HD, and the restore went through. However, on the next boot, the folder with question mark showed-up, so I went back to disk utility, rename change the name back to Macintosh HD,, then restarted with the “option Key”, my HD was there and it booted fine. After, in preference I made sure the disk was selected as the start-up disk, and the issue was gone.

Dec 28, 2018 4:55 PM in response to teskor

Very good question as to why Apple's Disk Utility does not immediately reject the "Restore" when APFS disk(s) are involved. Even though Apple is saying they don't (well no longer) support use of "Restore" for cloning (backup), fact that Disk Utility does copying of disk data, does Verify, and fails only at End of "Restore"; says Apple messed up with APFS and Disk Utility.


First time I ran into Inverter Failed problem, I was told it was due to my MacBook Air being to old, and it's Firmware as problem. This time both iMac and MacBook Pro were new enough that was not going to fly. Apple Support would not respond to me via Email as to issue between Disk Utility and APFS. Only way Apple Support would tell me was via phone. Which tells me, Apple wants it swept under rug.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

APFS inverter failed to invert the volume error solved by calling apfs_invert?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.