Disk Utility hangs prior to resizing partition

When trying to shrink the size of a partition, the period before the actual resizing happens (where Disk Utility says "Preparing to partition disk") hangs forever. I dug into Console to see what was going on and I came across this error, which is 100% reproducible for me as soon as I click "Apply" to resize the partition:

8/1/14 8:48:48.299 AM Disk Utility[631]: *** setObjectForKey: object cannot be nil (key: FilesystemName)
8/1/14 8:48:48.301 AM Disk Utility[631]: (
    0   CoreFoundation                      0x00007fff879eb25c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff82c08e75 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff878e622e -[__NSDictionaryM setObject:forKey:] + 1102
    3   Partition                           0x000000010681cdcc Partition + 110028
    4   Partition                           0x0000000106814883 Partition + 75907
    5   AppKit                              0x00007fff8834c06d -[NSAlert didEndAlert:returnCode:contextInfo:] + 90
    6   AppKit                              0x00007fff8834ba9a -[NSWindow endSheet:returnCode:] + 368
    7   AppKit                              0x00007fff8834b66d -[NSAlert buttonPressed:] + 107
    8   AppKit                              0x00007fff88210260 -[NSApplication sendAction:to:from:] + 327
    9   AppKit                              0x00007fff882100de -[NSControl sendAction:to:] + 86
    10  AppKit                              0x00007fff8825cc4d -[NSCell _sendActionFrom:] + 128
    11  AppKit                              0x00007fff88276655 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2316
    12  AppKit                              0x00007fff88275a27 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 487
    13  AppKit                              0x00007fff8827513d -[NSControl mouseDown:] + 706
    14  AppKit                              0x00007fff881f6a58 -[NSWindow sendEvent:] + 11296
    15  AppKit                              0x00007fff881955d4 -[NSApplication sendEvent:] + 2021
    16  AppKit                              0x00007fff87fe59f9 -[NSApplication run] + 646
    17  AppKit                              0x00007fff87fd0783 NSApplicationMain + 940
    18  Disk Utility                        0x0000000100e18867 Disk Utility + 6247
    19  libdyld.dylib                       0x00007fff8496a5fd start + 1
    20  ???                                 0x0000000000000001 0x0 + 1
)

I found this link which describes pretty much the same issue, but does not contain any useful suggestions for workarounds.

In case it is helpful, here is an image of Disk Utility at that moment. Note that I am dual-booting Mac OS and Ubuntu -- I assume the reason the FilesystemName is nil is the same reason that the ext4 Ubuntu partition shows up as disk0s4.

Disk Utility hanging prior to performing partition shrink

Note: This is on 10.9.4 (Mavericks).


Solution 1:

Yeah I do encounter this problem sometimes also, but I don't know why is it happening. For some verifying and repairing solves the problem, but for those that doesn't get solved, the command line tool diskutil often does the job.

You can just use

diskutil resizeVolume $1 $2

where

  • $1 is the Mount Point or Disk Identifier or Device Node of the disk you are trying to resize (obtained with diskutil list).
  • $2 is the size in decimal with suffix of B, S(512 byte blocks), K, M, G, T, P, or percentage of the current size(%).

e.g. diskutil resizeVolume disk0s6 100G will resize the volume disk0s6 to 100 GB.

Solution 2:

If your end goal is to repartition, given that you can't in OSX, I'd try a linux livecd using gparted.

Something like this: gparted tutorial

You can boot your mac with a linux live USB key and use gparted to repartition, then boot back into OSX.