Expanding a VHD on Hyper-V and the Infamous ‘The volume you have selected may not be extended’ Message
Posted by Russell Wright on March 30, 2009
The day always comes when you have a VHD that is too small because of all the "junk" you’ve installed. Then you are left with this problem:
The process seems simple enough. In Hyper-V you can easily edit the disk to resize it. Make sure the VM is off before you begin!
Select the disk you want to expand.
Choose the action (expand).
Set the new size.
Review your selections and go!
Poof! It’s done! Now, if you were to boot up the machine and take a look at Disk Management (diskmgmt.msc) you’d see you have some unallocated space.
If you start up diskpart from a command prompt, you can list the volumes, select the appropriate volume, and attempt to extend it. But, you may see a message like this.
So here’s what I think I’ve found after several trials (and errors)! From a Hyper-V perspective you need to remove the DVD drive so it doesn’t show up multiple times in the diskpart volume listing.
Now what you want to do is set up your VM to boot off the original, smaller disk and add the expanded VHD as the second hard drive. Here’s what the VHD settings look like after the DVD has been removed and the expanded drive set as the second hard drive.
Now we’ll fire up the original VHD again with our expanded hard drive as the secondary drive. Open a command part, type diskpart and then do a list volume command. Select the volume (Select Volume X) that represents your 2nd drive…in this case it is the F: drive or volume 2. Then type Extend. Diskpart should find the continguous space and instantly extend the drive.
Shut down your VM and set up a VM with the newly extended drive. Add your DVD drive back if you need to. Boot up the VM. You should now have an expanded drive! Yeah!