Avatar of jmohan0302
 asked on

Concepts of .VHD file and .VHDx file formats

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.

Avatar of undefined
Last Comment
David Johnson, CD

8/22/2022 - Mon
Philip Elder

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.

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.
David Johnson, CD

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Muhammad Burhan

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

Any detailed explanation is appreciated?

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 Elder

 + 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
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
David Johnson, CD

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