Missing disk space after repartitioning

disk-spacedisk-utilityhard drivepartition

I tried to make a partition and then tried to undo it. Now, I don't know how to get the missing disk space back.

As you can tell, I have 751.28 GB disk. Macintosh HD and Recovery HD have 557.4 GB. About 180 GB are missing. Where did it go? How do I figure out where it went? Most importantly, how do I fix it?

I ran

diskutil list

and it showed

    0:      GUID_partition_scheme                        *751.3 GB disk0
    1:                        EFI EFI                     209.7 MB   disk0s1
    2:                  Apple_HFS Macintosh HD            556.7 GB   disk0s2
    3:                 Apple_Boot                         650.0 MB   disk0s3
    4:                 Linux Swap                         16.4 GB    disk0s4

enter image description here

Edit:

I ran

   sudo gpt -r show /dev/disk0

Output is:

     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  1087392760      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
1087802400     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
1089071936   344263872         
1433335808    32049152      4  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
1465384960     1954819         
1467339779          32         Sec GPT table
1467339811           1         Sec GPT header

Best Answer

Booted to Internet Recovery Mode you have to remove the swap partition and then resize your main volume.

Preparation:

  • Backup your main volume
  • Restart to Internet Recovery Mode by pressing alt cmd R at startup.

    The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
    On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot into a recovery netboot image which usually is loaded from an Apple/Akamai server.

    I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.

    Alternatively you may start from a bootable installer thumb drive (preferably Yosemite or El Capitan) or a thumb drive containing a full system (preferably Yosemite or El Capitan). If you boot to a full system and login as admin you have to prepend sudo to execute some commands like gpt ... or newfs_hfs ...!

Remove the Linux Swap partition

  • Open in the menubar Utlities->Terminal
  • Enter diskutil list and gpt -r show /dev/disk0 to get an overview
  • Remove the Linux partition:

    diskutil umountDisk /dev/disk0
    gpt remove -i 4 /dev/disk0 
    

Restore the original size of your main volume

  • Resize your main volume:

    diskutil resizeVolume /dev/disk0s2 750g #or 100%
    

    this should also move your Recovery HD to the end of the disk.

  • verify the volume with diskutil verifyVolume disk0s2
  • reboot to your main disk