I have a fairly old macbook (2016) with a 256Gb hard drive running Catalina 10.15.7 on which I've set up Bootcamp splitting the disk roughly in half at the time.
Recently, I've decided to upgrade to BigSur and found out that I'm out of disk space to do so, the update says that about 25Gb is needed and since I had enough space on Bootcamp for my needs I've partitioned its size to be less, sure enough running into jinxing my APFS partition which is happily answered here on this helpful website :)
That freed up about 35Gb space on the disk, enough for my update, but I now cannot find a way to merge it with the original MacOS container:
I would like to keep both Bootcamp and the existing MacOS intact, just add the free space to the existing 'Macintosh HD' as on the picture above and then proceed with my system upgrade. After browsing some further helpful answers here and here I now realize that this might just be harder than it looks because I don't have free space to clone any of the 2 partitions I want to keep if I go that way, and the sudo diskutil apfs resizeContainer disk0s3 0
does not work for me since the Free Space precedes the MacOS container (there is also a FAT32 container likely related to Bootcamp right at the beginning of the disk) and returns the following error:
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
Free Space is disk0s2
then followed by the MacOS space disk0s3
and finally the Bootcamp space disk0s4
and all together it looks like one big ugly this:
So is it even possible? Will I have to use an external hard drive to clone any of the 2 existing systems out, format, and then clone them back in? Or is there an easier way with some helpful diskutil or gpt commands that I'm not aware of?
Update 1
Output of diskutil list internal
before reclaiming disk space:
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_HFS 36.7 GB disk0s2
3: Apple_APFS Container disk2 111.0 GB disk0s3
4: Microsoft Basic Data BOOTCAMP 102.3 GB disk0s4
5: Windows Recovery 513.8 MB disk0s5
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +36.8 GB disk1
Physical Store disk0s2
/dev/disk2 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +111.0 GB disk2
Physical Store disk0s3
1: APFS Volume Macintosh HD - Data 86.9 GB disk2s1
2: APFS Volume Preboot 81.6 MB disk2s2
3: APFS Volume Recovery 529.0 MB disk2s3
4: APFS Volume VM 1.1 GB disk2s4
5: APFS Volume Macintosh HD 11.3 GB disk2s5
Update 2
After performing all the actions as recommended by David Anderson in the comment section below (use Gparted to move the partitions, then attempt to repair boot with the help of a created-on-mac usb stick image of Windows), I now realized that I've messed up on the move & resize part.
Currently, after successfully reclaiming the free space, the output of diskutil list disk0
is as follows:
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 125.2 GB disk0s2
3: Microsoft Basic Data BOOTCAMP 125.0 GB disk0s3
4: Windows Recovery
However, since I resized the Windows partition manually after moving the Apple container, the return from gdisk64.exe
on the Windows bootable USB stick is the following:
X:\sources>c:\gdisk64.exe 0:
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************
Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.
************************************************************************
Most versions of Windows cannot boot from a GPT disk except on a UEFI-based
computer, and most varieties prior to Vista cannot read GPT disks. Therefore,
you should exit now unless you understand the implications of converting MBR
to GPT or creating a new GPT disk layout!
************************************************************************
Are you SURE you want to continue? (Y/N): y
Command (? for help): x
Expert command (? for help): p
Disk 0:: 61046784 sectors, 29.1 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 6994BC7D-0979-475B-942C-E6A107C02C86
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 61046750
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 61046783 29.1 GiB 0700 Microsoft basic data
Expert command (? for help):
diskutil list internal
?