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

Before following these instructions… PLEASE backup your machine.  The best way to get a good backup of a machine is to do an export.  So please, export the machine or at the very least test your backup procedures to make sure they are valid.  Also, if you want a way to do this through a GUI then check out the Expand and Extend VHD.vmv video and go to the end.  Very cool shortcut that is much easier than the command prompt but requires Windows 2008 R2

I ran this on a Windows Server 2008 R2 SP1 machine.  These instructions will be identical for Windows 7.  I am not certain of the changes from earlier versions of the OS.  I think these commands are all available in Vista but I am not sure and I do not have a vista machine available for testing.  The commands in this post must be run while the VHD file is closed.  It cannot be attached with disk manager and it cannot be attached to a running VM.  You also have to be in an elevated command prompt.  Start | type cmd | Right-click cmd (top of menu) | Run as Administrator

I have done several posts recently on managing VHD’s.  I wanted to simplify the process of adding additional space to the C: drive (Boot Drive) of a virtual machine.  I have collapsed it down to a few simple steps using diskpart.  Thanks to all that posted comments giving me the suggestion to write this post.  If you have snapshots on the volume or are using differencing disks you will need to check out How To Merge a Chained Differential VHD Disk So It Can Be Extended and Expanded to learn what you need to do before you can expand and extend these disks. 

The commands I ran to expand and extend my disk (all together). Notice your commands will be different as you will have to put in your name and path and look to see what volume # your disk is so you are working with the correct volume.  A couple things of note as I worked through these instructions again and produced a video of it.  The most important of which is that the disk has to be completely closed before you can start the machine up.  

I did a video walkthrough of these instructions.  You can down the video from Expand and Extend VHD.vmv  

Select vdisk file="D:\W510\BRS Fargo – {SQL, FEP Server ConfigMgr } .10\BRS-FargoNew.vhd"
list vdisk
expand vdisk maximum=40000
attach vdisk
list disk

— If disk is not online… Use “Online Disk” to bring it online

list volume
select volume 9
list volume
detach vdisk 

Now let’s look in more detail at what I am doing with each command…

Command Description
diskpartLaunch the DiskPart utility
Select vdisk file="D:\W510\BRS Fargo - {SQL, FEP Server ConfigMgr } .10\BRS-FargoNew.vhd" Select the VHD file.  Notice that if the path or the file name has spaces you have to put “” quotes around it
list vdisk Shows you a list of Vdisks.  The * at the left shows the one that is selected.
expand vdisk maximum=40000 changes the size of the vdisk to this new size defined by the maximum= parameter.  This is the number of bytes that the resulting disk should have in it. 40000 is almost 40gb.
attach vdisk once the disk is expanded you have to mount it to work on the disk.  This actually mounts the disk. If you look in Disk Manager or in windows explorer you would see that after you run this you have a new drive.  It is doing the Attach to the currently selected vdisk which is the one we just expanded
list disk Shows the list of disks.  This is all mounted disks so it includes all vDisks that are mounted.  The disk we want to work with is already selected because we just attached it.  if it were not selected you could select it with Select Disk #.  Notice that we now have 19gb of free space thanks to the expand vdisk command we ran above
Online DiskIf disk is not showing online. you will need to bring it online.
list volumeList volumes (partitions) the ### column is the most important.  It has the number you need to use to select the volume you will work with.  notice that the volume is currently 19gb
select volume 9Select the volume we want to work with.  In my case the volume I want to work with is Volume 9
extendextends the currently selected volume to use all contiguous available space on the same disk
List Volumerunning again to show the new size of 39gb.  When we ran it before, it was only 19gb.
detach vdiskdismounts the Vdisk volume.  Taking the volume offline is required because Hyper-V cannot load a disk that is mounted
exitExit diskpart utility

And finally, a screenshot of what I typed and the result.


Other articles that may be of interest:

Comments (24)

  1. DiggerMeUp says:

    Hi Dan, thanks for this gold nugget of a post -really clear and the video is a nice touch.

    I used this guide to expand a fixed size disk vhd which I had prevously converted from vmware player's vmdk. I am using this vhd as a boot disk. The expand command after a couple of minutes of countdown indicated successful completion and I could see in file explorer the increase in size.

    This worked on windows 8 pro and at the point of attaching vdisk it was automatically onlined. Rather than extending the partion at this point I detached the vdisk and exitted from diskpart and rebooted into the vhd. Then opened up disk management and as expected could see the unalloacted space.

    On a different subject any plans do do a blog and video for devs wishing to use hyper-v? I had a play with windows 8 pro with hyper v and set up a couple of machines. Didn't seem to support multi monitors and have never used remote desktop and hadn't the time to fully explore it. From the videos I have seen for hyper-v on Win 8 seems to be excellent for spinning up testing environments and easy deployment but not so much on developing and using visual studio 2012 hosted under hyper-v. Have not seen much about the remote desktop experience etc. My perception so far as a developer is the barriers to entry are much higher than vmware.

  2. Kjartan says:


    I've used this way too to expand windows 2003 system disks, however, do you have any idea on how we can script it?

    I know diskpart /s script.txt, but there's no way to parse out the volume number..



    I would guess that it can be done with powershell but not sure.  I will add it to my list to investigate when I have some time. 


  3. pete says:


    In you example, you expand on a dynamic VHD hard drive (boot drive).

    Is this work on a fixed VHD drive ?

    Thank for all, very good job !

  4. samf says:

    Just a small typo which might cause some confusion:

    "changes the size of the vdisk to this new size defined by the maximum= parameter.  This is the number of *MEGA*bytes that the resulting disk should have in it. 40000 is almost 40gb"

  5. samf says:

    Also, I believe that the vdisk must be detached before you expand it, at least that was the case for me.

  6. crabon says:


    I have Hyper-V running on a Windows 2008 Service Pack 2. The version of Diskpart is 6.0.6002. This version of Diskpart doesn't seem to support vdisk. Any suggestions?

  7. gg99 says:

    thx, the procedure with diskpart also works with windows 8.1 and save me a lot of hassle

  8. Rupam says:

    Thnx A lot! I expanded my vhd easily.

  9. paul says:

    Thank you – helped a lot.

  10. Enrico says:

    I have win 2008 r2, when Iaunch command "expand vdisk=10000" the system say me: parameter not correct verify event log…

    I have tryed on another vhd file and the message is the same
    please helpme!

  11. Duke says:

    We are having issues with disk creation where we’re trying to create a 2GB fixed disk through the Hyper-V Manager and it’s taking days. Is there a quick way to create a fixed disk?

  12. chand says:

    I have finally found the tutorial to extend C drive size without formatting it. Its an easiest and fastest method which I used to increase my partition size within 1 minute at”>

  13. says:

    I have finally found the tutorial to extend C drive size without formatting it. Its an easiest and fastest method which I used to increase my partition size within 1 minute at

  14. Muhammad Naeem says:

    I found this article and tutorial video very useful.Thanks for sharing

  15. Matthew says:

    Really dude? The "expand vdisk maximum" is in MEGAbytes, NOT bytes. Now I’m stuck waiting for a VHD to expand to 2TB. I just got totally trolled!! >.< *sigh* 🙁
    See the documentation…

    Thanks anyway. 🙂

  16. asas says:

    hi how r u?

  17. aurélien says:

    Thanks, it works perfectly

  18. Bob Hyatt says:

    I have a W2008R2 vhd that needs more space on C:. It is a dynamic vhd and I have already done the expand the vhd so maximum size is perfect. However my C: drive is still previous size so do I have to expand the partition for C: so it can utilize the expanded
    vhd size? I can’t find how to do this anywhere. So even though my VHD shows maximum size of 120GB, my C: drive is still full at 80GB.

  19. CK says:

    Thanks for this info, Dan. I found the screen shot of your command history most valuable and I appreciate that you have done this using only diskpart. Quite handy for those of us out there that favor the command line over the GUI or installing a 3rd party
    tool to do this. I also appreciate the fact that I can leave you positive feedback without having to register. When I see that requirement, I won’t even bother and the writer then would not know that he/she has helped someone out and the person is appreciative.

  20. 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:
    Latest version of Showbox App download for all android smart phones and tablets. – 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:
    Showbox for PC articles:
    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. 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’.
    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.
    Please do login to Showbox application with the help of Ymail. You can login in Ymail from here –
    Sign Up & Do registration for latest movies on Showbox application

  21. danny says:

    Thank you for this. Especially the huge SS of the CMD windows with all the ornaments. Very simple, thurro and useful ^^