2

I had 2 partitions in my MacBook: Partition 1 - 200 GB - High Sierra Partition 2 - 300 GB - Mojave

After deleting the partition 1 I am unable to reclaim disk space associated with it.

Disk Utility on my Mac

Here is the snapshot of diskutil list command executed through terminal:

enter image description here

I tried below command:

sudo diskutil apfs resizeContainer disk0s3 0

But it showed following error:

Error: -69743: The new size must be different than the existing size

Any ideas on how can I reclaim the lost disk space?

2

The command you are using adds any significant amount of free space immediately after the APFS container partition. The APFS partition container is already at the end of the drive. There is no significant amount of free space to add.

There is approximately200 GB of free space above the APFS container partition. The macOS operation system offers no command or application that would add any of this free space to the APFS container partition.

The easiest solution would be to backup you files, erase the drive, reinstall macOS and reload your files.

Another more complex solution would be to create a new APFS container partition above the existing APFS container partition. You could then either:

  • Install macOS in the new APFS container partition, then use the Migration Assistant to copy all your files and applications. I have used this solution before.

OR

  • Attempt to clone the old APFS container partition to the new APFS container partition. I have never tried this solution. Maybe some else could comment or post an answer.

Afterwards, you could erase the old APFS container partition to create free space immediately after the new APFS container partition. You could then use the diskutil apfs resizeContainer command to add this new free space to the new APFS container partition

Creating new APFS container partition would involve several steps. Some of these steps would have to be preformed while booted to macOS Recovery. You should backup your files before attempting these steps. However, once you have a backup, you might as well just erase the entire drive and reinstall macOS. If want me to include the steps to create a new APFS container partition, then post a comment.

I should also note that you do not have a EFI partition on the drive. Since the identifier for the APFS Container disk1 is disk0s3, I assume the removal of this partition took place shortly before posting your question. Apple does state in the documentation, that an EFI partition is necessary for the proper operation of the Mac.

How to Create an EFI Partition

Note: You should only proceed if you understand the steps given below. Otherwise, you may end up deleting your files.

Because of System Integrity Protection (SIP), you can not enter the commands in a Terminal window. You will first have to do one of the following.

  • Boot to macOS Recovery which can install El Capitan or a newer version of macOS. Use the csrutil command to disable SIP, then boot back to macOS Mojave. You can then enter the commands in a Terminal application window.
  • Boot to the macOS Recovery that is already on your drive. You can then enter the commands in a Terminal application window.
  • Boot to the macOS Recovery over the internet which can install High Sierra or a newer version of macOS. You can then enter the commands in a Terminal application window.

The commands with explanation are given in the following steps. Here, I have assumed the device block size is 512 bytes. In other words, the command given below should return Device Block Size: 512 Bytes.

diskutil info disk0 | grep "Device Block Size" 

If you get a device block size other than 512 bytes, then you can not use the commands given below.

  1. Reboot the Mac. The command given below should show the Apple_APFS container disk1 as disk0s1.

    diskutil list
    
  2. The command given below should create an unformatted EFI partition with the identifier of disk0s2

    gpt -f add -i 2 -b  40 -s 409600 -t efi disk0
    
  3. The command given below should FAT32 format the new EFI partition and label new volume as EFI.

    newfs_msdos -F 32 -v EFI /dev/disk0s2
    
  4. Create a temporary unformatted partition between EFI partition and the Apple_APFS container disk1. The linux type was chosen to prevent the partition from mounting. This partition should be assigned the identifier of disk0s3.

    gpt -f add -i 3 -b 409640 -s 409600 -t linux disk0
    
  5. Remove the temporary partition. The will reorder the partition entries in the GUID partition table (GPT) in ascending order.

    diskutil erasevolume free none disk0s3
    
  6. Restart the Mac. This will reorder the identifiers for disk0 in ascending order. You can enter the command given below to confirm this.

    diskutil list
    
  • Thanks for the elaborate answer. In case if EFI partition is not there then what is the best way to create it? Can you please elaborate the steps? – Devarshi Jul 16 at 4:22

You must log in to answer this question.

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