Expanding System Disks in Virtual Server 2005 R2

If anyone’s ever under estimated the anticipated size of your system disk in Virtual Server (or any environment, really) you’ll know that it’s a little painful to resize the disk AND partition neatly.

In this blog, I’ve focussed specifically on Virtual Server 2005 R2, however the same principal applies to any environment that you may have. It covers the resizing of the physical (virtual) disk itself, and then the resizing of the system partition to occupy the extra available space that you have created.

For non-system disks, you can do this quite easily from within the Windows OS, however you obviously can’t do this from your system disk when you’re using it, in which case you can follow these steps…

  1. Download VHD Resizer from http://vmtoolkit.com/files/folders/converters/entry87.aspx and install it on your Virtual Server
  2. Download BartPE Builder from http://www.nu2.nu/pebuilder/ and install it on any machine
  3. Insert the original operating system install CD, or mount the ISO (in my case, it’s Windows 2003)
  4. Open the PE Builder, and say “No” to scanning for Windows source files (because we already know where they are)
  5. Point the source path to the root of the CD drive, set the output path to the location where you’d like the files to be copied (this directory can be removed once the ISO has been created) and set the media output to ISO and select where to save it.
  6. Hit the “Build” button, and continue through any warnings/license agreements
  7. You get quite a verbose output while the files are being copied, and the ISO is being created – You should want to make sure that there are no errors or warnings, otherwise your PE ISO may not boot
  8. Close and exit the PE Builder, and copy the created ISO up to a directory on your virtual server that has been configured as a search path (you can configure Search Paths from within the Virtual Server console, under “Server Properties” -> “Search paths”
  9. You can also delete the output directory, which in my case was C:\Program Files\PE Builder\Win2k3-PE
  10. Now it’s time to shut down the VM that has the system drive you need to resize
  11. With the VM shut down, make a copy of the VHD file you want to expand, which will be the file we will work with
  12. Open VHD Resizer, and point it to the copy of your system drive VHD
  13. Provide the desired location and name of your new VHD, select the new size and choose whether to create a dynamic or fixed disk – I called my new VHD “SYSTEM-new.vhd” because we want to leave the original “SYSTEM.vhd” as our backup
  14. Click on “resize” and wait for it to complete – It took about an hour and a bit to convert a fixed 8GB disk to a dynamic 20GB disk
  15. When it’s done, rename the original VHD file to put “-backup.vhd” at the end, such as “SYSTEM-backup.vhd” and then rename the newly resized VHD to the name of the original file – You can also delete the copy of the original VHD now (in my case “Copy of SYSTEM.vhd”)
  16. Now that the disk is been resized, we also need to expand the partition so that you can use the extra space, so configure the VM to mount the BartPE ISO, and then power the VM on (make sure your VM is configured to boot from CD before HDD)
  17. As we’re just going to resize the partition, there’s no need to boot with network support, so say “No” to any messages about network support
  18. Click GO -> System -> Storage -> DiskPart, to fire up DiskPart
  19. Perform the following commands…
    • Type “list volume” to get a list of the available volumes
    • Identify the volume you wish to extend and then type “select volume <volumenumber>”
    • Type “extend”
  20. Type “list volumes” again, to make sure it reports the new size
  21. Click GO -> Shutdown -> Shutdown
  22. Unmount the BartPE ISO
  23. Power your VM back up, and then view the disk details from within Disk Management to verify that your settings are correct – You may also be prompted to reboot as a system change may have been detected.