Concepts of .VHD file and .VHDx file formats

jmohan0302 used Ask the Experts™
A  Hyper-V VM has following drives C:\ and E:\. Below are the space specifications of C: and E: drive:

Total Size of C: drive is 270 GB and Free Space is 160 GB.
Total Size of E: drive is 1 TB and free space is 0.9 TB

 I used disk2vhd tool to create a online clone of the drives of the VM. When I ran the disk2vhd utility it created the .VHD file of C: drive for only 45 GB and E: drive of around 100 GB. Then I created a new VM using the newly created .VHD files of C: and E: drive.  After booting the new Virtual machine I could see the original 270 GB of C: drive with free space of 160GB and E: drive of 1TB and free space of 0.9 TB.
Now I would like to know how the .VHD file is created only with 45GB for C: drive and 100 GB for E: drive and when converted as a virtual machine it provides the exact format and size of the disk. Can anyone help me to know what exactly happens when converting to .VHD format and how it compresses the data size.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Philip ElderTechnical Architect - HA/Compute/Storage

Swap and Hibernation files would represent a huge chunk of space from the original.

Volume Shadow Copy snapshots can take up a huge hidden chunk of space too (Previous Versions).

Those may not have carried over.
Distinguished Expert 2017

The VHd is supported as a disk 2008/7 vhdx is an enhanced version that can be used on 2012/8/10 as well as backwards compatible to vhd.
Now the disk2vhd creates a disk that can expand but initially is the size of the used space of the source.
I.e your c: and e: use 45gb and 100gb respectively.
Top Expert 2016
your pagefile.sys/hiberfil.sys and other large areas i.e. System Volume Information  are not copied over.
Only the required areas are copied and uses a dynamically expanding disk
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Muhammad BurhanManager I.T.
Top Expert 2015

for example if we copy a 10GB file to the 50GB dynamically expanding disk type so it consumes 10GB from 50GB, but what if you delete that 10GB file from there ?

after deleting that 10GB file the actual capacity of VHD doesn't decreases. Now when you perform conversion/editing on VHD then it convert/edit the VHD with its existing capacity.

in your case it seems that C drive consumed 270GB out of 430GB in past in-terms of folders/files, System Volume Information, Recycled items, pagefile and hibersys file etc. After conversion/editing it only consider actual capacity for new VHD file.


Any detailed explanation is appreciated?
Distinguished Expert 2017

I do not understand what it is you are looking for
VHDx was added with the newer windows 8 and windows 2012 server version.
It is supposed to be an "enhanced version" of the  VHD which is the only format 2008's Hyper-V can handle.
Philip ElderTechnical Architect - HA/Compute/Storage

 + Limited to 2TB in size
 + Limited to 512n drives

 + Limited to 64TB in size
 + Can run on 512n, 512e, and 4Kn drives
 + Custom block sizes/formats
 + Online Resizing

TechNet: VHDX Overview
Top Expert 2016

A detailed explanation of what exactly?
Why the VHD is smaller than the used space on the source drive.. We already told you that files that are of no consequence are NOT copied and this includes the System Volume Information files, Recycle Bin, any .tmp files, pagefile.sys, hiberfil.sys

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial