Partition cloned disk I cloned a disk with dd on linux and want to be able to use the entire disk, but I'm not sure how as I don't think the OS is recognizing the free space that is unpartitioned. In Disk Utility, I can't select a size larger than 120GB (the size of my old SSD) despite the new one being 250GB.

diskutil list output:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            119.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3


sudo gpt -r show disk0 output:

      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  232762432      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  233172072    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  234441608  253955560
Your GUID partition table lacks its backup part: the second GPT header and table.

Your gpt output should look like this:

      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  232762432      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  233172072    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  234441608  253955527
  488397135         32         Sec GPT table
  488397167          1         Sec GPT header


To repair this you have to recreate a new complete GUID partition table.



Preparation:


Backup your current Mac
Detach any external drive (especially your external Time Machine backup drive)
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 El Capitan or Sierra) or a thumb drive containing a full system (preferably El Capitan or Sierra).


Repair partition table


Open in the menubar Utilities > Terminal and get an overview:

diskutil list


You will presented with at least 13 disks. Choose the disk identifier of your internal 250 GB disk. Usually this is either disk0 or disk1. Below I assume it's disk0 - use the disk identifier you have found in your environment in the commands below.
Verify/repair the main disk/main volume:

diskutil verifyDisk disk0
diskutil verifyVolume disk0s2


If the disk/volume requires repair use the same commands but replace the prefix verify by repair (e.g. repairDisk) 
Get the partition table:

gpt -r show /dev/disk0

To modify the partition table of a disk, you have to unmount the main volume and the disk:

diskutil umount disk0s2
diskutil umountDisk /dev/disk0

destroy your current pt and create a new one:

gpt destroy /dev/disk0 
gpt create -f /dev/disk0

add all previous partitions (as listed in the gpt list):

gpt add -i 1 -b 40 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
gpt add -i 3 -b 233172072 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0
gpt add -i 2 -b 409640 -s 232762432 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0

check that the secondary header and table exist:

gpt -r show /dev/disk0



Resize your main partition


Check if the disk identifier is the same:

diskutil list

Verify/repair the main disk/main volume:

diskutil verifyDisk disk0
diskutil verifyVolume disk0s2


If the disk/volume requires repair use the same commands but replace the prefix verify by repair (e.g. repairDisk)
Resize the second partition with diskutil:

diskutil resizeVolume disk0s2 100%

Verify the resized volume/disk again.


Enter exit and quit Terminal. Reboot to your main volume.