Skip to content

Instantly share code, notes, and snippets.

@davidmoffitt
Created March 27, 2011 04:18
Show Gist options
  • Save davidmoffitt/888909 to your computer and use it in GitHub Desktop.
Save davidmoffitt/888909 to your computer and use it in GitHub Desktop.
Expanding RAID & Partitions on Mac
Taken from http://blog.scottmroberts.com/archives/15 - mad props to the original author!!
IMPORTANT NOTE:The following procedures are ONLY for people with RAID cards who have upsized their raid array. If you have a MacBook or MacBook Pro, this is not for you! If you want to move from a smaller single drive to a larger single drive, try CarbonCopyCloner or SuperDuper .Once my raid array had finished upsizing from 5.5GB to 9.1GB, I had to resize the partition in order to actually use the space. OS X’s Disk Utility gives the oh so friendly error Partition Failed (Partition failed with the error: MediaKit reports partition (map) too small. ) Not particularly helpful, is it. All my googling has never found an answer, so I thought I’d post my solution here.
Open up a terminal
run ‘df’
Note the mount point for the drive you’re trying to expand. Mine was “/dev/disk4s1″. We’re only interested in the disk, not the slice, so I’m going to use “/dev/disk4″.
In Disk Utility, unmount the current partition on the disk.
run “sudo gpt show /dev/disk4″. If this fails, you probably didn’t unmount the partition first.gpt show /dev/disk4
The line with the largest size is the partition we care about.
In Disk Utility, unmount the partition again.
run “sudo gpt destroy /dev/disk4″
run “sudo gpt create -f /dev/disk4″
run “sudo gpt add -b 409640 -s 11719262168 /dev/disk4″. Notice those numbers came from the start and length of the partition we want to save.gpt destroy/create/add
Reboot.
Now use Disk Utility to resize the partition. If you didn’t reboot, Disk Utility will probably give an error, but it might still work. Reboot now anyways.
Basically what’s going on here is that the GPT table is built only big enough for the drive it’s on. That’s a logical assumption - hard drives don’t magically get larger - unless they’re RAID arrays. We’re just removing the GPT partition information, and replacing it. Should things go crazy, as long as you’ve got the start and size information for the partition you care about, you should be good. No guarantees obviously, but I’ve done this three times and no data loss yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment