1

I have deleted a Bootcamp Partition, something went wrong and I now have 250 GB of "free space". Now I want to retake this space back. I already tried this solution but it didnt work for me. See screenshot attached. Secondly, I tried deleting the partition with disk utility but it too failed. Is there a way to retake the space without formatting the pc?

Output of diskutil list:

❯ diskutil list                                                               ~
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         750.0 GB   disk0s2
                    (free space)                         250.2 GB   -

/dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +750.0 GB disk1 Physical Store disk0s2 1: APFS Volume ⁨Macintosh HD⁩ 15.8 GB disk1s1 2: APFS Snapshot ⁨com.apple.os.update-...⁩ 15.8 GB disk1s1s1 3: APFS Volume ⁨Macintosh HD - Data⁩ 310.8 GB disk1s2 4: APFS Volume ⁨Preboot⁩ 654.2 MB disk1s3 5: APFS Volume ⁨Recovery⁩ 1.1 GB disk1s4 6: APFS Volume ⁨VM⁩ 24.6 KB disk1s5

Output of diskutil addpartition disk0s1 apfs NewAPFS 0:

❯ diskutil addpartition disk0s1 apfs NewAPFS 0                                ~
The new partition to be added will be of a filesystem personality of APFS apfs APFS 7C3457EF-0000-11AA-AA11-00306543ECAC
The new partition will be added following disk0s1
Started partitioning on disk0
Error: -69519: The target disk is too small for this operation, or a gap is required in your partition map which is missing or too small, which is often caused by an attempt to grow a partition beyond the beginning of another partition or beyond the end of partition map usable space

Output of disk utility translated with deepl:

Operation 1 of 1 is executed: Remove "Free" ((null)) and grow container disk1 "Macintosh HD" (disk0s2) ...
Adjust growth delta to 250,240,712,704 bytes and set new physical storage size of 1,000,240,963,584 bytes
The maximum size for the target physical storage of this APFS container was determined to be 1,000,239,935,488 bytes
Change the size of the APFS container specified by the APFS container reference disk1.
The specific APFS physical storage that is being resized is disk0s2
Check storage system
Use live mode.
run fsck_apfs -n -x -l /dev/disk0s2
Check the container superblock ...
Check the EFI jumpstart entry ...
Check the space manager ...
Check the space manager free queue trees ...
Check the object allocation ...
Check the encryption key structures ...
Volume "/dev/rdisk1s1" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check snapshot 1 of 1 (com.apple.os.update-9D831579E656FF2E36BAC3334521407031CBA216B7079C5998A817A5EC7C76B7) ...
Check the extent-ref tree ...
Check the Fsroot tree ...
Check the file extent tree ...
Check the object map location of the volume ...
Volume "/dev/rdisk1s1" seems to be ok.
Volume "/dev/rdisk1s2" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check the extent-ref tree ...
Check the document ID tree ...
Check the Fsroot tree ...
error: doc-id tree: record exists for doc-id 3936, file-id 51075282 but no inode references this doc-id
Check the object map location of the volume ...
The volume "/dev/rdisk1s2" is obviously damaged and needs to be repaired.
Volume "/dev/rdisk1s3" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check the extent-ref tree ...
Check the Fsroot tree ...
Check the object map location of the volume ...
Volume "/dev/rdisk1s3" seems to be ok.
Volume "/dev/rdisk1s4" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check the extent-ref tree ...
Check the Fsroot tree ...
Check the object map location of the volume ...
Volume "/dev/rdisk1s4" seems to be ok.
Volume "/dev/rdisk1s5" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check the extent-ref tree ...
Check the Fsroot tree ...
Check the object map location of the volume ...
Volume "/dev/rdisk1s5" seems to be ok.
Volume "/dev/rdisk1s6" is checked.
Check the APFS volume superblock ...
Check the object allocation ...
Check the snapshot metadata tree ...
Check the snapshot metadata ...
Check the extent-ref tree ...
Check the Fsroot tree ...
Check the object map location of the volume ...
The volume "/dev/rdisk1s6" seems to be ok.
Check the mapped space ...
Perform deferred repairs ...
error: doc-id tree record exists for doc-id 3936, but no inode references this doc-id
Moved repairs skipped.
The container "/dev/disk0s2" could not be fully checked.
Exit code for storage system check is 8.
Failed to check or repair the storage system. : (-69716)

Action failed ...

I would greatly appreciate any help recovering the 250 GB.

  • Could you add text as text not as pictures. It makes it an unsearchable resource & cannot be read by sight impaired users. [select your text & hit Ctrl/k to format] – Tetsujin Apr 10 '22 at 15:56
  • 1
    @Tetsujin Two good points, thanks for letting me know. I changed it. – Lukas Köhl Apr 10 '22 at 16:15
  • Excellent. Thank you. [idk the answer, but now we have a 'nice' question ;)) – Tetsujin Apr 10 '22 at 16:19
  • I am no expert (so don't take this as definitive), but the diskutil addpartition disk0s1 apfs NewAPFS 0 must be wrong. Surely it should be disk0s2 as the partition to be added is after disk0s2. This is just my reading of man diskutil. And, don't do anything without making sure you have a good backup! – Gilby Apr 10 '22 at 22:41
  • I think the answer is here https://apple.stackexchange.com/questions/438653/how-can-i-merge-the-free-space-with-apple-apfs-container-disk3/438657#438657 which is from @David Anderson – Gilby Apr 11 '22 at 02:00
  • @Gilby Its seems like disk utility is using this command aswell, because my output is identical. Still no success. – Lukas Köhl Apr 11 '22 at 10:49

1 Answers1

0

Thanks to Gilby for solving the mystery.

I am no expert (so don't take this as definitive), but the diskutil addpartition disk0s1 apfs NewAPFS 0 must be wrong. Surely it should be disk0s2 as the partition to be added is after disk0s2. This is just my reading of man diskutil.

Well, now running diskutil addpartition disk0s1 apfs NewAPFS 0 worked and it created a new partition called NewAPFS. This means it is possible to follow the steps provided by David Anderson.

Its worth mentioning that in this procedure the entire existing partition is being copied on the NewAPFS partition so I had to clean up my mac and temporary remove a lot of apps. Once I reduced my disk usage the instructions worked quite nicely. There was a minor problem with step 5 because only one boot option appeared. After booting I found out that the previous used partition got somehow corrupted.

❯ diskutil list                                                               ~
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         750.0 GB   disk0s2
   3:                 Apple_APFS ⁨Container disk2⁩         250.2 GB   disk0s3

/dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +ERROR disk1 Physical Store disk0s2

/dev/disk2 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +250.2 GB disk2 Physical Store disk0s3 1: APFS Volume ⁨Macintosh HD - Data⁩ 214.7 GB disk2s1 2: APFS Volume ⁨Macintosh HD⁩ 15.8 GB disk2s2 3: APFS Snapshot ⁨com.apple.os.update-...⁩ 15.8 GB disk2s2s1 4: APFS Volume ⁨Preboot⁩ 651.2 MB disk2s3 5: APFS Volume ⁨Recovery⁩ 1.1 GB disk2s4 6: APFS Volume ⁨VM⁩ 20.5 KB disk2s5

That wasn't a big problem though. I deleted disk1 and I simply had to redo the entire procedure again. The second time everything worked smoothly and I am now back to my entire 1 TB of storage.

For anyone wondering I am on Version 12.2.1