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.

34 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. I was having a problem with a VMWare partition (virtual OS X Server) which would not resize in OS X after having resized it in VMWare. This solution, modified to also re-add the EFI partition, because it was my boot volume, worked like a charm.

    For those who run into problems resizing an OS X Server Guest under VMWare, if you boot from the OS X Server boot DVD, then use the commands here in Terminal to update your GUID partition table, adding another gpt command for the EFI partition, you’ll be able to switch to Disk Utility and grab your extra space.

    The GPT command for adding efi, is just like the default, except adding -t efi, so:
    sudo gpt add -b 40 -s 409600 -t efi /dev/disk4
    assuming your EFI partition shows up as blocks 40 size 409600

    Thanks for the tip!

  17. Joe T. says:

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

  18. 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!

  19. Matt says:

    Thanks a lot for sharing this information!

    Upgraded my MacBook’s internal hard drive and did a sector clone before i.o. to save my installation. Found myself unable to utilize the new space and spend hours looking for an answer until — YES! Bootet off the Leo installation DVD, did a verify/repair on permissions and drive and followed the instruction given above (except for ignoring the “sudo” command).

    Waht can I say – it worked flawlessly! Did the same on a friend’s MBP today and ..voila! Smooth and easy just as expected.

    Thank you very much once more!

  20. Zurie says:

    Thanks so much!

    I ran DD on my 320 gig HD and upgraded to a 500 gig drive. when i rebooted I was sad to see I still had the same space available as the 320 (being a exact copy.) when I ran DiskUtility and tried to resize the partition I was bummed to see the MapKit Utility failed because the parition (map) was too small??? WHAAA??? so thankyou for the above because it allowed me to resize my drive up to 500 gigs and not have to redo the clone.

  21. Hans says:

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

  22. 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!

  23. 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!!

  24. 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! :)

  25. Sam says:

    Another way that I have found to fix the problem “Mediakit reports partition (map) too small” is to boot your Mac from a Linux Boot CD (e.g. Ubuntu) and run parted or gparted – it will prompt you to fix the GPT. At the time of writing there is a bug in the GUI version of parted that does not prompt you, so just use the command line version.

  26. Mike says:

    For the record, I got this to work on a MacBook Pro with just an internal drive! (I hit this issue because I bought a larger drive, then rebooted into Linux and cloned it with ‘dd’ while it was mounted externally.) All was working great until I tried to resize the volume with Disk Utility. (gparted doesn’t support growing HFS+ last I checked, at least not on the relatively recent Ubuntu boot CD I have laying around.)

    It took some trickery to get to the point where I could modify my internal drive with gpt.

    My process was to reboot into single user mode from the Mac OS X install CD. (I had to insert the install disk, reboot and press C, then when I heard the drive spin up press Command-S.) That dropped me to a root prompt where the internal drive was not mounted.

    Then I recreated the two partitions on the internal drive, noting that the first was an EFI partition (and I had to use the “-t efi” option to “gpt add”).

    THANK YOU for posting this!

  27. yo says:

    You fucking rock, man. Thank you!

  28. 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

  29. Dean Trasente says:

    I realize this is a pretty old thread but find myself treading similar ground today as it appears that apple still has not addressed the shortcoming in expanding raid drives with disk utility. Did anything change in Lion that would prevent this same technique from working the same way?

    What to do if you have two partitions on the dev in question to be expanded? Would one still use the number from the start of the 1st current partition and then the largest number displayed being the second partition?

    Or is there different way needed to to deal with multiple partitions on the same dev?

    Thanks lots for the insight in this area … your technique appears to live on years later.

  30. 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!!

  31. mMalo says:

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

  32. Serkan says:

    Well written article, simple and right to the point, great job!

  33. strobo says:

    Hi,
    same here.
    worked like a charm with OS X Lion 10.7.5!
    Thanks for the hint with creating the EFI partition.

    Big thanks. saved the time for useless disk data copy.
    Cheers

  34. Kevin Neal says:

    I really want to do this on our Infortrend RAID6, I have added an extra drive and need to be able to use the extra capacity, but my worry is we are not seeing this error, when we try to expand the partition it just fails without a warning.

    I’m a bit nervous of doing this incase it goes wrong, if something bad happens how to you undo what you have done?

Leave a Reply

You must be logged in to post a comment.