Mar 29, 2012

How to enlarge a VirtualBox disk with Windows XP guest in Kubuntu 12.04

After years of using my VirtualBox instance of Windows XP in my laptop I realized there is not enough space on the disk.

So I decided to enlarge it.

Create a new vdi in ~/.VirtualBox/VDI by running:

$ cd ~/.VirtualBox/VDI
$ VBoxManage createhd -filename new.vdi --size 15000 --remember

where size is in MB, in this example 15000MB ~= 15GB, and new.vdi is name of new hard drive to be created.

Next the old vdi needs to be cloned to the new vdi, this may take some time so wait while it occurs:
 
$ VBoxManage clonehd old.vdi new.vdi --existing

Detach old harddrive and attach new hard drive, replace VMName with whatever you called your VM:

$ VBoxManage modifyvm VMName --hda none
$ VBoxManage modifyvm VMName --hda new.vdi

Boot the VM, run Partition Wizard to resize the partition on the fly, and reboot.
Remove old vdi from VirtualBox and delete it:
 
$ VBoxManage closemedium disk old.vdi
$ rm old.vdi
 
Resources:
https://wiki.archlinux.org/index.php/VirtualBox_%28%C4%8Cesky%29#Increase_the_size_of_a_virtual_hard_drive_for_a_Windows_guest




No comments:

Post a Comment