Hard Drive Partition Error – The Given Partitions Are Not on the Same Whole Disk

bootcampdisk-utilityhard drivemacospartition

I recently erased my bootcamp partition through Disk Utility. I couldn't use Boot Camp Assistant and got the following error:

The startup disk must be formatted as a single Mac OS Extended
(Journaled) volume or already partitioned by Boot Camp Assistant for
installing Windows.

I erased the partition and not it's empty. I am trying to merge it with my mac OS partition so I can get all my space back but now I am getting this error in the terminal

The given partitions are not on the same whole disk

when I use

diskutil mergePartitions JHFS+ ODMac disk0s2 disk1

How can I get my storage back fully on my MacBook Air?

Here is my diskutil list output:

    /dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage APPLE SSD SMO128G Media 60.4 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                  Apple_HFS                         2.2 GB     disk0s4

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS APPLE SSD SMO128G M... +60.0 GB    disk1
                                 Logical Volume on disk0s2
                                 4A71281B-ECA8-40E1-A9D3-047D036A0788
                                 Unlocked Encrypted

GPT values:

      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  117891928      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  118301568    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  119571104    4320197      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  123891301  113086842         
  236978143         32         Sec GPT table
  236978175          1         Sec GPT header

Best Answer

You have a 2.2 GB partition (disk0s4) on your drive. I am not sure this partition is even formatted. It is also possible the partition is not mounted. If not mounted, then the partition will not show up in the Finder. Anyway, this partition needs to be deleted before you can recover your missing free space.

The command below will delete this partition.

diskutil  eraseVolume  free  n  disk0s4

Once the disk0s4 partition is deleted, the next command can be used to recovery your missing free space.

diskutil  cs  resizestack  4A71281B-ECA8-40E1-A9D3-047D036A0788  0