Question

I done a mistake playing with bootcamp.

I create a small Windows partition 72GB, with bootcamp. But I realized that was too small, so I decided to deleted it with Disk Utility (I know.. WRONG choice).

So I create a new windows partition (with bootcamp too) larger approx.200GB, to try to delete the first one. After that I used bootcamp to delete windows partition. But that deleted just the last one (the big one).

So I tried this How to remove a container disk and reclaim space with main partition? To delete the two partitions.

I done some stupid thinks because now I have 472GB unusable.

Is Anyone now how to transform this "freespace" to merge it to my Machkintosh HD main partition. For formation I have and iMac 2014 with fusion drive.

Thanks a lot

disk util list

Disk util partition reparition

Disk util merge process failed NB : I done it in recovery mode without success.

Update 1

Hello and thanks David for thoses precises explainations.

I do what you ask :

  • I create the new MyBackup partition
  • After I a create a bootable usb flash drive and start a terminal on it
  • I have an error during the repair volume command as you predict

So i do : diskutil apfs deletecontainer disk1s2 Dummy

But I'm not sure to have what you explain. I haven't disk0s2

So I prefered to post you the diskutil list to be sure what I have to do next.

Diskutil list

Thanks again !

Was it helpful?

Solution

The command below will verify the container before resizing. In your case, the verification failed, so the resize operation did not take place.

diskutil apfs resizecontainer disk1s2 0

You could try repairing the container. Before attempting, I would recommend backing up your personal files. Backing up to a external drive would be best. However, since you have free space, you could enter the command below to create a another APFS container with the APFS volume MyBackup. This answer assumes will have done this.

diskutil addpartition disk1s2 apfs MyBackup 0

At this point, you should boot to macOS Big Sur Internet Recovery. Or, you could boot from a macOS Big Sur installer flash drive.

Note: You should check to see if any of the identifiers have changed. If so, then make the appropriate substitutions in the remaining commands.

The command below attempts repair.

diskutil repairVolume disk1s2

If repair fails, then you should reinstall macOS BigSur. Below are the commands needed to create a new APFS container with the single APFS volume Macintosh HD. The command given below attempts to delete the APFS Fusion container.

diskutil apfs deletecontainer disk1s2 Dummy

If the above command fails to create an Apple_HFS type partition on both disk0s2 and disk1s2, then enter the command given below.

diskutil apfs deletecontainer -force disk1s2 Dummy

The above command will generate the following warning.

Deleting APFS Container with all of its APFS Volumes
Operating in the contingency (damaged APFS Container) mode. Only the specified APFS Physical Store disk is guaranteed to be reclaimed. Other APFS Physical Stores which may have defined this APFS Container might need to be reclaimed separately
Deleting Container

When I tested this command, an Apple_KFS type partition was created on both disk0s2 and disk1s2. If this does not happen, then stop and post the output from diskutil list to your question. Post a command to this answer, so I can be informed.

The next command creates a new APFS Fusion container.

diskutil apfs createcontainer -main disk0s2 -secondary disk1s2

The next command outputs the identifier for the new APFS Fusion container. Here I will assume the identifier disk2 was output.

diskutil info disk0s2 | grep Container

The next command adds an APFS volume labeled Macintosh HD to the new APFS Fusion container. If your identifier for the new APFS Fusion container is not disk2, then make the appropriate substitution.

diskutil apfs addvolume disk2 apfs "Macintosh HD"

At this point, you can install macOS Big Sur and copy your backed up files back to the Macintosh HD volume.

If you created the MyBackup volume, then enter the following commands to remove the APFS container with this volume and reclaim the space.

diskutil apfs deletecontainer disk1s3
diskutil apfs resizecontainer disk1s2 0

Update 1

Below is a copy of the image you posted of your progress.

You entered the command given below.

diskutil apfs deletecontainer disk1s2

You were suppose to enter the command given below.

diskutil apfs deletecontainer disk1s2 Dummy

You can fix this error by entering the commands given below.

diskutil addpartition disk0s1 jhfs+ "Dummy 2⁩" 0 
diskutil addpartition disk1s1 jhfs+ "Dummy" 0

To insure the identifiers are assigned correctly, you probably should restart the Mac after entering the above commands. In your case, you will want to boot from the flash drive. Since you have successfully removed the defective APFS Fusion container, you can continue with the original instructions at the point where you will be entering the command which creates a new APFS Fusion container.

OTHER TIPS

If you see this link : https://support.apple.com/en-us/HT207584. the command diskutil resetfusion would repair your system disks structure.

Hello and thanks David for thoses precises explainations.

I do what you ask :

  • I create the new MyBackup partition
  • After I a create a bootable usb flash drive and start a terminal on it
  • I have an error during the repair volume command as you predict

So i do : diskutil apfs deletecontainer disk1s2 Dummy

But I'm not sure to have what you explain. I haven't disk0s2

So I prefered to post you the diskutil list to be sure what I have to do next.

Diskutil list

Thanks again !

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top