The most common tool for this job is OS X's own Disk Utility, but it fails as well with a "MediaKit reports partition (map) too small." The reasons and the technique to get around it are explained in an article titled (appropriately) "Increase disk and partition size in OS X", which is the basis of this how-to as well.
So, standard warnings apply:
- Does not work on fixed drives.
- Does not work with snapshots.
- This post is for a single partition, GUID hard drive.
- Follow Step 1 of How to resize a Virtual Drive.
Now for Step 2. Before you begin, you can take a snapshot at this point, in case you mess up step 2, so that you can always revert back to a safe point.$ VBoxManage showhdinfo Mac.vdi Capacity: 20480 MBytes $ VBoxManage modifyhd Mac.vdi --resize 40960 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% $ VBoxManage showhdinfo Mac.vdi Capacity: 40960 MBytes
Step 2
- Boot with any Mac OS X bootable DVD. Any version will do. That is you can resize a 10.9 guest if you boot with e.g. a 10.6 DVD.
- After you choose the installation language, open Utilities, Terminal. Type 'df' and watch the output. My hard disk is named 'VB-OSX'. You can see it is '/dev/disk0s2' and is mounted on '/Volumes/VB-OSX'.
-bash-3.2# df Filesystem 512-blocks Used Available Capacity Mounted on /dev/disk2s3 2976968 2207968 739232 75% / ... /dev/disk0s2 40263824 14454680 25809144 36% /Volumes/VB-OSX ...
- Unmount the disk and display GPT info for it. Note that the 's2' part is missing in some of the commands. This is because some of the commands (gpt ...) operate on the disk, while others (umount ...) operate on the partition (or 'slice', hence the 's'):
-bash-3.2# umount /dev/disk0s2 -bash-3.2# gpt show /dev/disk0 start size index contents 0 1 PMBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part C12A7329-F81F-11D2-BA4B-00A0C93EC93B 409640 40263824 2 GPT part 48465300-0000-11AA-AA11-00306543ECAC 40673464 1269536 3 GPT part 426F6F74-0000-11AA-AA11-00306543ECAC 41943000 41943080
- Note that I've highlighted three rows; the three GPT partitions. This is from a 10.7 system. In 10.6 and earlier you'd have only the first two GPT partitions. Each partitions has three parameters; 'start', 'size' and 'UUID' (the 32-digit hex number). We're going to need those later when we rebuild the GPT. First, we need to destroy it!
-bash-3.2# umount /dev/disk0s2 -bash-3.2# gpt destroy /dev/disk0
- Now we're going to create a GPT and add partitions to it. The partitions have to be added in the correct/existing order, size and type. It would be easier if at this point you open a new Terminal window (Cmd-N) so that in one you have the output of the 'gpt show' command and you can copy and paste between that and the new one that you're adding the partitions:
-bash-3.2# gpt create -f /dev/disk0 -bash-3.2# gpt add -b 40 -s 409600 -t C12A7329-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0 /dev/disk0s1 added -bash-3.2# gpt add -b 409640 -s 40263824 -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0 /dev/disk0s2 added -bash-3.2# umount /dev/disk0s2 <-- The HFS+ partition is mounted automatically -bash-3.2# gpt add -b 40673464 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC /dev/disk0 /dev/disk0s3 added
- Quit Terminal, open Disk Utility, select your HD, go to the Partition tab and drag the lower-right corner to expand the HDto its new capacity. Now it works without any problems...
PS. The 32-hex-digit UUIDs of the different partitions can be found on the GUID Partition Table article on Wikipedia. For a quick reference of the ones found in this post:
C12A7328-F81F-11D2-BA4B-00A0C93EC93B EFI System partition 48465300-0000-11AA-AA11-00306543ECAC HFS+ partition 426F6F74-0000-11AA-AA11-00306543ECAC Apple Boot partition