Extending the hard drive on a guest virtual machine seems to be pretty easy. The only problem is that the system drive cannot be extended and you need to attach it to another VM. Let’s call them “Target VM” (on which hard drive needs to be increased) and “Work VM” (which is used for this increase).
- Shutdown both VMs
- Make a backup copy of all the files of the Target VM. You may need it, see Note below for details.
- Detach the hard drive you want to increase from the Target VM
- Attach the hard drive you want to increase from the Work VM
- Increase the hard drive size in the Work VM settings
- Start the Work VM
- Open the command prompt window and type DiskPart. This is the Microsoft utility for disk management.
- Type list disk to get the list of disks. Type Select Disk=<DiskNumber>, where <DiskNumber> is the number of the disk you want to extend. You will get the messageDisk <DiskNumber> is now the selected disk.
- Type list volume to get the list of volumes. Type select volume=<Volume Number>, where <Volume Number> is the number of the volume you want to extend. You’ll get the messageVolume <Volume Number> is the selected volume.
- Type extend. The process will take a little while and then you will get the messageDiskPart successfully extended the volume.
- Type Exit to quit the DiskPart utility and shut down the Work VM.
- Detach the hard drive you have increased from the Work VM. You can start the Work VM now
- Attach the hard drive to the Target VM. Start the Target VM
Sometimes for unknown reason you can get the following message after running the extend command in DiskPart.
DiskPart successfully extended the volume but failed to extend the file system.
To retry this operation use the DiskPart command EXTEND FILESYSTEM.
In this case the extend filesystem command will not help. What you have now is the extended partition without extended volume. To fix this you need to restore your Target VM from a backup, from the beginning of the process to the step 6 and use EASEUS Partition Master on the Work VM. I really dislike to do it this way, but it works. You can download EASEUS Partition Master Home Edition from here just to test it, or you can buy the Professional Edition for just $39.95