Extend VHD with Windows 7

My favorite feature in Windows 7 is the built-in partition manager! Often I copy VHD files from colleagues and use those as a starting point for my own development. Sometimes I run into the issue that I want to install additional software on the image but there is no more space available on the image.

My solution for this is the following:

  1. Take a backup of your VHD.
  2. Run the “VHD Resizer” tool to add extra disk space to the VHD.
  3. Start the VHD and take a look at the disk via Disk Management. You will see that the disk has now extra unallocated disk space.
  4. Because the disk is the system disk you cannot use DISKPART to add the unallocated disk space to the system partition. But….. Windows 7 is there to the rescue
  5. Shutdown the VHD and again take a backup.
  6. Go to StartControl PanelAdministrative ToolsComputer Management in Computer Management select Disk Management.
  7. In the right pane expand “More actions” and select “Attach VHD”
  8. AttachVHD
  9. Specify the VHD you want to extend
  10. chooseVHD
  11. Right the partition you want to extend and select ‘Extend Volume’
  12. ExtendVolume
  13. Complete the ‘Extend Volume Wizard’ and the result should be an extended VHD file as shown below. After that detach the VHD by right clicking the Disk and then selecting the option ‘Detach VHD’
  14. EndResult