3

After previously upgrading to High Sierra and converting my boot drive to APFS, I recently migrated to a new (larger) SSD boot drive. While setting that up, Disk Utility gave me an error when restoring from my old volume to the new one "APFS inverter failed to invert the volume - invalid argument".

I ended up using Carbon Copy Cloner to transfer the files which went OK, and I am now running from the new volume.

However I have a file at the root of the drive called ContainerToInvert. It is over 250GB in size, so I'd like to delete it if it isn't needed.

Can anyone confirm that deleting it won't cause any problems?

3
  • Clarifying the question a bit: you first tried Disk Utility’s Restore function to clone the existing drive, got the ‘failed to invert’ error, and then used CCC as a second attempt, which worked. ContainerToInvert is the (uninverted) disk image from the first (failed) attempt with DU. Since CCC worked, you shouldn’t need ‘ContainerToInvert’ as it is a copy of your source drive, which you now have two copies of (source and destination). CCC can be configured to overwrite all data on the destination drive, in which case it would have deleted ContainerToInvert for you.
    – Brian D
    Dec 2, 2019 at 17:28
  • @BrianD Yes, your summary is correct. I didn't know what was in the ContainerToInvert file and if it was safe to delete, thus my question. As I said in the comments after I had followed the directions in @monomeeth's answer, "In conclusion, yes, the ContainerToInvert file can be deleted."
    – Turophile
    Dec 10, 2019 at 1:44
  • I was going through a similar SSD upgrade process myself but with Mojave when I came across your question. I experienced the exact same error and also ended up using CCC successfully. Thanks!
    – Brian D
    Jan 10, 2020 at 17:33

1 Answer 1

2

This often happens after cloning APFS drives using Disk Utility. The size of the file usually relates to the cloned partition size.

You can use the following steps to mount the ContainerToInvert file as an APFS container and access all the partitions.

  1. Download and install FUSE
  2. Download and install xmount1
  3. Open Terminal (usually located within Applications/Utilities)
  4. Type sudo mkdir /Volumes/apfs_image/ into Terminal and press Enter (when prompted, enter your password)
  5. Type sudo mkdir /Volumes/apfs_mounted/ into Terminal and press Enter (when prompted, enter your password)
  6. Type sudo xmount --in raw <path to ContainerToInvert file> --out dmg /Volumes/apfs_image/ into Terminal and press Enter (when prompted, enter your password)
  7. Type hdiutil attach -nomount /Volumes/apfs_image/ContainerToInvert.dmg into Terminal and press Enter (when prompted, enter your password)
  8. Type diskutil ap list into Terminal and press Enter (when prompted, enter your password)
  9. Type diskutil ap unlockVolume <Disk GUID> -nomount into Terminal and press Enter (when prompted, enter your password)
  10. Type sudo mount_apfs -o rdonly,noexec,noowners /dev/disk# /Volumes/apfs_mounted/ into Terminal and press Enter (when prompted, enter your password)
  11. Now you'll have the original partition mounted
  12. Browse the disk image to inspect the contents and once satisfied there's nothing there you need to transfer across you can unmount and delete the entire .dmg file

The above steps are based on the Mount All the Things! – Mounting APFS and 4k Disk Images on macOS 10.13 blog entry.

1. If you have trouble installing xmount, then run the following command in Terminal and try again:

 `mkdir -p /Library/Filesystems/osxfusefs.fs/Support/osxfusefs.kext`
8
  • Thanks. So, this file is likely to contain the full contents of the old partition/drive?
    – Turophile
    Sep 20, 2018 at 2:08
  • This is not something I've had face myself, but I'm aware of others who have faced this scenario. In their experiences, yes, but I prefer to err on the side of caution when it comes to data so still recommend the above steps. But, if you're confident you've got all your data then deleting this is fine.
    – Monomeeth
    Sep 20, 2018 at 2:11
  • Thanks, I'll try your suggestion and report back so it is documented for any others who have this issue.
    – Turophile
    Sep 20, 2018 at 2:13
  • Yes, please do. Sharing your results, whatever they are, will definitely help others! :)
    – Monomeeth
    Sep 20, 2018 at 2:20
  • I didn't need to use step 9, as I'm not using FileVault. Also, after step 10 [which may not have been necessary] I looked in the Finder at /Volumes and found OSXFUSE Volume 0 (xmount) and inside that was a ContainerToInvert.dmg file. I double-clicked on that and it mounted the volumes for me, including the original boot volume (plus Preboot, Recovery & VM). I looked at that and it does indeed contain all the pre-upgrade files. In conclusion, yes, the ContainerToInvert file can be deleted. Or used to restore your files from.
    – Turophile
    Sep 20, 2018 at 4:30

You must log in to answer this question.

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