Resizing system partition
When I installed OSX Mavericks, I left free space after my system partition in case I wanted to install a second OS there. This has proved unnecessary — I've never modified the partition table — and I'd like to integrate that space into my system
partition.
In theory, this can be done quite easily with Disk Utility. However, this does not seem to work for me. When I select the Partition tab for the drive in Disk Utility, I see a small unnamed partition at the top, followed by my system partition, followed by blank space. There is a pull-tab at the bottom right of the system
partition. I can pull that tab down to fill the empty space with the system
partition. However, when I hit Apply
and confirm, the message "Preparing to partition disk" shows up next to a barber-pole wait indicator and never goes away.
Answers to other questions suggest that this issue can be resolved by running Verify
and Repair
on both the system partition and the drive on which it is located. Verify
on the partition shows no errors; Verify
on the drive indicates that it doesn't have an EFI partition — a problem which Repair
proves unable to fix.
Running $ diskutil list
from the command line reveals the following partitions:
- 0: The GPT
- 1: The small partition is labeled
Microsoft Reserved
; I gather that this is set up by OSX install to facilitate possible later Boot Camp installation. - 2: There is an EFI partition (!) located between the
Microsoft Reserved
partition and thesystem
partition - 3:
system
partition - 4: Recovery partition
diskutil
doesn't explicitly indicate the location of these partitions, so I installed the brew
package gptfdisk
and ran sgdisk -p
, which confirmed that the Recovery partition is located direction after system
.
SO: My hypothesis is that Disk Utility is unable to grow the system
partition because there is a partition immediately following it. If this is the case, I'm confused as to why the OSX installer would put it there instead of at the end of the disk. But anyway: if this is really the issue, what's the easiest, and preferably free, way to move it to the end of the disk? I could use dd
to get it there, but I'm unaware of any tools that can reliably edit the partition table. (sgdisk
could do this, but the brew
version is 0.8.something, so I don't really trust it.)
Are there any special things I need to keep in mind when changing the partition table? There seems to be something wrong with it already (given the EFI issue).
It's looking like I'll need to set up a rescue boot disk, so recommendations on those are gladly accepted.
EDIT: Question is a tome already but somebody asked for output so here it is:
$ diskutil list /dev/disk0
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *512.1 GB disk0
1: Microsoft Reserved 134.2 MB disk0s1
2: EFI EFI 209.7 MB disk0s2
3: Apple_HFS system 319.2 GB disk0s3
4: Apple_Boot Recovery HD 650.1 MB disk0s4
$ sudo gpt -r show /dev/disk0
Password:
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 262144 1 GPT part - [GUID REDACTED]
262178 2014
264192 409600 2 GPT part - [GUID REDACTED]
673792 623464448 3 GPT part - [GUID REDACTED]
624138240 1269760 4 GPT part - [GUID REDACTED]
625408000 374807183
1000215183 32 Sec GPT table
1000215215 1 Sec GPT header
$ sudo fdisk /dev/disk0
Disk: /dev/disk0 geometry: 62260/255/63 [1000215216 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 1000215215] <Unknown ID>
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Solution 1:
I ended up setting up an Ubuntu USB boot drive, rebooting into Ubuntu, and using gparted
to write a new partition table that changed the partition type of the Microsoft Recovery
to ext4 and named it. I also formatted that partition to ext4.
After rebooting back into my OSX install, I was able to resize the system
partition. Yay!