diskpart command confusion

Posted on 2011-09-14
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
LVL 122
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 122
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.
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.


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?  

Accepted Solution

megaman5 earned 2000 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 122
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

743 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