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…
- Download VHD Resizer from http://vmtoolkit.com/files/folders/converters/entry87.aspx and install it on your Virtual Server
- Download BartPE Builder from http://www.nu2.nu/pebuilder/ and install it on any machine
- Insert the original operating system install CD, or mount the ISO (in my case, it’s Windows 2003)
- Open the PE Builder, and say “No” to scanning for Windows source files (because we already know where they are)
- 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.
- Hit the “Build” button, and continue through any warnings/license agreements
- 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
- 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”
- You can also delete the output directory, which in my case was C:\Program Files\PE Builder\Win2k3-PE
- Now it’s time to shut down the VM that has the system drive you need to resize
- 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
- Open VHD Resizer, and point it to the copy of your system drive VHD
- 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
- 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
- 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”)
- 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)
- 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
- Click GO -> System -> Storage -> DiskPart, to fire up DiskPart
- Perform the following commands…
- Type “list volumes” again, to make sure it reports the new size
- Click GO -> Shutdown -> Shutdown
- Unmount the BartPE ISO
- 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.