osx - Mac OS not allowing for disk partition

07
2014-07
  • at least three characters

    I tried adding a disk partition through Disk Utility on a Retina MBP under OS X 10.8.4. It was supposed to be a small, ~20 GB ExFAT partition on a 512 GB disk.

    For some reason, my disk was partitioned into two equal partitions, with one being free space. When I try to remove the free space (either using regular Disk Utility or Disk Utility under recovery mode), the "–" to remove the disk is greyed out, and the "partition layout" dropdown is greyed out, as well. The numerical resize text box for the used partition is greyed out, but the one for the free space can be used, but the changes don't take effect. I tried erasing the disk, but I can only erase individual partitions, so I ended up erasing Macintosh HD (thankfully, I have a backup from before this issue started).

    Finally I tried using diskutil's resizeVolume [volume name] limits to try and resize the volume manually, only to get Error obtaining resizing information (is this a Mac OS 9 compatible "wrapped" HFS volume?)

    How can I get rid of the ~256 GB block of free space on my disk, and expand the primary partition to occupy the entire disk, as it did originally?

    EDIT: After playing around with diskutil, I've found that the disk has a "bad partition map." How can this be fixed?

  • Answers
  • spuder

    To fix a bad partition map do the following

    Backup your data then:

    • Hold the Command and r keys while booting. This will put in in internet recovery mode where you can open disk utility. Run a disk repair.

    or

  • Rod Smith

    Be aware that it's impossible to "remove... free space," as you said you tried to do. In disk partitioning terms, free space is unpartitioned -- that is, it's space that's unallocated. If you remove a partition, the result is free space. Removing free space is logically impossible; it's like trying to empty a bowl that already contains nothing. That said, user interfaces vary and can be confusing, so it could be that you had a partition that you're reporting here as "free space," in which case what I just wrote wouldn't apply to that situation, simply because of miscommunication.

    For a bad partition table, be cautious! Automated tools, such as spuder has recommended, can help; however, they can also sometimes make matters much, much worse. If you know how to do it, you should do a low-level backup of the disk before you do anything more with it; that way, if you dig yourself further into a hole, you'll be able to recover to your current partially-working state.

    You may want to peruse the documentation to my GPT fdisk (gdisk) utility, which covers the basics of GPT data structures. Start with the main page, but be sure to read the page on repairing damaged disks. This type of repair procedure assumes you know more than what an automated repair tool assumes, which can be both good and bad: If you have sufficient knowledge, you may be better able to make a repair; but if you lack such knowledge, you might be even more likely to make matters worse. Reading the Wikipedia page on GPT is also likely to be worthwhile.


  • Related Question

    osx - Mac OS X 10.4: Non-destructively enlarge HFS+ partition
  • elcelista

    I have a MacBook running OS X 10.4.11. Some time ago I shrank my main hard disk partition in order to dual-boot with Linux, but now I am running out of space on the Macintosh partition, and I would like to remove the Linux partition and restore the Macintosh partition to its original size. I have been able to remove the Linux partition, but I cannot seem to merge the free space back into the Macintosh partition. Originally I used GParted to shrink the partition, but I cannot use GParted to restore the partition because GParted is unable to enlarge HFS+ partitions.

    Does anyone know how I can restore my HFS+ partition to its original size without losing my data or spending money on a commercial product?

    If I attempt to use diskutil to resize the partition (while booted from the OS X installation DVD), I get the following:

    # diskutil resizeVolume disk0s2 119690149888B
    Started resizing on disk disk0s2 Macintosh HD
    Verifying
    Resizing encountered error No space left on device (28) on disk

    The 119690149888 bytes value was listed as the maximum size in the output of the command diskutil resizeVolume disk0s2 limits.

    I found other instructions for what I want to do at http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp#Restoring_your_Mac_to_its_original_state, but this requires Boot Camp, which is no longer available for OS X 10.4.

    (This is almost the same problem as question 50317 "Resize HFS Partition", but on Mac OS X 10.4 the Disk Utility application cannot resize partitions non-destructively. When I attempt to re-partition it warns that all data will be lost.)


  • Related Answers
  • Chris Johnsen

    Can GParted rewrite the partition map (delete the linux partition and then resize the remaining HFS+ partition) without trying to enlarge the HFS+ filesystem? If so you might then be able to use diskutil to enlarge the HFS+ filesystem to fit the bounds of the newly grown partition.

    Before trying this (or even using any of the commercial software), you should make sure you have a full backup (that way you can just destructively redo the partition with Disk Utility and restore from your backup—plus get a ‘free’ defrag for your troubles).