DefinIT

Moving and resizing a VMWare System Disk

I’ve recently had to upgrade my VM Server due to an increase in load. I had 2 virtual servers running off of the same hard disk, with 768mb of RAM split between the lot. After jamming 2 new 1GB sticks of DDR in, and a new 120GB hard drive it was time to re-allocate some of these resources…here’s how:

WARNING! You should always perform a backup on a server you can’t afford to lose BEFORE any operation that could potentially destroy the disk (think what would happen if you had a power cut while resizing…)

Step 1 – Moving the Virtual Server.

This is laughably easy;

  • Stop the virtual server from your admin interface
  • copy the virtual server folder over:
    copy “C:\Vitual Machines\SRV-WEB-DEV-01″ ”D:\SRV-WEB-DEV-01″
  •  Next time you boot the Virual Machine, you’ll have to re-attach the .vmdk in it’s correct location.

Step 2 – Resizing the VMWare Disk

Not quite so easy, but still not going to bother most.

  • Using the built in command line VMWare tool (C:\Program Files\VMware\VMware Server\vmware-vdiskmanager.exe) or the handy graphical front end written by Robert Petruska. Help on using the command line utility is available by typing “vmware-vdiskmanager.exe /?”. The command I used was:
vmware-vdiskmanager.exe -x 40Gb D:\SRV-WEB-DEV-01\SRV-WEB-DEV-01.vmdk
  • Once you’ve resized the drive you’ll need to resize the C: partition, or create a new partition of the space. There are 3 ways to do this that I know of.
    • The method I used was to mount the vmdk file to another virtual server so that I could use diskpart.exe (technet article here) to resize the partition – I’m running Windows Server 2003 on my VMs.
    • You can use a gParted live CD if you don’t have another virtual server available. I’ve used this in the past and it has been very reliable – you can also mount the ISO as your VM’s CD drive.
    • PartitionMagic and many other comercial solutions are also available – I’m not going to list them – google it!

That’s it – when you boot to your new machine you should have a nice big space to play with. One of the benefits of now having a 3 disks is being able to run each VM on a separate physical disk, which gives a nice performance boost. If you’ve got a spare disk hanging around you could always create an extra virtual disk, attach it and use it as a swap disk for your VM giving another performance boost.