Expanding RAID & Partitions on Mac

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.

  1. First thing – if you have the ability to, backup your data. Or at least back up your most critical data.
  2. If you have DiskWarrior, run it. You definitely want to take care of any potential problems before you go mucking around with your drive. If you don’t have DiskWarrior, at least run fsck or Disk Utility repair. DiskWarrior is only $99.95 and I know it’s saved my data a few times. (Side note: I personally do not trust DiskWarrior’s overlapping file repair mechanism. I have no way of proving it, but I believe that DiskWarrior fubar’d my overflow extents (the mechanism hfs uses to keep track of file fragments for files with over 8 fragments). As long as you keep 10%ish free on your volume, overlapping files should not ever be an issue. Don’t let this stop you from running DiskWarrior. I know of no other tool that works as well, and they’ll do whatever they can to help you out if DiskWarrior is stumped by problems with your disk).
  3.  Open up a terminal
  4. run ‘df’
  5. 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″.
  6. In Disk Utility, unmount the current partition on the disk.
  7. run “sudo gpt show /dev/disk4″. If this fails, you probably didn’t unmount the partition first.gpt show /dev/disk4
  8. The line with the largest size is the partition we care about.
  9. In Disk Utility, unmount the partition again.
  10. run “sudo gpt destroy /dev/disk4″
  11. run “sudo gpt create -f /dev/disk4″
  12. 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
  13. Reboot.
  14. Make sure you have rebooted! If you don’t reboot, I can almost guarantee that bad bad things will happen.
  15. Now use Disk Utility to resize the partition.. Reboot now.

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.

25 Responses to “Expanding RAID & Partitions on Mac”

  1. Todd says:

    Life as I know it is a whole lot better now!

    These instructions posted by Scott are excellent! I highly recommend it over anything else to quickly fix the problem as described.

    I searched the web and couldn’t find much until I saw his post in Google. First glance it seemed complicated but then I just followed his steps one by one and it was actually very easy!

    Scott – Thanks for putting this up.
    You made my day a lot better!

    Todd

  2. Todd says:

    Hi Scott -

    As mentioned in my first comment, I had no problem on one RAID 5 system. However, today in trying your instructions with a RAID 6 volume it doesn’t come back with any GPT information. So, I can’t destroy anything.

    Another words… when doing step 3 above this is what is reported…
    start size index contents
    0 19531243520

    That’s it. No PRI GPT info…

    Disk Warrior shows no errors on the drive. Disk First Aid verifies it fine as well. It was expanded from 6TB to 10TB. It’s an Areca 1680 card.

    Have any ideas what I can do?

    Thanks,
    Todd

  3. Todd says:

    I think I just discovered my problem. It’s a guess as I don’t know enough about it. Looks like it is formatted for Apple Partition Map instead of GUD. If that’s the reason, guess I’ll have to erase, format at GUD and copy back from the mirror.

    Todd

  4. Nick says:

    I can’t thank you enough for this. I use a PromiseRAID with an xserve. I bought the half-loaded version with around 4TB in it. Once I migrated in new drives, the PromiseRAID saw the added drives. However, I had to fully eject, unplug, wait 60 seconds, and then plug back in and mount for the OS to see that the RAID was bigger. This did not, however, fix the problem that you have fixed here. I was still unable to expand the partition via CL or the disk utility UI.

    I have an Apple Tech rep who could not tell me what the problem is. In fact kept telling me that the Apple documentation and diskutil function should work. I was extremely frustrated because the Promise system was officially supported by Apple and was the biggest reason I did not go with a cheaper system.

    I will be forwarding this fix to my rep with the hopes something like this will be included in a future Mac OS Server update. Hopefully you get some credit considering you are the only person on the entire inter-tubes with a fix…

    Once again, thank you.

    Nick.

  5. James says:

    Diskutil is still modifying the partition map as I write this… but I just have to say “thanks.” This is terribly useful and should be posted all over the net as a useful and easy way to migrate up a raid 5 system.

    @todd – a day late and a dollar short, but I got the same response from show gpt Todd when I added the disk slice. /dev/disk7s4. The ‘s4″ part made it go wonky and return the whole volume info with no gpt info. Then I re read the instructions and did a rectal cranial inversion and got it working. Well, theoretically… diskutil is still thinking as I write this. IT did, however save me from having to move 3 TB around my system.

    Thanks Scott. Well done.

    -James

  6. Felipe says:

    Thanks for this! I was having problema resizing
    partitions after removing a Linux install.
    I don’t have RAID but this worked just fine.

  7. Jon Hunwick says:

    Scott, Thanks so much for this!

    I took a bit of a calculated risk building a DIY RAID, and thanks to your post I have no worries about any aspect of the array now.

    I am running a RocketRaid 3540, I expanded to 7.5TB but was unable to find anywhere or anyone who had successfully expanded using this card under MAC OS X. even Highpoint said it was unsupported under OS X… so after the 4 days it took to expand the drive i am very grateful to find your post!

    Thanks again!

    Jon

  8. Tony says:

    This worked without a problem. Thanks so much for the info.

  9. Thank you so much.

    We were bashing our head after adding tonnes of disc to our iSCSI array and this brilliant.

    Thanks again. Worked a Treat.

    de VK3IVY aka Ivy =)

  10. Rasmus Lauridsen says:

    Hi Scott

    Just wanted to thank you for this little nugget. Had an iSCSI disk on a linux logical volume that resized ok but I got the horrible “MediaKit reports partition (map) too small.” error. This was a nice easy fix and really should be ranked over the multitude of redo partition solutions on google.

    So thanks ALOT

  11. joao says:

    I just did it on a AXUS RAID 6 on Mac OS X Server 10.5.8 and this works!
    Thanks Thanks Thanks for this !
    regards

  12. Juan Sibila says:

    This solution rocks! I was able to extend our iSCSI volume, finally. I’ve printed it to PDF and added it to our internal Kbase at my work. Thank you.

  13. Tri Tran says:

    I too must thank you for this invaluable advise. Neither Apple or the raid card manufacturer could help me without erasing my existing 2 TB RAID5. That was a non-starter. Thanks again.

  14. Junjun Mao says:

    I migrated RAID10 to RAID6 on a Promise Storage Array and read manual page of diskutil to confirm the HFS+ Volume could be resized to include “free space” before starting the job. Yet I got stuck at claiming the newly created disk space. Thanks to this post. It really works!

  15. Nate says:

    This just saved me a lot. Thanks!

  16. Joe T. says:

    Just wanted to say thanks for sharing this info with the world. Just fixed my problem.

  17. Amos says:

    Thank you so much. Spent a few hours googling before finding this. I have an iSCSI target on ubuntu (using LVM2 and RAID) which I *reduced* from 3TB to 1.6TB and diskutil was able to shrink the volume just fine. Then when I enlarged it to 6TB later, diskutil resizeVolume was failing with the partition map too small 9939 error. I tried running it with limits and it showed 3TB. I guessed what was happening but didn’t know how to fix it until finding your post. Thanks very much!

  18. Hans says:

    Thank you a lot, this solved my problem with increasing the disk size for my Virtualbox OS X installation.

  19. Rob says:

    Brilliant hint!
    I dont’ have a RAID running, but had a diskimage that I wanted to expand.
    After resizing the diskimage, I was not able to resize the volume on the diskimage, with the same ‘partition (map) too small’ error.
    I fixed this using your hint, so thanks!

    One note: because the diskimage had two partitions, one EFI partition and one HFS+ partition, I had to re-add the EFI partition with the extra option -t, specifying the partition type (apparently, Apple_HFS is the default type, so for ‘normal’ partitions this is not needed)
    For the EFI partition I had to use:
    sudo gpt add -b [value] -s [value] -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk[value].
    Here, C12A7328-F81F-11D2-BA4B-00A0C93EC93B is the GUID for an EFI partition.
    (whereas 48465300-0000-11AA-AA11-00306543ECAC is the GUID for a ‘normal’ Apple_HFS partition)

    Once again, thanks a lot!

  20. I just want to say thank you for this post, it was a real life-saver when expanding the array in one of our graphic designers’ Mac pros!!

  21. sslaterr says:

    OMG – it works!! Thank you!

    I’m still a bit jittery though, you know how it goes when you do stuff to your computer that you don’t have the pay grade for!

    BTW, i’m running a RAID 6 array, so to the previous poster – it does work.

    Thanks again! :)

  22. yo says:

    You fucking rock, man. Thank you!

  23. Matt Hohman says:

    This blog post has saved my bacon twice over the last couple years. Always stressful expanding a 16 TeraByte array with live user data… Especially the destroy command, it sounds so final.

    Thanks Again!,
    Matt

  24. bRad says:

    Thank you! Worked like a charm on my EVGA Classified SR-2 Hackintosh with Areca 1680 RAID-6 5TB array.

    Would have been stuck without this–thank you again!!

  25. mMalo says:

    Well 2012 is here and yours instructions are still used. Thanks a lot

Leave a Reply

You must be logged in to post a comment.