Search Wiki:
The Downloads page contains the downloadable files (binaries, readme document, and source code project).

Latest News

  • The final release of v2 is now available.
  • I've added a "repair" function which is designed to undo an expand operation on a base VHD when differencing VHDs are present. This is useful in cases where an admin accidentally expands a base VHD when Hyper-V snapshots are present.
  • To ensure data integrity in the case of an error, please make a backup copy of your VHDs before altering them with this tool.


VHD tool is an unmanaged code command-line tool which provides useful VHD manipulation functions including instant creation of large fixed-size VHDs. The source code is included.


  • A computer running one of the following Windows operating systems:
    • Server: Windows Server 2003 or above
    • Client: Windows XP or above
  • NTFS file system


VhdTool.exe /create <FileName> <Size> [/quiet]
VhdTool.exe /convert <FileName> [/quiet]
VhdTool.exe /extend <FileName> <NewSize> [/quiet]
VhdTool.exe /repair <BaseVhdFileName> <FirstSnapshotAVhdFileName> [/quiet]
Create: Creates a new fixed format VHD of size <Size>.
        WARNING - this function is admin only and bypasses
        file system security.  The resulting VHD file will
        contain data which currently exists on the physical disk.
Convert: Converts an existing RAW disk image file to a fixed-format VHD.
         The existing file length, rounded up, will contain block data
         A VHD footer is appended to the current end of file.
Extend: Extends an existing fixed format VHD to a larger size <Size>.
         WARNING - this function is admin only and bypasses
         file system security.  The resulting VHD file will
         contain data which currently exists on the physical disk.
Repair: Repairs a broken Hyper-V snapshot chain where an administrator
        has expanded the size of the root VHD.  The base VHD will be
        returned to its original size. THIS MAY CAUSE DATA LOSS if the
        contents of the base VHD were changed after expansion.

Known Issues

There are currently no known issues.

Frequently Asked Questions

How do I file a bug?
Click on the "Issue Tracker" tab and choose to "Create New Item".


Create a new 10 GB fixed VHD in the current directory.
VhdTool.exe /create "c:\Program Files\MyApp\foo.vhd" 10737418240

Convert an existing flat image file into a VHD & do not output status to the command line.
VhdTool.exe /convert bar.img /quiet

Extend an existing fixed format VHD to a larger size.
VhdTool.exe /extend foo.vhd 21474836480

Repair a Hyper-V snapshot chain broken by expanding the base VHD.
VhdTool.exe /repair base.vhd base_EF2F9402-E85B-402F-A979-631CB287C2C4.avhd


VHD Specification

Last edited Jan 10 2011 at 5:31 PM  by ChrisEck, version 23
RogerC wrote  Mar 28 2009 at 4:18 PM  
Great Tool this has saved me a lot of time when creating large VHD files. I second the above feature request and also one question. When you run the tool can you specify a directory to drop this in or do you have to run the tool from the location that you want the file to be in if you have to be in the directory where you want it I would like to add a second feature request of the ability to define a location to create the file in? Thanks

Roger Crawford

ChrisEck wrote  Apr 2 2009 at 7:09 PM  
RogerC - Yes, you can specify a full path to the file. I'll add an example showcasing this.

plynch wrote  Apr 6 2009 at 1:38 PM  
I just wanted to say how awesome this tool is. I just created a test 4GB VHD and it did it so quick I thought it had failed - it hadn't, it had created a 4GB VHD in the blink of an eye - literally. Awesome !

davewilk wrote  Apr 11 2009 at 10:13 AM  
Does this work for creating SCSI disk for Virtual Server?

ChrisEck wrote  Apr 20 2009 at 4:22 PM  
Dave, this tool creates valid VHD 1.1 spec compliant VHDs, so any application which uses VHDs should be able to use these.

Dafydd wrote  Oct 20 2009 at 6:14 PM  
Flamming genius this has just rescued a CRM App Server installation (which is still in testing so no DR or backup) after a young collegue resized the base vhd. THANK YOU

ChrisEck wrote  Oct 22 2009 at 11:36 PM  
I've removed the bug reports from the comments section. Please file future bug reports in the "Issue Tracker" tab.

Kbubp wrote  Oct 28 2009 at 6:15 PM  
It would be nice in the next release to not have to use kilobits. Instead, do what VMWare's vhd tool does and use G and M for gigabyte and megabye. e.g. vhdtool /create drive.vhd 20G or vhdtool /create drive.vhd 256M

Morpheus666 wrote  Nov 20 2009 at 7:19 AM  
This is fast! Why are they so much smaller than a 'regularly' created vhd? I set a size of 210GB and when I mount it, it is 195GB!
I like the speed, but not the loss of space.

ASidles wrote  Dec 11 2009 at 5:43 AM  
This tool is the bomb! Repaired an expanded echange server vhd within 15 minutes on first try! Not an email was lost. Awesome job Chris!

ChrisEck wrote  Dec 11 2009 at 7:27 PM  
ASidles - glad to hear it was useful.

ChrisEck wrote  Dec 11 2009 at 7:28 PM  
Morpheus666 - the VHD's virtual size is correct, but you're probably losing some space either because of the bus type you've mounted on or the file system inside the VHD. Please verify you see the full amount expected if you try a smaller value (sub 100 GB).

Junroot wrote  Jan 6 2010 at 6:10 PM  
Hi ChrisEck, your tool is very powerfull!
whenever, when does this tool support windows 2000 pro\server?
Thank you!

ChrisEck wrote  Jan 22 2010 at 4:57 AM  
Junroot - this tool will never support running on Windows 2000. Not only is Windows 2000 beyond end-of-life, but the platform support required for the tool did not exist prior to the OS releases listed in the requirements. You should consider upgrading to an OS made this millennium ;)

raldridge wrote  Mar 5 2010 at 4:12 PM  
I don't understand what is meant by "The resulting VHD file will contain data which currently exists on the physical disk" from this:

Create: Creates a new fixed format VHD of size <Size>.
WARNING - this function is admin only and bypasses
file system security. The resulting VHD file will
contain data which currently exists on the physical disk.

ChrisEck wrote  Mar 22 2010 at 5:15 PM  
Raldridge - you can read the details on MSDN here:

alexli wrote  Apr 6 2010 at 5:27 PM  
Hi ChrisEck, it's powerful. How about create a linked physical disk?
is it possible to differencing a physical disk?
(I want to mount a snapshot disk as a development/drill test environment)


ChrisEck wrote  Apr 12 2010 at 3:22 PM  
alexli - Unfortunately, the VHD format does not allow for parent physical disks.

jharris1993 wrote  Apr 15 2010 at 9:24 PM  
WOW! If this thing does only HALF of what it thinks it can do, I see a QA-Tech-Tip in the making!

You say
Convert: Converts an existing RAW disk image file to a fixed-format VHD.
The existing file length, rounded up, will contain block data
A VHD footer is appended to the current end of file.
Does this mean that if I have a live, running, system and can somehow export the partition (or entire drive) to a bit-image file - like the Unix "dd" command would do - that this feature will automagically convert it into a working VHD?!! (i.e. a bit-by-bit copy of a 60 gig Linux or Windows partition becomes a valid and runnable VHD?) Holy Smokes! If that's true, sign me up for at least TWO of 'em! (:-D)

EXECLudo wrote  Apr 21 2010 at 8:50 PM  
Hi! Great tool !
Are these VHD real fixed size VHD ? I mean, are the performance the same (fixed VS dynamic) than regular VHD made with Hyper-V manager ?

ChrisEck wrote  May 17 2010 at 5:48 PM  
JHarris1993 - Yes, a raw DD image should convert into a fixed VHD quickly with this tool. Enjoy :)

ChrisEck wrote  May 17 2010 at 5:49 PM  
EXECLudo - Yes, the fixed VHDs made with this tool are real VHDs with the same performance characteristics as fixed VHDs made through other tools, including Hyper-V manager.

exactmike wrote  Jun 23 2010 at 9:48 PM  
To workaround need to enter size in bytes try using VhdTool.exe from Powershell using the built in GB/KB constants with syntax like this: VhdTool.exe /create v:\VHDs\test.vhd ((30GB/1KB)*1024) where 30GB is the desired size in GB.

eeeweb wrote  Aug 10 2010 at 3:05 AM  
How can I resume a .AVHD file without the parent VHD file?

ChrisEck wrote  Aug 26 2010 at 8:46 PM  
eeeweb - You cannot. The .AVHD file is a differencing disk which only contains the changes in the state of the virtual disk compared to its parent.

dgates123 wrote  Dec 8 2010 at 8:35 PM  
Will this tool every be developed to run in a 64 Bit OS? Is there a work around to run this tool on the Hyper-V host?

dgates123 wrote  Dec 9 2010 at 7:05 PM  
Great tool but in SCVMM I point to an existing VHD that I created with this tool that is in the library, but it still take over 3 hours for a 100GB VHD, am I doing something wrong? Also I had to set the icacls permission with the VM SID in order to start the new VM...

ChrisEck wrote  Dec 13 2010 at 9:50 PM  
dgates123 - This tool currently works fine on a 64 bit OS. I run it myself on my 64bit dev machine.

Could you be more specific about what is taking over 3 hours? Is it deployment of the VM to a remote machine?

This tool does not set any security attributes on the resulting VHD, so you'll need to manually set ACLs or go through the Hyper-V manager and add the VHD to a VM (which automatically sets the appropriate ACLs for you).

kelvinng wrote  Dec 21 2010 at 4:17 AM  
i try to create new 1.2TB VHD ;

vhdtool.exe /create "c:\users\public\documents\hyper-v\virtual hard disks\GSPPINTRANET_D.vhd" 131941395333120

but getting error: unable to set EOF with error: The parameter is incorrect.

others 80GB VHD created successfully. this tool is superb!

phillbl wrote  Jan 4 2011 at 9:30 PM  
hi, I also get the above error when trying to create anything above 100gb. I need to create 600gb fixed disk and using hyper v is so slow...

millcho wrote  Jan 5 2011 at 6:44 AM  
I have created a virtual 2TB disk. Thanks.

ChrisEck wrote  Jan 10 2011 at 5:15 PM  
kelvinng - Check your math. It looks like you're trying to create a 12 TB VHD.

phillbl - Also check your math. Other users are reporting it works fine up to the established limit of 2TB.

ChrisEck wrote  Jan 12 2011 at 5:21 PM  
magicxtm - Thanks for pointing that out! I had inadvertently published an incorrect version of the tool...the correct version has now been published.

MattRK wrote  Jan 27 2011 at 9:15 PM  
Hello. Someone mentioned that i might be able to use this tool to create a fixed size VHD on a thin provisioned SAN volume and prevent the SAN from allocating blocks to the volume. As it stands, if i create a fixed size VHD on a thin provisioned san volume it will fill the volume up. This is because the SAN thinks the .vhd file is real data when in fact its a big empty file full of 0s.

With your tool, would it be possible to create a fixed size VHD without the VHD filling up a thin provisioned SAN volume?


ChrisEck wrote  Feb 1 2011 at 9:41 PM  
MattRK - Yes, this should be possible given a sufficiently sophisticated SAN system. This tool avoids performing the zeroing writes to the disk by bypassing OS security.

p3ppi3 wrote  Feb 3 2011 at 9:27 AM  
Chris, as an independent software vendor, is it possible to redistribute the vhdtool.exe?

ErikD wrote  Apr 20 2011 at 7:34 PM  
Hi ChrisEck!

It is great that you can expand disks. But how about shrinking a VHD?

How do one shrink a VHD so that the virtual machine is presented with a smaller harddrive? I am not thinking about compacting the VHD, but to actually make so the virtual machine think it is a smaller drive.

maestro98 wrote  May 1 2011 at 9:11 PM  
Super Tool, saves my time. Thanks.

noldus wrote  May 12 2011 at 9:15 AM  
I now know what Superman felt after he turned the rotation of the earth and brought Louise Lane back to life. Thank you!

ryanaxp wrote  Jun 29 2011 at 12:17 PM  
I want to add my "thank you" for providing this tool. Running the repair function on a rashly expanded base VHD saved me many hours of work this morning. Much obliged!

JohnFul wrote  Jun 30 2011 at 8:33 PM  
I wonder if you could do the same thing in PowerShell... That would get interesting.

KDAD wrote  Jul 6 2011 at 5:33 AM  
Chris and Todd, thank you SO MUCH for this tool! The repair option saved me tons of time fixing a production exchange server this morning. Is there something I can do for you? Buy you something off of your Amazon wish list? Donate to your project via PAYPAL? Thanks again!

Kenf916 wrote  Jul 12 2011 at 1:35 PM  
Great tool, very excited to see I dont have to waste time rebuilding. Used it on a copy of a full vhd for vista. Expanded the file effortlessly. Now the VM wont boot from the file. Did I miss a switch or is there something I can do to fix this (e.g. a differnt tool to put bootstrap back on vhd?) Really lost as to why this would have happened. Based VHD boots no issues.

tools2000 wrote  Sep 6 2011 at 2:08 AM  
Hope someone can help me out.
The sb2008 file was expanded while it had a snapshot. The server boot to a version of Jan 8 2011 now. I have tried running the tool but when i start the VM it is still jan 2011? I have copied the command readout.

D:\>vhdTool.exe /repair d:\vm\sb2008\sb2008.vhd D:\VM\SB2008\Snapshots\82EB8455-
Status: Resizing base VHD "d:\vm\sb2008\sb2008.vhd" to match the size in
dicated in child VHD "D:\VM\SB2008\Snapshots\82EB8455-2733-4456-B20D-46B13AFF757
Status: Attempting to open file "d:\vm\sb2008\sb2008.vhd"
Status: File opened, current size is 282119106048
Status: Attempting to open file "D:\VM\SB2008\Snapshots\82EB8455-2733-44
Status: File opened, current size is 286206223872
Status: Opened "d:\vm\sb2008\sb2008.vhd" as base VHD file, type is dynam
Status: Base VHD's identifier is "deabefca-b3dd-42bc-ba43-f67855bf723b"
Status: Opened "D:\VM\SB2008\Snapshots\82EB8455-2733-4456-B20D-46B13AFF7
57A\SB2008_660D6758-BFB5-4C30-A04E-EBADE900D6FE.avhd" as child VHD file.
Status: Child VHD's parent identifier is "deabefca-b3dd-42bc-ba43-f67855
Status: Resizing base VHD to match child size of 375809638400 bytes
Status: VHD footer generated
Status: VHD footer written to file.
Status: VHD footer written to file.
Status: Operation complete.
Status: Complete

Thanks for any comments

Nandkumar wrote  Sep 16 2011 at 6:22 AM  
Nice Tool but how to create New Dynamic VHD using this tool

JediKnight wrote  Sep 28 2011 at 1:10 PM  
It awesome tool! My avhd file was crashed after vhd file was extended and I recovered data with this utility! But this utility didn't merge vhd and avhd automatically, I did it manual after VHDTool resolve error in avhd file. Thx ChrisEck

MikeF wrote  Nov 12 2011 at 9:27 PM  
@Chris thanks for sharing this utility. Very fast. One suggestion: it would be helpful to add a validation to prevent running /extend mode on a dynamic VHD file. I did this by accident and the file was correctly resized but it was rendered unbootable and non-browsable. Fortunately I had a backup.

BlackBox wrote  Nov 29 2011 at 4:56 PM  
While running the command 'vhdtool.exe /convert blabla.001'
6 status lines returns within a second:

Status: Converting "blabla.001" to a fixed format VHD
Status: Attempting to open file "blabla.001"
Status: File opened, current size is 146778689536
Status: VHD footer generated
Status: VHD footer written to file
Status: Complete

But there is not a VHD file created!?


arnymars wrote  Jan 24 2012 at 11:50 PM  
How to Repair a broken link between a child and parent VHD, when the Diff VHD is moved to another folder or disk? Can you add this feature?

ryanm wrote  Feb 14 2012 at 10:23 PM  
I'm using vhdtool to try and create a file on an Iomega NAS device. When it gets to the "Status: Set the file length", it then gives an error of "Error: Unable to set valid data length with error: The system call level is not correct". Do you know what I'm doing wrong? To test, I'm just trying to create a small 1 GB file

Brutus wrote  Mar 24 2012 at 4:21 PM  
This tool saved my life last night, with one eye open I expanded our main database volume and need I say more. Stupid me, but Thank you

tuckman wrote  Apr 4 2012 at 5:53 PM  
This tool ruined my night two nights ago...
I resized the vhd for our Exchange 2010 server's C drive and it was made corrupt and unbootable. I was pretty sure it was a fixed disk to start with, 120GB. I was resizing to 150GB. File showed on host OS with correct size, but tried mounting in disk management and showed as 'uninitialized'. No amount of checking or repairing was able to fix it. Microsoft Support tried their magic and even looking at the disk sector by sector they weren't able to make the partitions readable - the beginning and ending markers didn't line up. Had to install Exchange on a new server with /m:recoverserver. 7 hours of downtime.
By the way, Microsoft told me they don't recommend resizing fixed-size vhd files.

tuckman wrote  Apr 4 2012 at 8:00 PM  
It is possible my disk was a dynamically resizing disk, but there should be a warning in that case.

midlifecrazy wrote  May 16 2012 at 6:33 PM  
I just used the tool and worked very quickly. I used the repair function, since my error was: the chain of virtual hard disks is broken. I just had to figure out that it needed to be in the same directory as the .vhd and .avhd to run it. This saved me a lot of time and grief. I use VMs at my customers, join them to the domain to run discovery and testing. Thanks!!!

Clearlysee2 wrote  May 19 2012 at 3:27 AM  
I have accidentally formatted a vhd machine on a drive. Windows doesn't see the files, but they are there when i check with disk rescue tools. They are multiple partitions. I don't remember if there were one vhd or 3 vhds on that drive. I believe the vhd virtual disk was partitioned into 3 different drives. It was being used for the storage of my data on a domain controller virtual disk. The domain controller vhd is intact on a different drive. But the files it need are on the partitioned vhd drive. will this tool restore the vhd file? Please help!I am not very familiar with the vhd machines. Thanks in advance.

SamL wrote  Jul 13 2012 at 6:30 AM  
The /repair function saved my SBS Essentials Servers VHD that had been resized with a snapshot, Thank you so much ChrisEck. You are truly a hero :)

DavieHooks wrote  Aug 21 2012 at 9:35 AM  
If it was in any way appropriate I would kiss you. Awesome. Saved me from my stupid self. Always slag off users for not reading the instructions but this is one of the first times I've fallen foul of OK clicking. THANK YOU!!

BrianK wrote  Sep 24 2012 at 11:28 PM  
Is the VHD file name case-sensitive in the expand command?

sballbgp wrote  Nov 21 2012 at 11:50 AM  
Amazing tool! I can't thank you enough!

stagnant wrote  Nov 26 2012 at 7:40 AM  
Add me to the list of another tired IT admin who expanded a disk that had no apparent snapshots...oops! After googling and finding this tool, a quick minute later, my VM is booting up again. Thanks!

Berto wrote  Nov 26 2012 at 10:10 PM  
I was looking for hours to solve a Problem....this Tool did it in a few seconds....i only say: the Repair-function...
Thanks a lot!

PhilipElder wrote  Jun 29 2013 at 6:35 PM  
We have used this tool extensively in both our standalone and clustered Hyper-V deploys.

Is there any plan to create a similar tool for VHDX files please?

Thanks for your great work! :)

cyberjunkie21 wrote  Jul 15 2013 at 4:56 PM  
Chris, I'm wondering if you can help with a strange situation. Had a VHD w/ snapshot. Deleted snapshot & shut down VM so we could extend the drive since it was out of space. Didn't realize merge process was happening and extended the drive. Booted up and got the error about "the chain of virtual hard disks is corrupted. there is a mismatch in the virtual sizes" but I pointed the VM to the newly extended VHD and was able to boot. It appears we have lost the data on SQL from the time the snapshot was taken Friday afternoon, until Sat morning. Am I able to use repair to merge the data back in? Are there any repercussions? Thanks,

sbanyard1977 wrote  Sep 11 2013 at 10:00 AM  
Excellent tool. Expanded the Gold image disk on our VDI deployment resulting in no boot and invalidating all of the snapshots, this repaired it in seconds. Thanks!

ChiefGeek wrote  Nov 3 2013 at 5:51 PM  
Uhmm Let's play a game called the sys AD has screwed up royally and we can use the vhd tool to help him keep his job because all 32 backups from the past month are somehow corrupt. So uhmm yeah.. I am screwed by me. Ever had those nights where you've been up for over 24 hours, you make a series of mistakes such as moving vhdx files off the hyper-v folder without first having a good backup, a recent snapshot, a backup of your backup, you make a stupid error, from left field you click, you watch the system applying your requested yet brainless change and in slow motion you hear your brain say noooooooo.... stttoooopppp.... dooooonnnnntttt.. But its too late? Ok probably not, but for whatever reason, in the middle of daylight savings change, I began to cut paste my old 2012 hyper-v vhdx files for my one server 2012 to another server as I was running rapidly out of disk space hyper-v INSTEAD OF selecting copy? That's exactly what I did, it was the first time I did not force one or more snapshots and a bare metal backup, along with a file backup... I mean, I have royally, royally, majorly messed up. big time.. the worse mistake in 23 years.. Thankfully the only major mess up, but this one is taking the cake, making itself up for all the little snafu's mother luck has helped me to avoid for all these years.. MY QUESTION BEING.. (And I am BEGGING) for help please.. please..please..) IS ther anything I should be aware of, or any tips/tricks with this tool, I can use to try anf get one of these vhdx back into production? The host is Server 2012 datacenter, the one VM is Hyper-V on Serer 2012 Datacenter.. If I happen to be in the wrong forum, I am humbly asking and begging maybe someone can soon point me in the right direction.. My screw up is so bad, I .. Wow. I don't even know what to say.. I am the cause for my own failure in this case, and wow.. oh boy oh boy oh boy.. ANY help would be appreciated.. I can mount the VHD, and get back to May 2013, but it is the 11/2 vhdx all three parent nor child I can tie up and mount then spin up without getting the following error... "the chain of virtual hard disks is corrupted" "there is a mismatch in the identifiers of the parent virtual hard disk and differencing disk". HELP!

funkguitar wrote  Mar 5 at 7:58 PM  
I concur with all the recommendations to buy you dinner or a beverage of your choice! Thanks so much for a great tool. You saved my bacon with the repair option.

avi_g wrote  Mar 20 at 5:32 PM  
can this tool take a dynamic VHD and make it fixed VHD wih only the data from the dynamic vhd (without the free space in it)?

Page view tracker