How to delete original partition

I have a question regarding deletion of partitions on a Mac. Due to some performance issues, I decided to start fresh and created a new partition (NewOSX) on the hard drive, to which I have transferred all the data that I need from my old, original partition (MacintoshHD) along with installing an operating system, downloading apps, etc. I would now like to go ahead and delete the old partition and merge the disk space into my new setup. I know this isn’t as simple as deleting the newer partition would be, as the minus sign in the disk utility partition menu is greyed out.

Here is the info of the two partitions that I am referring to:

Macintosh HD         
Capacity: 119.2 GB        
Used:     47.54 GB         
Device:   disk0s2                     

NewOSX                    
Capacity:  129.35 GB           
Used:      34.69  GB                              
Device:    disk0s4                           

I am wondering if there is (hopefully) a less than super-technical workaround that can accomplish this task. Thank you.

Note: Though there is 47 GB still on the old partition (MacintoshHD), I no longer need anything from it and it is ready to be wiped clean. Also, both partitions are running the “El Capitan” operating system.

diskutil cs list  
No CoreStorage logical volume groups found 

sudo gpt -r show /dev/disk0  
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  232811696      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC  
  233221336    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC  
  234490872  252636720      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC  
  487127592    1269536      5  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC  
  488397128          7           
  488397135         32         Sec GPT table  
  488397167          1         Sec GPT header  

Update

After having some trouble with Internet Recovery Mode and seeing my system crash a few times during reboot, I decided I didn't want to take any risks and mess around with Recovery HDs at all. What I ended up doing was wiping Macintosh HD clean, reinstalling the operating system, and then took a few hours to manually transfer data, redo settings, etc., from NewOSX to Macintosh HD. Then went to disk utility and deleted the NewOSX partition, which of course is a simple procedure. Thanks for the assistance, wish I had realized the simple solution earlier.


Solution 1:

Just because you can, doesn't mean you should.

Why not just back up your data and wipe the entire partition? I suppose if you want to learn how to move things around and you already have a bootable backup that you've tested, the plan of action you propose might be an interesting learning experience.

For anyone that's not sure they can pull off this, Apple posts supported instructions for a wipe and reinstall.

  • https://support.apple.com/kb/PH18869

It uses the Recovery Partition to perform the wipe. If you don't run caching server to keep fast access to the installer you downloaded, you can make a USB bootable drive to do the deed as well.

  • https://support.apple.com/en-us/HT201372

These are supported and designed to avoid human errors. Also, it ensures you get a clean partition table with a supported Recovery HD partition for ongoing maintenance and efficient management of OS X.

Solution 2:

You have several options depending on your resources:

You may either use a Time Machine backup drive/volume (size: at least the used size of NewOSX ~35 GB) or boot to an external disk or Internet Recovery Mode by pressing altcmdR and restore disk disk0s4 to disk0s2.

Requirements:

  • a working Internet Recovery Mode
  • and/or a working Recovery HD
  • and/or external drive

Time Machine method:

  • Boot to NewOSX (disk0s4) and attach a backup drive. Configure Time Machine and exclude Macintosh HD from the backup.
  • After the backup is finished, restart and boot to Internet Recovery Mode by pressing altcmdR
  • Open Disk Utility and reformat the internal disk to one partition, HFS+ Journaled and GUID partition table (check the Options... button for the last one).
  • Quit Disk Utility and open Time Machine (Restore from Time Machine backup)
  • Restore NewOSX to your newly created main partition.
  • When done, reboot to your main volume.
  • You may have to recreate your El Capitan Recovery HD

Migration method:

  • Boot to NewOSX (disk0s4) and attach a backup drive. Configure Time Machine and don't include Macintosh HD in the backup.
  • Erase Macintosh HD with Disk Utility
  • Download El Capitan OS X installer and reinstall El Capitan to the empty volume.
  • Use the Migration Assistant popping up while configuring the new El Capitan install to migrate data from either the Time Machine backup or the old NewOSX.
  • After restoring you have to remove (the old) NewOSX (disk0s4) and the second Recovery Hd (disk0s5).
  • Open Terminal and use gpt to remove the dispensable volumes by entering

    sudo gpt -r show /dev/disk0 #to get the index numbers
    sudo gpt remove -i 4 /dev/disk0
    sudo gpt remove -i 5 /dev/disk0
    quit #to quit Terminal
    
  • Open Disk Utility and expand the visible volume with the slider to the full size. This will expand your main volume (disk0s2) and move the Recovery HD (disk0s3) to the end of the disk.

Restore method 1 (with external drive):

  • Boot to Macintosh HD or NewOSX
  • attach an external drive and create one partition, HFS+ Journaled and GUID partition table
  • Boot to Recovery Mode by pressing cmdR
  • Open Disk Utility and restore NewOSX to the newly created partition on the external disk
  • Boot to the new NewOSX (the old and new NewOSX should have different icons because one of them resides on an external disk)
  • Open Disk Utility and restore the old NewOSX to Macintosh HD
  • After restoring you have to remove (the old) NewOSX (disk0s4) and the second Recovery Hd (disk0s5).
  • Open Terminal and use gpt to remove the volumes by entering

    sudo gpt -r show /dev/disk0 #to get the index numbers
    sudo gpt remove -i 4 /dev/disk0
    sudo gpt remove -i 5 /dev/disk0
    quit #to quit Terminal
    
  • Open Disk Utility and expand the visible volume with the slider to the full size. This will expand your main volume (disk0s2) and move the Recovery HD (disk0s3) to the end of the disk.

Restore method 2 (without external drive):

  • Boot to Internet Recovery Mode by pressing altcmdR
  • Open Disk Utility and restore the content of NewOSX to Macintosh HD
  • After restoring you have to remove (the old) NewOSX (disk0s4) and the second Recovery Hd (disk0s5).
  • Open Terminal and use gpt to remove the volumes by entering

    gpt -r show /dev/disk0 #to get the index numbers
    gpt remove -i 4 /dev/disk0
    gpt remove -i 5 /dev/disk0
    quit #to quit Terminal
    
  • Open Disk Utility and expand the visible volume with the slider to the full size. This will expand your main volume (disk0s2) and move the Recovery HD (disk0s3) to the end of the disk.