diskpart command confusion

Posted on 2011-09-14
Last Modified: 2012-06-21
I am following a process to create a pc to boot from vhd only.

Part of the diskpart command is to create a vdisk file.
Create vdisk file=c:\7ent.vhd maximum 40960 type=expandable.

I read this as the vhd file will max out at 40gb and the vhd should be large enough to install Window 7.

When all is complete and I do boot from the vhd and check the size of the VHD, it is already 40gb.

What am I missing? What is the point of setting a maximum and type =expandable if the vhd will already be 40gb.

I also tried creating a vhd file only 7gb (large enough to install windows)  If I try to copy above the 7gb I get the message not enough disk space. No being expanded.

Can someone explain this to me?

All help is appreciate.
Question by:maquet
  • 4
  • 3
  • 2
LVL 117
ID: 36537366
The VHD that is being booted from will expand to the maximum size specified at creation.  It will revert to the used size when you shut it down.  

Expert Comment

ID: 36537372
When you boot the vhd?  I think it needs to tell the OS that the drive is 40gb for file system reasons.  I think the 'host file' (the vhd itself) will only take up an expandable amount of space on the host volume.  
LVL 117
ID: 36537384
In answer to your question, storage of the VHD, when the machine is off, it will use less disk space, but also a word of caution here, you must ensure, you have at least the expandable size, to start to boot the machine.

So this process will allow you to boot multiple machines (at different times), as the stored machines will be less.

Some people confuse this with VMware Thin provisioned disks. Where disks start small (due to storage in use) and grow to the max of the disk and stop.

Author Comment

ID: 36537399
So if boot from a usb stick and look at the size of the vhd it will not be 40 gb?  
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)


Accepted Solution

megaman5 earned 500 total points
ID: 36537404
Wrong, just as thin provisioned disks, the on-disk space used is equal to the data size and meta data.


Expert Comment

ID: 36537411
If you are storing the vhd on a usb disk, and you are not booted to it, it should only show used size plus meta data.  There is no 'expanding and contracting' on boot and shutdown, just a layer of abstraction where the on disk size is kept as small as the data.


Expert Comment

ID: 36537453
If the vhd didnt 'fake' the os thinking that it is 40gb, you would always be out of free space and applications would fail when requesting disk space.  so when you are booted to the vhd, it 'lies' to the os saying that its already 40gb, and just resizes in the background.
LVL 117
ID: 36537488
when you boot will always be the expandable size.

Author Closing Comment

ID: 36816586
Nice article but I still cannot do what I am trying to do.

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now