0

First of all, I apologize that I cannot remember exactly what version of Mac OS I am running, but I am 99% sure it's Yosemite.

I recently tried to delete a second partition I had been using for a Ubuntu distro. While I was trying to erase the partition, the minus button was grayed out, but I found that if I clicked the minus on the other small partitions (I'm assuming retrospectively that it was the disk utility partition and something else) then I was able to delete the Ubuntu partition, so that's what I did.

So now my hard drive has one partition, disk0s2 with about 900gb and then an extra free space of 99.8gb. The free space can't be partitioned or reconfigured in any way, attempting to do so starts up a progress bar that never gets beyond 'preparing'. disk0s2 is unmounted, the mount button is blue and not grayed out, but clicking it does nothing.

Restarting and running in disk utility mode (I believe that's what it's called, CMD+R), does work, restarting holding OPT shows only the EFI boot, which takes me to GNU Grub version 2.02, which is also what happens when restarting normally. I thought that maybe inserting a USB and downloading Mac OS onto that from the disk utility start up might be a way of solving this problem, but my computer won't mount the USB (the mount button is not grayed out but clicking it does nothing) so it doesn't show up when trying to reinstall the OS.

What should I do? I have access to an external hard drive with enough space to put what was on my hard drive if that is possible, but obviously I would prefer to be able to recreate the disk utility partition (?) and remount disk0s2.

Here is the result of running diskutil in terminal:

enter image description here

7
  • Can you run the command diskutil list and post the results? Where you using encryption? What is the model/year of your Mac? May 1, 2019 at 22:54
  • If you have 99.8 GB of free space, then you don't you boot from the internet and install OS X (macOS) in to the free space? May 1, 2019 at 23:04
  • @DavidAnderson Running that command in GRUB returned that the command 'diskutil' wasn't found. I don't know if I was using encryption, and it's a 2015 macbook pro. It isn't free space inside of a partition, it is literally listed as just "free space", as in non formatted space. It isn't something that can be mounted so when I hit the install option the "select where to install" is blank. As I said in the post, trying to format that free space doesn't get past "preparing" because, I assume, of what I deleted.
    – a00007
    May 1, 2019 at 23:30
  • I assumed when you posted using CMD+R that this booted the Mac from OS X recovery over the internet. You referred to this as "disk utility mode". May 2, 2019 at 0:16
  • @DavidAnderson Yes, I mis-referred to it by a different name. Other than that, I don't see the point of your last comment. As I said above, going to the reinstall page asks you to select where on the hard drive you want to install and it doesn't list anything because nothing is mounted. It doesn't say "click to reinstall" it says "select where you want to reinstall" with nothing listed.
    – a00007
    May 2, 2019 at 0:23

1 Answer 1

1

You should be able to repair you existing partition so you can boot to OS X. The steps are given below. Here, I assume you were using Yosemite or some other version of OS X that installs to a "Mac OS Extended (Journaled)" formatted volume. Also, I assume encryption was not being used.

Note: The examples were made using a disk image while booted to High Sierra. So, your output may vary from what is shown.

  1. Start up the Mac from macOS Recovery over the Internet by restarting and immediately pressing and holding the the key combination ⌘-R.
  2. From the menu bar, select to open a Terminal application window.
  3. Enter the following command to get the GUID Partition Table (GPT) entries.

    gpt -r show /dev/disk0
    

    An example output is shown below.

    $ 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  1757812496      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
      1758222136   194902871         
      1953125007          32         Sec GPT table
      1953125039           1         Sec GPT header
    
  4. Enter the commands given below to change the GPT.

    diskutil unmountdisk /dev/disk0
    gpt remove -i 2 /dev/disk0
    diskutil unmountdisk /dev/disk0
    gpt add -i 2 -b <start> -s <size> -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
    

    Where <start> and <size> are integers taken from the row with index equal to 2 in the table shown in step 2. An example is shown below.

    $ diskutil unmountdisk /dev/disk0
    Unmount of all volumes on disk0 was successful
    $ gpt remove -i 2 /dev/disk0
    /dev/disk0s2 removed
    $ diskutil unmountdisk /dev/disk0
    Unmount of all volumes on disk0 was successful
    $ gpt add -i 2 -b 409640 -s 1757812496 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
    /dev/disk0s2 added
    

    You will need to replace 409640 and 1757812496 with the values shown in your GPT table.

  5. Restart the Mac back to OS X.

  6. Enter the command given below in a Terminal application window to reclaim the free space.

    sudo diskutil resizevolume /dev/disk0s2 R
    

    An example is shown below.

    $ sudo diskutil resizevolume /dev/disk0s2 R
    Resizing to full size (fit to fill)
    Started partitioning on disk0s2 Macintosh HD
    Verifying the disk
    Verifying file system
    Volume was successfully unmounted
    Performing fsck_hfs -fn -x /dev/rdisk0s2
    Checking Journaled HFS Plus volume
    Checking extents overflow file
    Checking catalog file
    Checking multi-linked files
    Checking catalog hierarchy
    Checking extended attributes file
    Checking volume bitmap
    Checking volume information
    The volume Macintosh HD appears to be OK
    File system check exit code is 0
    Restoring the original state found as mounted
    Resizing
    Modifying partition map
    Growing file system
    Finished partitioning on disk0s2 Macintosh HD
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *1.0 TB     disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            999.7 GB   disk0s2
    

Addition Comments

  • Your internal recovery partition no longer exists. When you reinstall OS X or upgrade to a newer OS X or macOS, a new recovery volume will be created.
  • Grub still exists in your EFI partition (disk0s1). You should consider removing Grub.
4
  • Unfortunately this fails at step 5. I followed all the way up until then with no problems but I cannot find a way to restart to OS X. The partition is still unmounted and clicking mount still does nothing (from disk utility), trying to restart from recovery with internet brings up a window that asks what I want to boot into but the options are blank (I'm assuming because disk0s2 is still unmounted), and restarting normally takes me to Grub. Exiting Grub just restarts the computer back into it.
    – a00007
    May 2, 2019 at 18:53
  • Doing up to step 5 did allow me to click the 'verify' button, and doing so said that the partition needed to be repaired. Clicking repair also stopped and said "Disk utility cannot repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed up files." So, fair enough. Do you know if someone has already asked a question on how to do what it is describing or do you think I should ask a new question?
    – a00007
    May 2, 2019 at 19:50
  • Since the value of 48465300-0000-11AA-AA11-00306543ECAC did not work, you are probably using core storage. This means the value should have been 53746F72-6167-11AA-AA11-00306543ECAC. Unfortunately, you deleted the Apple_Boot Boot OS X partition so making this substitution probably will not lead to a bootable operating system. Creating a bootable OS X in the 100 GB of free space would have made it easier to mount this existing volume. May 2, 2019 at 21:09
  • I suppose we should have gone with what I originally proposed. This was to install OS X (macOS) in the 100 GB of free space on the drive. This would have allowed you to boot to an operation system. From there, we could have investigated how to mount the existing volume. We could pursue this if you wish. May 2, 2019 at 21:15

You must log in to answer this question.

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