2

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
  • @klanomath Yes... one second – user2544765 Oct 24 '16 at 21:36
  • @klanomath I added the diskutil list output. Can you let me know what to do with gpt? – user2544765 Oct 24 '16 at 21:38
  • @klanomath there you go – user2544765 Oct 24 '16 at 22:00
  • The Sec GPT header and table are missing in the output - did you forget to copy them or are they absent? Usually they are in the last 33 blocks of a disk! – klanomath Oct 24 '16 at 22:03
  • 1
    @user2544765, Then I'd either make a .dmg image of the entire 120 GB drive and restore it to the new drive or use Carbon Copy Cloner to clone it. dd is not necessarily a good way to go in this case. – user3439894 Oct 24 '16 at 22:44
1

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.

  • Will this lose data if I don't back up? Only reason I ask is because I won't bother with a backup since I have all of the data already. – user2544765 Oct 24 '16 at 22:49
  • I ran into an issue with my solution and tried yours... it keeps saying that I can't unmount the disk because at least one volume could not be unmounted. forced gives me the same answer – user2544765 Oct 24 '16 at 23:25
  • No... that did fail. it appears that the computer is booting from the recovery partition rather than Internet recovery. is there a way to force Internet recovery – user2544765 Oct 24 '16 at 23:31
  • Let us continue this discussion in chat. – klanomath Oct 24 '16 at 23:32
  • Accepting because ultimately this answer led me to my particular solution, which was using everything in this answer except by doing it through a hard drive enclosure and booting from the other drive. – user2544765 Oct 25 '16 at 20:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .