Skip to content

Instantly share code, notes, and snippets.

@daurnimator
Last active October 15, 2019 17:07
Show Gist options
  • Save daurnimator/5816924 to your computer and use it in GitHub Desktop.
Save daurnimator/5816924 to your computer and use it in GitHub Desktop.
Resizing OSX virtualbox guest partition

Expand virtual hard drive

VBoxManage modifyhd OSX\ Dev.vdi --resize 40960

Resize GPT

Solves "MediaKit reports partition (map) too small" error from Disk Utility

  • Mount virtual image via nbd sudo qemu-nbd -c /dev/nbd0 OSX\ Dev.vdi
  • Use sudo gdisk /dev/ndb0 to destroy and recreate a partition table.
  • Unmount virtual image sudo qemu-nbd -d /dev/nbd0

Fix volume information headers

Solves "Couldn't modify partition map because file system verification failed" error from Disk Utility

  • Boot OSX in single user mode (pass -s to bootloader)
  • fsck -fy

Actually resize partition

  • Boot OSX normally
  • Open Disk Utility
  • Select (now larger) drive on left
  • Partition tab
  • Drag up and then down
  • Click Apply

Done!

@ytsamy
Copy link

ytsamy commented May 21, 2014

Hi!
I've followed your instructions as closely as I could, but when I boot OSX, the drive is still the previous (smaller) size.
One point is not very clear to me: how to destroy and recreate the partition table. I ran the command (gdisk....) and then quit, but the disk size does not change in OSX.
If I try to make further manipulations in gdisk (deleting and re-adding the partitions), I can no longer boot OSX to single user mode: it keeps saying "still waiting for root device". I forgot to mention It's my root partition that I want to make larger.
Can you help me?
Samuel

@fdelapena
Copy link

@ytsamy try this approach:
http://blog.kyodium.net/2010/11/increase-disk-and-partition-size-in.html
In recent OS X there are multiple entries for EFI, but read the latest comment to learn how to play with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment