Out of Disk Space on Drive C–How To Increase Space on Drive C of a Virtual Machine Running Windows Server 2003


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 Smile  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 Smile

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.

  • You will need to shutdown the server.
  • Login to your SCVMM console;
  • Double-Click on the server you want to modify
  • Click on the Hardware Configuration Tab
  • Click on the drive you want to expand
  • Turn on the checkbox to Expand virtual hard disk
  • In the size box put in the size you want to make the new drive

image

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.

  • Start Server => Login as an administrator
  • Start => Right-Click My Computer => Select Manage
  • Expand Storage
  • Click Disk Management
  • Notice you now have new unallocated space

image

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 computersDiskPart 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:

  • Before you Begin
    • Shutdown the VM
    • backup the VHD to be expand

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)

  • Launch Hyper-V Manager
  • Double-click machine you will use to extend the VHD
  • click on IDE Controller 1
  • click Hard Drive
  • Click Add
  • Browse to the disk you want to add and select it
  • Make sure it is attached to IDE Controller – click OK

image

  • Start Server => Login as an administrator
  • Start => Right-Click My Computer => Select Manage
  • Expand Storage
  • Click Disk Management
  • Notice the unallocated space

image

  • Right-Click the partition of the disk that you need to extend (in my case it is Disk 0) G: Partition
  • Select Extend Volume… from the menu

image 

  • This will kick off a very simple wizard
  • Just click Next on the information page
  • Adjust the size if you like. It should default to the maximum allowed on the disk.  Then select Next

image 

  • Click Finish on the summary screen and like magic your disk is extended

image

  • Now you need to detach it from the 2008 box and reattach to the 2003 box.
  • Shutdown the server so you can remove the disk (on Windows Server 2008 R2 Host you can hot remove storage without shutting down)
    • Launch Hyper-V Manager on the HOST
    • Double-click machine you used to extend the VHD
    • click the Hard drive we just extended
    • Click Remove

image 

  • DO NOT SKIP THIS STEP!!!! 
    • We have to login to Hyper-V manager host of the 2003 server and Remove the disk.  If you skip this step you will likely get a bunch of security error messages when you boot the VM and the boot will fail. If that happens just come back and do this step.  When you create the disk Hyper-V manager adds the security settings that are needed for the VHD.
    • Launch Hyper-V Manager on the HOST (of the 2003 machine)
    • Double-click your 2003 machine
    • click the Hard drive (for the drive we are extending) 
    • Click Remove (you are removing the pointer to the drive not the VHD file / you should have a backup anyway Smile)

image

  • You should already be in Hyper-V Manager with the machine properties open
  • click on IDE Controller 0
  • click Hard Drive
  • Click Add

image

  • Browse to the disk you expanded earlier and select it
  • Make sure it is attached to IDE Controller – click OK

image 

  • Now you should be able to successfully start the 2003 machine
  • It will ask you to reboot to work with new hardware. I would go ahead and dot it now but you can check the drive first if you like

image

 

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.

Comments (13)

  1. Anonymous says:

    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.

  2. Marcus says:

    You can extend on the fly (like with 2008) using the ExtPart tool from Dell. 32-bit only though, but very handy!

  3. Dan Stolts "ITProGuru" - Easier Solution Done! says:

    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

  4. Radar says:

    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.  

  5. dave says:

    Thank you very much – very helpful when expart doesn't work

  6. Learnner says:

    Thank you for taken time that written the document, very helpful.

  7. Hugo says:

    You're the best, thanks for all the info. Helped me out a lot!

  8. Bob Tatus says:

    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.

    http://www.rootusers.com/increasing-disk-space-in-windows-server-2008

    Thanks again 🙂

  9. steelie34 says:

    excellent post, worked like a charm!

  10. Larry Snyer says:

    Thanks, this pointed me in the right direction:)

  11. Born2Learn says:

    Thanks so much, it worked perfectly!

  12. show box says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings.
    http://www.showboxforipad.org/showbox-apk/ Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android. The above
    all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.
    http://www.showboxforipad.org/
    http://movieboxappdownloads.com/moviebox-apk-android/
    http://movieboxappdownloads.com/download-moviebox-pc/
    Movie Box, an esteemed movies application in which you can find stacks of programs and films. The guide is given here to download Movie Box app to Android and to Apple iOS 9.0.2, iOS 8.4/8.3 and also for the lower versions without Jailbreak.
    http://showboxforiphone.org/
    Please do login to Showbox application with the help of Ymail. You can login in Ymail from here –
    http://ymaillogintips.com/
    Sign Up & Do registration for latest movies on Showbox application

  13. trover says:

    Thanks so much for writing this. I was racking my brain on how to increase hard drive space on my Server 2003 VM in order to defrag the exchange database inside. This article jogged my memory – simply shut the VM in question down, and from within the Server
    2008 Host, attach the VM in Disk Manager. Then Extend. Then detach, and fire up the 2003 VM, work perfectly, took 3 minutes.