Revised 4/2/2011 to add merge change instructions link and link to simple way to do this using diskpart. I documented the process at: How To Expand and Extend To Increase Capacity On A Virtual Hard Disk The Easy and Fast Way–Solve the problem of “Out of Disk Space on Drive C” Forever
Note… this is much, much easier with Server 2008 and higher I finished working on an easier way to do this that does not require SCVMM. This easier way to increase capacity was documented at: How To Expand and Extend To Increase Capacity On A Virtual Hard Disk The Easy and Fast Way–Solve the problem of “Out of Disk Space on Drive C” Forever. Thanks to all that asked me to do this
There are two parts to this problem. The first is making the VHD larger. The second is expanding the boot partition to use all the new space. In this example, I am actually going to use features built into Windows Server 2008 to extend the volume of my Windows Server 2003 Boot partition by simply attaching it to the server as a data disk, doing the work on it then reattaching it to the 2003 server.
Part I - Making the VHD Larger
The first part is pretty easy using System Center Virtual Machine Manager. Since SCVMM uses PowerShell for everything, you can do this with PowerShell but I did not do the leg work to come up with the specific commands. Here is what you would need to do with SCVMM.
Now login to the server and open disk manager. You will see that you have successfully made the VHD capacity larger by adding unallocated space to the end of it.
Part II – Extending The Boot Volume To Use The Full Larger VHD Unallocated Capacity
Since this is a boot volume I am really limited on what I can do with it. I can Convert the Basic disk to Dynamic Disk but this would not solve my problem because you cannot extend the volume of an OS drive.
NOTE: Best practices for using dynamic disks on Windows Server 2003-based computers, DiskPart cannot be used in my case because this is a boot volume. If it is not a boot volume you can use DiskPart. To do this you would follow 325590 (http://support.microsoft.com/kb/325590/ ) How to use Diskpart.exe to extend a data volume in Windows Server 2003, in Windows XP, and in Windows 2000. You cannot extend the partition of an OS disk using diskpart so I am going to attach my boot disk to another server that has extend capabilities.
The only way I could figure out how to pull this off (without third party tools) is to mount the VHD on a windows Server 2008 or later machine and just extend it there. However, snapshots are a problem so you can only do this with a single VHD without any snapshots.
CAUTION: This is NOT supported so proceed at your own RISK. To do this:
Add an additional disk to an existing Windows Server 2008 or 2008 R2 machine, use the VHD you want to expand. Make sure you attach it to an IDE controller (not SCSI)
This took many hours to write so I hope someone finds it useful!
If anyone knows the PowerShell commands to extend the volume, please post to a comment. Thanks
If you like this post, please contact me on Twitter @ITProGuru or send me an email at http://ITProGuru.com/contact.aspx to let me know. To keep from missing other posts, make sure you add an RSS to my blog.
Hi Dan, I found an easier way. Boot the virtual server from Win2008 or Win7 DVD, running the recovery command line > diskpart > list disk > select disk 0 (or the right number from list) > "extend" and restart. V.
You can extend on the fly (like with 2008) using the ExtPart tool from Dell. 32-bit only though, but very handy!
I expanded and extended the disk (increase capacity)using diskpart and documented the process at: How To Expand and Extend To Increase Capacity On A Virtual Hard Disk The Easy and Fast Way–Solve the problem of “Out of Disk Space on Drive C” Forever. http://blogs.technet.com/b/danstolts/archive/2011/04/02/how-to-expand-and-extend-to-increase-capacity-on-a-virtual-hard-disk-the-easy-and-fast-way-solve-the-problem-of-out-of-disk-space-on-drive-c-forever.aspx
Thank you for taking the time to document this procedure. Worked for me with the following tips:
- It's helpful to label/name the drives first, for example "Server1-C".
- Remove the drive from the 2003 machine at the beginning of Part II.
Thank you very much - very helpful when expart doesn't work
Thank you for taken time that written the document, very helpful.
You're the best, thanks for all the info. Helped me out a lot!
Good article, well explained! I've found this one really good for doing the same, except using VMware instead of Hyper-V and also Windows Server 2008.
Thanks again :)
excellent post, worked like a charm!