Disk Utility – Resize Second Partition After Removing First Partition

disk-utilitypartition

Mac Mini running Sierra.

I have a 500GB internal drive, that was partitioned into two volumes because at one point I wanted to test upgrading from Mavericks to Sierra but wanted to make sure everything worked before I would commit to it. Everything has been working for a long time now so I'd like to remove the "old" system and reclaim that space.

My Diskutil List showed both drives and their corresponding Recovery HD partitions. I did a diskutil erasevolume on both the old system volume, and the old recovery HD. They are now gone, and all that's left is my Sierra volume and its recovery HD. But now I can't get the Mac to allow me to reclaim the old partition's space.

Here is my current diskutil list:

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

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *8.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS TM iMac                 8.0 TB     disk2s2

I've tried diskutil resizevolume but every time I do I just get The new size must be different than the existing size despite specifying a different (larger) target size.

Additionally, in Disk Utility I cannot create a new additional partition anymore, as DU seems to think the entire available space is now only the 250GB of my Sierra partition. Creating a new partition only eats into my 250GB partition's space.

How can I reclaim the missing half of my hard disk?

Best Answer

I assume, to added Sierra, you shrunk the Mavericks volume and created the "Macintosh HD" volume for Sierra. Installing Sierra created the "Recovery HD" volume. When you deleted Maverick you created free space above the Sierra volume. You can not add this free space back to the Sierra volume. You can only add free space if the space is directly below an existing HFS, Core Storage or APFS volume.

If you want to confirm where the free space is, then here are a few ways:

  1. The sudo gpt -r show /dev/disk0 command will show the logical sector blocks used by each partition. The command will also show the free space between each partition in logical sector block units. In the days of OS X, you could run this command on the boot drives. Starting with macOS, System Integrity Protection (SIP) has to be disabled to do this.
  2. Use the diskutil info -plist disk0s# command to retrieve partition number # start and size byte values. You need to repeat the command for each partition on a drive. Next, you can compile a table similar to the output from the gpt -r show /dev/disk0 command. Basically, free space is any space not allocated to a partition, the Protected Master Boot Record (PMBR) and the GUID Partition Tables (GPT).
  3. Write a BASH script that would automate way number 2. A free script can be downloaded from this site. Assuming your downloads goto to the default Downloads folder, you can get the free space by entering the command shown below. Note: You do not need to enter sudo or disable SIP.

    ~/Downloads/driveinfo-1.0.1/driveinfo -cbestin disk0
    

Frankly, I do not know if driveinfo is compatible with Sierra. If driveinfo is not compatible you will just get an error message saying so.

To reclaim the space, you have a few options:

  1. Backup the Sierra volume using Time Machine or some other method. Erase you internal drive, create a new volume spanning the entire drive, then reload everything.
  2. Use the gpt and newfs_hfs to create and format a new volume above the existing Sierra volume. You could then clone the Sierra volume to this new volume. I could post the steps for this, but I would first need the output from gpt -r show /dev/disk0 or ~/Downloads/driveinfo-1.0.1/driveinfo -cbestin disk0.