If you’ve run out of space on a VirtualBox vmdk drive and want to increase the partition’s size, do the following:
1) Download the GParted ISO from their website.
2) Convert your vmdk to a vdi (VBoxManage can be found in your virtualbox “program files” directory. Use explicit file paths if needed)
>> VBoxManage clonehd “source.vmdk” “cloned.vdi” –format vdi
3) Resize the vdi to whatever size you need (units in megabytes)
>> VBoxManage modifyhd “cloned.vdi” –resize 51200
4) You might as well keep the drive in vdi, but if you’re set on vmdk, you can convert back like so:
>> VBoxManage clonehd “cloned.vdi” “resized.vmdk” –format vmdk
5) Now, open your virtualbox manager and attach the GParted ISO as a CD ROM.
6) Run the virtualbox instance and boot from the CD. If CD is not prioritized above the drive, hit F12 at boot.
7) Get yourself to the GParted GUI (there are some language selections and other options before this, just keep accepting the defaults)
8) Now, expand your primary SDx partition into the unallocated space created by the recent resize.
9) Now, expand the sub partition into the newly created space of the primary SDx partition.
10) Apply changes
11) Shutdown the VirtualBox.
12) Now, if you need to expand into a dev/mapper area, manually start your virtual box without running the GParted ISO.
13) Run the command >>df at the prompt, and you’ll notice that the dev/mapper area has not expanded as you might have thought.
14) run the following command
>> pvresize /dev/mapper/fedora-root (obviously, fedora-root is going to change to fit your needs)
15) Then to ensure it worked, you can run the following:
16) Then, Run the following command to allocate the free space
>> lvextend -l +100%FREE /dev/mapper/fedora-root
17) Then, run the following command:
>> resize2fs /dev/mapper/fedora-root
18) Then, run the following command to see that the modifications have taken place
http://blog.jyore.com/?p=121 (last 5 steps)
It worked like a charm! Thank you.
Thanks for this great little article – I’ve been tearing my hair out for a day trying to figure out why I couldn’t resize my VirtualBox drive – this was exactly what I needed 🙂
Perfect, thanks! 14-17 are golden.