Monday, May 6, 2013

Resizing VirtualBox Drives

My Virtualbox images are usually fairly small. Here's how to increase the size of a vbox disk, to 8G in this case:

vboxmanage modifyhd /home/user/vbox/vm/vm.vdi --resize 8192

After that, remove the disk from the vm it's currently attached to, hook it to a new vm, which will boot from an iso file. Once booted, start gparted. It will complain that the gpt partition table is not (anymore) at the end of the disk, ignore that message and you'll see the full disk with the initial partition plus additional space at the end. Resize the partition on the disk or create new partitions, whatever you like. Save the changes, stop the vm, move the drive back to the initial vm and start that one again.

Now, if you're on a LVM volume group, you'll need to vgextend the drive. For an ext2 or higher filesystem you'll need to run resize2fs.

No comments:

Post a Comment