VMWare Virtual Hard Disk Resize

We use various VM templates which we sysprep after configuring. I have used both Virtual PC and VMWare Workstation. I have had far better results and experiences with VMWare workstation. Most of our VM templates were created using 8 GB virtual hard drives. Often we added a second drive to handle additional data and expand our capacity. Recently my work with SharePoint 2003 and MOSS 2007, I have had very little success keeping my primary drive to obediently remain a nice 7GB or below (to prevent swapping and such). I’ve even moved the virtual paging memory file to my secondary virtual drive, but in the end this has been frustrating and limited.

In my frustrationfrustrated smiley, I sought out a solution on the web. I tried various methods for resize my existing virtual drive … some with more success than others. I am sharing the method which I found the easiest and least error prone for what I needed. Having said that, this may not work for you and you should backup your VM’s and data before attempting any of this. Try this at your own risk!

I found a program called Virtual DiskManager from RDPSoftware which does that trick. This program is a front-end for VMWare’s vDiskManager. The VM templates were created in VMWare Workstation 4.5. Currently (at the time of this writing), I am using VMWare Workstation 5.5. The following are the steps I took to resize my virtual drive from 8 GB to 30 GB (you can easily resize it to any size you require as far as I can tell):

Resizing the Virtual Hard Drive

  1. Opened the original VM Template in VMWare and upgraded it to a 5.5 VM.
  2. Create a full clone from the VM to eliminate any snapshots.
  3. Run Virtual DiskFactory (VMWare DiskManager would work too) and click on the Expand tab

    SNAG-0023
  4. Enter the desired target size (30 GB in my case).
  5. Browse and choose the Virtual Disk Drive to resize.
  6. Click on Expand Disk. Mine was disabled because I did step 5 and then step 4; Click on the browse button and close the dialog … it should enable the button.
  7. Go get coffee while you wait Smiley
  8. Once complete, you can use your newly resized VM Template. I have backed up these VM Templates so that I don’t have to perform these tasks again.

SNAG-0002

Repartitioning to use the new space

Now for the interesting part … if you open the VM (don’t do it yet) you will find that you have a 30 GB drive but you still have the 8 GB partition. In this example, I want to use all 30 GB but this poses a problem since the operating system is sitting on the primary partition; the same drive I want to repartition. My solution is to map this virtual drive as a secondary drive to a different temporary VM. I have created a separate temporary VM from the same VM template for repartitioning the resized virtual drives.

  1. Create another VM instance (preferably from the same VM Template) to use for repartitioning.

    SNAG-0000

  2. Run Virtual DiskFactory (VMWare DiskManager would work too) and click on the Rename tab
  3. Rename the newly resized virtual drive to make sure it won’t conflict with the virtual drive from our repartitioning VM. I renamed my virtual drive to “RenamedDisk.vmdk”.
  4. Run Virtual DiskFactory (VMWare DiskManager would work too) and click on the Convert tab. This step may not be necessary for you, you can try step #6. If you cannot add the drive, come back to this step.
  5. Convert your virtual drive to a Growable … catch up on some emails and the latest YouTube videos.
  6. Edit the Virtual Machine Settings and add the existing virtual drive (i.e. RenamedDisk.vmdk). Mine is now on IDE2.
  7. Start the VM.
  8. Go to the Administrative Tools and run the Computer Management console. Under Disk Management, make sure the second drive is recognized and has a drive letter. If not, add it and give it a drive letter.
  9. Using the diskpart.exe tool from Microsoft and the “How to use DiskPart.exe”. Force the partition to take the new partition size. This is from the How-To with a couple modifications:

    Extend


    1. In a command prompt, run “diskpart.exe”
    2. Type “list volume” to display the existing volumes on the computer.
    3. Type “Select volume [volume number]” where volume number is number of the volume that you want to extend.
    4. Type “extend [size=n] [disk=n] [noerr]” to extend the volume. For example, in my case I used “extend” to use all the space.
    5. Once done, type “exit” to quit Diskpart.exe.
  10. Now you can restore the resized, extended ad renamed virtual disk to the original VM location. You can remove the old drive reference and add the new drive as is, or you can rename the disk to its original name. The VM should load just fine, and the drive should have taken its specified size.

7 thoughts on “VMWare Virtual Hard Disk Resize”

  1. Brian, your tutorial is by far the best guide out there. nice to see someone is thinking of the little guy . Great job Thanks…

  2. This was extremely helpful, thank you. I needed to extend a Win2003 Server X64 VM from 8Gb to 20Gb. It all worked fine, except that renaming the temp HDD back to its original name failed. I got round this by using VirtualDiskFactory to convert the temp one into another (growable) disk of the original name. After that it all worked fine, and I just deleted the temp HDD.

Comments are closed.