Increasing the size of your VM disk using VMWare and GParted
UPDATE: Although the instructions below still work, it appears that this method is a bit outdated since there is a much easier method out there! VMWare Converter. Credits to Peter vd Berg, thanks!
Disclaimer: playing with partitions is always a risky thing and can mess up your machine. I cannot be held responsible for any harm done to your machine as a result of following the instructions below. The instructions happened to work for me, but I cannot guarantee that they will work for you!
Let’s say you have a VM that has a C: drive that reports low disk space on daily basis, and you spend every day cleaning up log files, hoping to free up at least 100 mb of disk space in your VM so you can continue your development stuff for another day…
This situation is actually quite common I think, but it seems that still a lot of people don’t seem to know how to properly deal with it. I think the problem lies with the fact that a lot of people seem to think that increasing the size of disk also automatically increases the size of the partition on it – which is not true.
After having read a few articles on the web and some experimenting I have written down a summarised set of steps in my own words which will help you increase the size of your disk and your partition inside a VM, without having to buy any commercial partitioning tools like Partition Magic.
- Backup all vm files
- Run vmware-vdiskmanager.exe to increase the disk size (this does NOT increase the partition the drive).
“C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe” -x 30Gb “D:\MY_VM.vmdk”
Replace the value of –x parameter with the new size of the disk. vmware-vdiskmanager.exe comes with VMWare workstation, which unfortunately it’s not free – but you should be able to download a trial version from the VMWare site.
- Open the .vmx file with notepad and add the following line to make it easy to get into the bios:
bios.bootDelay = “5000″
- Download the GParted live cd ISO image (open source alternative to partition magic) and mount it to the virtual machine using VMWare.
- Start up the VM and use F2 to go to the bios. Change the boot order to have the cd drive on top and reboot.
- Run GParted to increase the size of the c: partition.
- Change back boot order, remove bootdelay and unmount cd.