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?

up vote 1 down vote accepted

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`
  • Thanks. So, this file is likely to contain the full contents of the old partition/drive? – Turophile Sep 20 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 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 at 2:13
  • Yes, please do. Sharing your results, whatever they are, will definitely help others! :) – Monomeeth Sep 20 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 at 4:30

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.