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:
- Take a backup of your VHD.
- Run the “VHD Resizer” tool to add extra disk space to the VHD.
- 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.
- 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
- Shutdown the VHD and again take a backup.
- Go to StartControl PanelAdministrative ToolsComputer Management in Computer Management select Disk Management.
- In the right pane expand “More actions” and select “Attach VHD”
- Specify the VHD you want to extend
- Right the partition you want to extend and select ‘Extend Volume’
- 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’