2

I was trying to resize my bootcamp partition and add a new partition as exFat to share between the two... I formatted my bootcamp partition, was unable to figure out how to merge it with my main macOS partition... After some searching, I came across : https://www.macobserver.com/tips/deep-dive/resize-your-apfs-container/

I followed the steps I thought I needed... using the command

sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s4

for the appropriate disks... So far so good, or so I thought.

I entered the command

diskutil apfs resizeContainer disk0s2 0

But recieved the following:

Started APFS operation Error: -69771: The target disk is too small for this operation

After running the diskutil list command, I realized that I can't even find the space I erased earlier anywhere... Can someone help me figure out how to reclaim that space? I do have a backup of data on time machine; however, someone else is experiencing a similar issue, and they did a clean install and their space is still missing as well. https://discussions.apple.com/thread/8291525

I'm not one to usually post or ask for help, I tend to search and find solutions out there, but I'm not having any luck. Any help would be greatly appreciated. Any info needed, I'll be happy to provide.

Below is the results of disktil list

/dev/disk0 (internal):
    #:                       TYPE NAME           SIZE       IDENTIFIER
    0:      GUID_partition_scheme                500.3 GB   disk0
    1:                        EFI EFI            314.6 MB   disk0s1   
    2:                 Apple_APFS Container disk1  423.0 GB   disk0s2
    3:                  Apple_HFS XPlatform      15.9 GB    disk0s3
    4:                 Apple_Boot                134.2 MB   disk0s4
    5:       Apple_KernelCoreDump                655.4 MB   disk0s5

/dev/disk1 (synthesized):
    #:                       TYPE NAME       SIZE       IDENTIFIER
    0:      APFS Container Scheme -         +423.0 GB   disk1                                 Physical Store disk0s2
    1:                APFS Volume Macintosh HD  319.3 GB   disk1s1
    2:                APFS Volume Preboot    22.4 MB    disk1s2
    3:               APFS Volume Recovery    509.8 MB   disk1s3
    4:          APFS Volume VM               1.1 GB     disk1s4

 /dev/disk2 (disk image):
    #:                       TYPE NAME        SIZE       IDENTIFIER
    0:                CCCOMA_X64FRE_EN-US... +4.7 GB     disk2

As you can see, I'm missing about 60 gb, which is the amount of space I was attempting to free up.

EDIT:

Results for the fdisk /dev/disk0 command:

Disk: /dev/disk0    geometry: 7602/255/63 [122138133 sectors]
Sector size: 4096 bytes       
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  122138132] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused 
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Results for the gpt -r show /dev/disk0 command:

    start       size  index  contents
        0          1         PMBR
        1          1         Pri GPT header
        2          4         Pri GPT table
        6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    76806  103270257      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
103347063    3873482      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
107220545      32768      4  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
107253313    2441407 
109694720     160000      5  GPT part - 5361644D-6163-11AA-AA11-00306543ECAC 
109854720   12283408           
122138128          4         Sec GPT table
122138132          1         Sec GPT header

EDIT 2: Ran the commands from macOS Recovery and the results were a bit different, so I thought I'd share that as well.

-bash-3.2# csrutil disable
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.
-bash-3.2# fdisk /dev/disk0
Disk: /dev/disk0    geometry: 520/128/63 [4194024 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -    4194023] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
-bash-3.2# gpt -r show /dev/disk0
    start     size  index  contents
        0        1         PMBR
        1        1         Pri GPT header
        2       32         Pri GPT table
       34        6         
       40  3931800      1  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  3931840   262151         
  4193991       32         Sec GPT table
  4194023        1         Sec GPT header

EDIT 3: Original results recreated.

sudo fdisk  /dev/disk0
Disk: /dev/disk0    geometry: 7602/255/63 [122138133 sectors]
Sector size: 4096 bytes
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  122138132] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      

sudo gpt  -r  show  /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      76806  103270257      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  103347063    3873482      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  107220545      32768      4  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  107253313    2441407         
  109694720     160000      5  GPT part - 5361644D-6163-11AA-AA11-00306543ECAC
  109854720   12283408         
  122138128          4         Sec GPT table
  122138132          1         Sec GPT header

EDIT 4:

Results after running sudo diskutil erasevolume free n disk0s5

diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         423.0 GB   disk0s2
   3:                  Apple_HFS XPlatform               15.9 GB    disk0s3
   4:                 Apple_Boot                         134.2 MB   disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +423.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            307.6 GB   disk1s1
   2:                APFS Volume Preboot                 22.4 MB    disk1s2
   3:                APFS Volume Recovery                509.8 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

sudo fdisk  /dev/disk0
Disk: /dev/disk0    geometry: 7602/255/63 [122138133 sectors]
Sector size: 4096 bytes
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  122138132] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused   

sudo gpt  -r  show  /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      76806  103270257      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  103347063    3873482      3  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  107220545      32768      4  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  107253313   14884815         
  122138128          4         Sec GPT table
  122138132          1         Sec GPT header

EDIT 5: Command results once again.

diskutil list
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         438.9 GB   disk0s2
   3:                 Apple_Boot                         134.2 MB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +438.9 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            307.6 GB   disk1s1
   2:                APFS Volume Preboot                 22.4 MB    disk1s2
   3:                APFS Volume Recovery                509.8 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

sudo fdisk  /dev/disk0
Disk: /dev/disk0    geometry: 7602/255/63 [122138133 sectors]
Sector size: 4096 bytes
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  122138132] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      

sudo gpt  -r  show  /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      76806  107143739      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  107220545      32768      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  107253313   14884815         
  122138128          4         Sec GPT table
  122138132          1         Sec GPT header

EDIT 6: Someome kindly pointed out that I had not shared my end goal. Am now looking to have one drive with the full 500gb available and then go from there to establishing a bootcamp partition and then an additional exFat partition that can be shared between the two OS!

EDIT 7: All issues have been resolved!

  • 1
    To me a clean install means you boot to another OS (internet recovery / bootable USB) and erase the disk and all partitions. Then the installer makes the stock layout and you get a clean install to restore your data. In the end - what do you want to do? Awesome technical data - but editing the clear "what end state you want" might get a short answer instead of a super long answer that might not even help you with your next action – bmike Mar 11 '18 at 18:11
  • 1
    Yes, I'm starting to learn that asking for help is a lot harder than it looks! When David pointed out that I hadn't even shared what hardware/OS version I was running, I wanted to bang my head against the wall for overlooking something so basic yet important, haha. Looking to have one drive with the full 500gb available and then go from there to establishing a bootcamp partition and then an additional exFat partition that can be shared between the two OS. – P L Mar 11 '18 at 18:39
2

The folks at Apple seem to be operating under a paradigm where no drive space is ever unallocated. Therefore, when System Integrity Protection (SIP) is enabled, the macOS operating system prevents execution of any utilities or commands which could report the location of lost space on system drives. Your Mac uses a single physical system drive named /dev/disk0.

System drives generally contains two types of partition tables. The first is the Master Boot Record (MBR) table and the second is the GUID Partition Table (GPT). The command fdisk dumps the contents of the MBR table, while the command gpt partially dumps the contents of the GPT. To used these command on a system drive, you need to either disable SIP or execute the commands while booted to macOS Recovery. The commands you need to enter are given below

fdisk  /dev/disk0
gpt  -r  show  /dev/disk0

The gpt commands prints a table of the space occupied by each partition. The table also prints unallocated space. Generally, you need to know which partitions are located before the lost (unallocated) space you wish to recover. Usually, the diskutil command can then used to recovery this space. Although, other commands such as fdisk, gpt and gdisk can also be used.

Note: Generally the identifier produced by disktuil output contains the index for a given partition. This is not alway true. You may need to consider other output from both the diskutil and gpt commands before matching a partition index with an identifier.

If you could post the output from the above commands, then someone (or I) could help with the correct commands to repair your Mac.

Update 1

You can erase the Apple_KernelCoreDump` partition by executing the command given below. The result will a block of free space the the end of your drive. The size of this block will be about 61 GB.

sudo  diskutil  erasevolume  free  n  disk0s5

Beyond this change, I am not sure what to post. I need to know how you want the drive partitioned. So far, you have mentioned partitions for ExFat and Windows. Currently you have Apple_HFS and Apple_Boot partitions. You can not merge the free space back to the APFS container until these partitions are erased. Also, if you are going to reinstall Windows, you probably should state the model/year of your Mac and the version of Windows.

Update 2

The following command will return all free space back to the APFS partition.

sudo  diskutil  erasevolume  free  n  disk0s3
sudo  diskutil  apfs  resizecontainer  disk0s2  0

If the above commands work, are you then going to attempt to install Windows 10 through the use of the Boot Camp Assistant? Other users have reported problems using the Boot Camp Assistant when the internal physical drive has an APFS partition.

  • 1
    Thank you so much, I've gone ahead and disabled SIP and will post the results to the commands you suggested! – P L Mar 10 '18 at 0:30
  • 1
    Updated original post again with results from macOS Recovery as it yielded what appears to be different results. – P L Mar 11 '18 at 0:34
  • 1
    Do not run any partitioning commands from macOS Recovery. Your first post shows a sector size of 4096 bytes. The second post shows a mess. Can you recreate the results from the first post? Have you changed the partitioning between making the two posts? – David Anderson Mar 11 '18 at 1:09
  • 1
    Yes, I can recreate the results from the first post. Just tried it now, exactly the same as before I think - edited the OP again to reflect. I have tried to make a bootcamp partition via the bootcamp assistant - which was unsuccessful - have not... and now will not, try anything else. – P L Mar 11 '18 at 3:48
  • 1
    I've gone ahead and ran the command you suggested. I'm not noticing the space available again? I have a MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports), 3.3 GHz Intel Core i7, 16 gb RAM. I'd like to have a 16gb partition as exFAT - currently have that partition as Mac extended journaled, a 50 GB volume for bootcamp - Win10 x64 - and the rest for my macOS! I've updated the main post with all the commands again to reflect any changes after the command you just told me to enter! Hope this helps, thanks for guiding me! – P L Mar 11 '18 at 7:00

You must log in to answer this question.

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