Extending the system disk on a Windows VM
I have had to do this on a few different occasions, and while its simple, I do not always remember the procedure so here it is for others to reference when needed.
The issue is you setup your windows VM and after a while you start running out of disk space. What do you do?
The easies thing is to add a new disk to the VM image and put most of the installed programs there, but that requires that you have planned ahead of time. If you resize the system disk in a Windows VM, you will have the un allocated space when you restart the VM, but Windows does not let you extend that drive. Here is that easiest way to proceed. Keep in mind that you will most likely loose all your snapshots using this procedure.
- Windows VM whose disk will be extended
- Second Windows VM that will be used to extend the disk size of the first.
- Windows XP or higher on both VMs
- Shut down the VM image you want to extend.
- Open the settings of a second Windows VM (it must be shutdown as well).
- Add a new disk to the second Windows VM, but instead of creating a new disk file, choose the system disk from the VM you want to extend.
- Start the second Windows VM.
- Check to make sure the new drive and all its contents show up now in the VM.
- Start a terminal session (cmd.exe)
- Type diskpart
- At the new prompt, type list volume
- Choose the right value by typing select volume <#>, where <#> is the number of the volume you want to extend.
- Once the volume has been selected, just type extend. This will extend the drive to use all the available unallocated space.
- type exit.
- Shut down the second VM.
- Remove the drive you added in step 3 from the second VM.
- Start the Windows VM you wanted to extend and now the disk space should be available for use.
Hope you found this useful and good luck.