Tuesday, April 5, 2011

“The volume you have selected may not be extended" Error in DiskPart.exe on Windows 2003 Server SP2

I got an email from a colleague saying that he was having trouble increasing the size of a disk on a Windows 2003 SP2 server.  This server is a VMware virtual machine and he had already changed the size of the disk in VMware from 100 GB to 150 GB.


Problem

When trying to extend a partition on a Windows 2003 Server using diskpart.exe he got the error:

“The volume you have selected may not be extended.
Please select another volume and try again.”



Troubleshooting

I remembered seeing this error back in the VMware 3.0 days when resizing disks and then extending the partitions.  So without doing much other research I quickly found Microsoft KB 841650 and VMware KB 1007266 which both reference a bug in DiskPart.exe and a hotfix that is needed.

Well… It turns out that the Microsoft hotfix was only for pre-SP2 for Windows 2003 systems.  Since this server was running Windows 2003 SP2 the hotfix did not apply.

After looking closely at the screenshot I was sent, I noticed that the “Extended Partition” and “Free Space” sections did not look correct.  I wasn’t used to seeing those green colors and tried to figure out why it was showing like that.  I’m used to seeing show the unallocated in Disk Manager.


So took a look at a test Windows 2003 virtual machine to see if could reproduce the issue.  When I initially resized the disk in VMware and rescanned by disks in Disk Manager, I noticed the new space was showing "Unallocated" and not like the screenshot I was sent.


I then needed to try and get the disk to look like the screenshot that he sent me.  I was able to do this by right-clicking on unallocated space, selecting New Partition, Extended partition, and then selecting all of the new space.





Then my test machine was appearing like the screenshot I was sent.  I was then able to confirm that I got the same error when I’d try to run diskpart.exe extend on that volume.


Resolution

To fix I had him simply delete the new “Free Space” partition so that the space was showing unallocated.  At that point we were able to successfully extend the volume on that
disk.



Once the space was showing "Unallocated" I was able to sucessfully extend the volume with DiskPart.exe and now the partition is using all of the new space.



The lesson learned was that the space needs to show "Unallocated" if you want to extend a volume (partition) on a basic disk in Windows.

I passed this information back to my colleague and he was able to sucessfully delete the free space partition and extend his volume.

3 comments:

Ian said...

Interesting, I had exactly the same issue but on the C drive 'system' and that was initially unallocated and I got the same message, to I extended the drive which gave extended free like yours. Then I deleted the partition....

And it still won't extend !

Only difference seems to be that mine is the system drive. And I already disabled the Pagesys file by the way. IanH

Matt McCann said...

If anyone has this issue again, check your page file location. If the page file is on the volume, you're not going to be able to extend the volume live.

RUDRANJAN SAHA said...

Rudranjan IBM

The DiskPart.exe utility cannot extend a logical drive in an extended partition in Windows Server 2003

Stop the Windows Search services & try again it will work ..