The target disk is too small for this operation, possibly due to partition map limits. : (-69519)

I am trying to remove my Boot Camp partition because I do not use Windows and would like the space back. I received errors (Your disk can only create a 49 GB partition. The Boot Camp partition requires at least 50 GB) when trying to remove Boot Camp which told me to run Disk Utility. Disk Utility said everything is OK, so then I reviewed the Partitions. The pie chart shows that I have a 1.88 TB Free space which I selected then pressed "-". That utility ran and returned the error The target disk is too small for this operation, possibly due to partition map limits. : (-69519). I am running OS Ventura 13.6.7 on a 2017 27" Retina 5K iMac. My Mac HD is an APFS system Volume with a GUID partition map.

Can anyone suggest a way to eliminate the Boot Camp partition?


iMac

Posted on Jun 14, 2024 1:29 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 15, 2024 7:01 PM

Ok, I found a little bit of time to experiment.


First you need to get the proper disk identifier for the APFS Container of your macOS installation. I'm assuming you do not have a Fusion Drive since that may change things. Assuming you have only a single internal drive holding macOS, then you can get the drive identifier of the hidden APFS Container by using the following Terminal command:

diskutil  list  internal  |  grep  'Apple_APFS'  |  awk  '{print $NF}'


This will give you a drive identifier in the form of "diskXsY", such as "disk0s2".


You will use the drive identifier you got from the last command in the next command....here is the template (the last character is the number zero):

diskutil  ap  resizeContainer  diskXsY  0


So if you received the drive identifier of "disk0s2", you would replace "diskXsY" in the template command making it into this:

diskutil  ap  resizeContainer  disk0s2  0



Or, Here is a single line command to perform the operation automatically......it assumes no Fusion Drive and only a single physical internal drive with just one APFS Container and and an item called "(free space)":

drive="$(diskutil  list  internal  |  grep  'Apple_APFS'  |  awk  '{print $NF}')"; diskutil  ap  resizeContainer  $drive  0


Everything must be typed exactly or you may get unexpected & unintended results. The last character is a zero. I tested the command on a .dmg file I created to simulate a single physical drive system with an APFS Container and "(free space)" such as after deleting the Windows Bootcamp partition.


If you have a Fusion Drive setup or multiple internal drives, then we will need the output of the following command in order to modify the instructions for you:

diskutil  list  internal



Similar questions

10 replies
Question marked as Top-ranking reply

Jun 15, 2024 7:01 PM in response to El Paso Steve

Ok, I found a little bit of time to experiment.


First you need to get the proper disk identifier for the APFS Container of your macOS installation. I'm assuming you do not have a Fusion Drive since that may change things. Assuming you have only a single internal drive holding macOS, then you can get the drive identifier of the hidden APFS Container by using the following Terminal command:

diskutil  list  internal  |  grep  'Apple_APFS'  |  awk  '{print $NF}'


This will give you a drive identifier in the form of "diskXsY", such as "disk0s2".


You will use the drive identifier you got from the last command in the next command....here is the template (the last character is the number zero):

diskutil  ap  resizeContainer  diskXsY  0


So if you received the drive identifier of "disk0s2", you would replace "diskXsY" in the template command making it into this:

diskutil  ap  resizeContainer  disk0s2  0



Or, Here is a single line command to perform the operation automatically......it assumes no Fusion Drive and only a single physical internal drive with just one APFS Container and and an item called "(free space)":

drive="$(diskutil  list  internal  |  grep  'Apple_APFS'  |  awk  '{print $NF}')"; diskutil  ap  resizeContainer  $drive  0


Everything must be typed exactly or you may get unexpected & unintended results. The last character is a zero. I tested the command on a .dmg file I created to simulate a single physical drive system with an APFS Container and "(free space)" such as after deleting the Windows Bootcamp partition.


If you have a Fusion Drive setup or multiple internal drives, then we will need the output of the following command in order to modify the instructions for you:

diskutil  list  internal



Jun 20, 2024 12:50 PM in response to El Paso Steve

Thanks for providing that information. You do indeed have a Fusion Drive setup.


Before doing anything else, make sure you have a good backup of your data on the macOS DATA volume since any commands to manipulate the partitions on the drive could go awry & cause you to lose access to the internal Data volume & may make your main OS installation unbootable.


You will need to reference the hard drive portion of the Fusion Drive which is the one located on the 2TB internal drive. At the time you ran the "diskutil list internal" command, the identifier required for the resize command is "disk1s2" since that is the identifier for the APFS Container directly ahead of the "(free space)" item. Make sure you confirm this identifier before running the following command to attempt to merge the "(free space)" item into the APFS_Container located on the 2TB hard drive (replace "disk1s2" with the current identifier if it has changed since the last time):

diskutil  ap  resizeContainer  disk1s2  0


Unfortunately the other "automated" option to identify & resize won't work here because you have two physical internal drives with APFS Containers & I'm not sure of a simple method of filtering for the proper one.....especially for a simple single command. As long as you confirm the identifier for the APFS Container on the 2TB internal drive and use that value in place of "disk1s2" in my example, then it should work.

Jun 21, 2024 9:38 AM in response to El Paso Steve

I would try booting into Recovery Mode (Command + R) to run Disk Utility First Aid on the Fusion Drive item and on the hidden APFS Container. Within Disk Utility you will need to click "View" and select "Show All Devices" before the hidden Container appears on the left pane of Disk Utility. Even if First Aid says everything is "Ok", click "Show Details" and scroll through the report to see if any unfixed errors are listed. If so, then run First Aid again until the errors are gone. If the errors remain even after several attempts, then they cannot be repaired. Those errors are may be the problem. In that case, you would need to perform a clean install of macOS by first erasing the Fusion Drive followed by reinstalling macOS & restoring from a backup.


If First Aid is able to repair the errors, then you can try the resize option again while still booted into Recovery Mode. The Terminal app can be found on the "Utilities" menu on the menu bar....you will first need to quit the Disk Utility app to return to the main recovery mode screen. Remember to confirm the drive identifier for the APFS Container located on the 2TB drive before trying to resize it.


Another possibility is the hard drive portion of the Fusion Drive is failing. You can try running the Apple Diagnostics to see if any hardware issues are detected, however, it is unlikely it will detect anything other than the most severe issues. You can check the health of the drives while booted into macOS by running the third party app DriveDx (free trial period) and posting the complete text report for each internal drive (SSD & Hard Drive....especially the HD) by using the "Additional Text" icon which looks like a piece of paper on the forum editing toolbar.

Jun 14, 2024 6:35 PM in response to El Paso Steve

Unfortunately if Bootcamp Assistant did not proper re-merge the Windows Bootcamp partition back into the main Apple partition/Container, then you will need to start completely over by performing a clean install of macOS by first erasing the whole drive (or Fusion Drive item if so equipped) followed by reinstalling macOS & restoring from a backup.


While Disk Utility should technically & theoretically be able to re-merge the "free space area", unfortunately in the real world this just does not seem to happen (Disk Utility is not a very good app).


If you are familiar with the command line, then you may be able to use the "diskutil" command to merge the "free space area" into the main partition/Container (or Fusion Drive). I don't know the proper options to use. I do know another user I was assisting did provide the proper command & options several years ago (they corrected my suggestion since I didn't get it quite right), but I don't recall the specifics now. I don't the time or a spare drive to experiment.

Jun 21, 2024 5:45 PM in response to HWTech

I booted in Recovery Mode; when operating the First Aid, the details were OK except for:


Checking the snapshot metadata.


Checking the fsroot tree.


Checking the extent ref tree.


Verifying volume object map space.


The volume /dev/rdisk4s6 appears to be OK.


Verifying allocated space.


warning: MT mapping (0x400000199b9db -> 0x1991bac, 1, C) is not completely referenced


warning: MT mapping (0x40000032d5Obb -> 0x125d5d, 1, C) is not completely referenced


warning: MT mapping (0x40000183725c8 -> 0x168ad6e, 1, C) is not completely referenced


warning: MT mapping (0x400001c32335a -> 0x1bd7c54, 1, C) is not completely referenced


The container /dev/disk02 appears to be OK.

Jun 22, 2024 7:30 PM in response to El Paso Steve

It seems like the hard drive may have some issues with the write head flying too high & causing errors, otherwise the drives appear Ok.


If you ran First Aid multiple times and those errors remain, then First Aid is unable to fix them. It is certainly possible those "Warnings" may be preventing the merging of the free space section to the APFS Container. If those errors/warnings are associated with an AFPS snapshot, then once the snapshot is deleted those errors/warnings should also go away. It the snapshot is associated with a Time Machine backup or other backup, then you can try deleting the particular snapshot if the backup has already been successfully transferred to external media. If the snapshot is related to the OS "update" volume, then once the next OS update (perhaps even software update) has been installed which requires a system reboot, then that OS related snapshot should be gone as well. I guess you could try deleting the APFS snapshot even if it is related to the OS update (no idea whether macOS will allow it). Otherwise you will need to start completely over by first erasing the Fusion Drive followed by reinstalling macOS & restoring from a backup.


View APFS snapshots in Disk Utility on Mac - Apple Support

Jun 20, 2024 10:31 AM in response to HWTech

Thank you again for taking the time to help me. I thought that I also had a Fusion drive, but may have deleted some Fusion files while trying to free up file space :(


Here are the results from the command you provided;


Last login: Thu Jun 20 10:27:43 on ttys000




The default interactive shell is now zsh.


To update your account to use zsh, please run `chsh -s /bin/zsh`.


For more details, please visit https://support.apple.com/kb/HT208050.


Stevens-iMac:~ Steve$ diskutil  list  internal


/dev/disk0 (internal, physical):


   #:                       TYPE NAME                    SIZE       IDENTIFIER


   0:      GUID_partition_scheme                        *121.3 GB   disk0


   1:                        EFI EFI                     314.6 MB   disk0s1


   2:                 Apple_APFS Container disk2         121.0 GB   disk0s2




/dev/disk1 (internal, physical):


   #:                       TYPE NAME                    SIZE       IDENTIFIER


   0:      GUID_partition_scheme                        *2.0 TB     disk1


   1:                        EFI EFI                     209.7 MB   disk1s1


   2:                 Apple_APFS Container disk2         2.0 TB     disk1s2


                    (free space)                         39.5 GB    -




/dev/disk2 (synthesized):


   #:                       TYPE NAME                    SIZE       IDENTIFIER


   0:      APFS Container Scheme -                      +2.1 TB     disk2


                                 Physical Stores disk0s2, disk1s2


   1:                APFS Volume Macintosh HD - Data     1.9 TB     disk2s1


   2:                APFS Volume Preboot                 2.1 GB     disk2s2


   3:                APFS Volume Recovery                1.2 GB     disk2s3


   4:                APFS Volume VM                      3.2 GB     disk2s4


   5:                APFS Volume Macintosh HD            9.4 GB     disk2s5


   6:              APFS Snapshot com.apple.os.update-... 9.4 GB     disk2s5s1


Jun 21, 2024 7:40 AM in response to HWTech

When the process closed, it reported an error (Error: -69606: A problem occurred while resizing APFS Container structures) and did not complete the expected results. Any other suggestions? Maybe I should restart with a fresh OS?


Stevens-iMac:~ Steve$ diskutil ap resizeContainer disk1s2 0


Started APFS operation


Aligning grow delta to 39,538,724,864 bytes and targeting a new container size of 2,000,189,177,856 bytes


Determined the maximum size for the APFS Container to be 2,000,188,149,760 bytes


Resizing APFS Container designated by APFS Container Reference disk2


The specific APFS Physical Store being resized is disk1s2


Verifying storage system


Using live mode


Performing fsck_apfs -n -x -l /dev/disk0s2


Checking the container superblock


Checking the fusion superblock


Checking the EFI jumpstart record


Checking the space manager


Checking the space manager free queue trees


Checking the object map


Checking the Fusion data structures


Checking the encryption key structures


Checking volume /dev/rdisk2s1


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking snapshot 1 of 24 (com.apple.TimeMachine.2024-06-19-165701.local)


.....


Checking snapshot 24 of 24 (com.apple.TimeMachine.2024-06-20-165109.local)


Checking the document ID tree


Checking the fsroot tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s1 appears to be OK


Checking volume /dev/rdisk2s2


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking the fsroot tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s2 appears to be OK


Checking volume /dev/rdisk2s3


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking the fsroot tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s3 appears to be OK


Checking volume /dev/rdisk2s4


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking the fsroot tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s4 appears to be OK


Checking volume /dev/rdisk2s5


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking snapshot 1 of 1 (com.apple.os.update-8E533348C19ECF47E7D72F637615632C75A1146D89706FDE4B0615ED556B33E2)


Checking the fsroot tree


Checking the file extent tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s5 appears to be OK


Checking volume /dev/rdisk2s6


Checking the APFS volume superblock


Checking the object map


Checking the snapshot metadata tree


Checking the snapshot metadata


Checking the fsroot tree


Checking the extent ref tree


Verifying volume object map space


The volume /dev/rdisk2s6 appears to be OK


Verifying allocated space


warning: MT mapping (0x4000016afde3e -> 0xd2f7e, 1, C) is not completely referenced


warning: MT mapping (0x4000016c158ff -> 0x10e81b1, 1, C) is not completely referenced


The container /dev/disk0s2 appears to be OK


Storage system check exit code is 0


Growing APFS Physical Store disk1s2 from 1,960,650,452,992 to 2,000,189,177,856 bytes


Modifying partition map


Growing APFS data structures


APFS Container Resize error code is 49174


A problem occurred; undoing all changes


Modifying partition map


Error: -69606: A problem occurred while resizing APFS Container structures


Stevens-iMac:~ Steve$ 

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

The target disk is too small for this operation, possibly due to partition map limits. : (-69519)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.