Hyper-V Program Manager
A while ago I talked about why it takes so long to create a virtual hard disk, and a lot of people came back and said that in controlled environments they were willing to take the security risks / implications involved in order to have quick creation of fixed size virtual hard disks.
In response to this we have made a tool available that does just this:
This tool allows you to create fixed size virtual hard disks very rapidly. You should be aware that the technique used means that it is possible to access data that was previously deleted off of the physical hard disk by running data recovery tools inside the virtual machine. As such you should only use this tool when you can trust all users of the virtual machine.
Ben - many, many thanks for this. Most of my fixed vhds are created on "virgin" disks - meaning there's no data on them, so need to over-write empty space with zeroes. This will slash provisioning time without the compromise of using a dynamic vhd.
This is a great tool. Would this feature be available in a future version of Hyper V Manager? Say as an option with the necessary warning?
Awesome. This will be a massive timesaver.
I posted this on the vhdtool webpage:
"I just tried this tool, using the command line above for creating a 10GB fixed VHD. On the host, I got a 10GB .vhd. I use a partitioning tool, Bootit NG (http://www.terabyteunlimited.com) which can boot from floppy and do things like resizing partitions. So, I pointed a VMC to the new VHD, and booted with a Bootit NG floppy image, which took me to Bootit NG. I had intended to use Bootit NG to resize a partition, but when I look at the VHD in Bootit NG "Partition Work", instead of a 10GB "HD0", I had an ~130GB "drive"! Is it because this tool doesn't zero out the data and so Bootit NG is getting confused about the partition sizes? Any ideas about why this might be?"
I also posted about the problem on Terabyte Unlimited's support newsgroup, and the response I got was:
"BING just uses what the BIOS reports."
so, apparently, with a VHD created using vhdtool, the VPC guest's BIOS is reporting, in my case, 130GB.
Any idea why that might be and how to work around the problem?
I just tried it again. I used this command to create the VHD:
P:\foo>VhdTool.exe /create "p:\foo\foo.vhd" 10737418240
Status: Creating new fixed format VHD with name "p:\foo\foo.vhd"
Status: Attempting to create file "p:\foo\foo.vhd"
Status: Created file "p:\foo\foo.vhd"
Status: Set the file length
Status: Set the valid data length
Status: VHD footer generated.
Status: VHD footer appended.
Status: VHD header area cleared.
Volume in drive P is WD120GB
Volume Serial Number is EC15-9FC3
Directory of P:\foo
04/09/2009 06:52 PM <DIR> .
04/09/2009 06:52 PM <DIR> ..
04/09/2009 06:52 PM 10,737,418,752 foo.vhd
So, the foo.vhd is 10GB on the physical drive.
When I boot into the BING from floppy, BING shows HD0 with an empty area of 130552 MB of free space.
If I go to the VPC guest's BIOS at boot, it says:
Device : Hard Disk
Vendor : Virtual HD
Size : 136.9GB
LBA Mode : Supported
Block Mode: 128Sectors
PIO Mode : 4
Async DMA : MultiWord DMA-2
So, it definitely looks like the guest's BIOS thinks that it's a 130GB drive.
Any ideas how to fix this problem?
I created a smaller VHD so that I could see it in a hex editor:
P:\foo>VhdTool.exe /create "p:\foo\foo.vhd" 13631488
and then I used VPC2007's VHD wizard to create the same size VHD, foo1.vhd.
Looking a foo.vhd vs. foo1.vhd, it looks like the "Disk Geometry" in the footer is different:
foo.vhd (created by vhdtool.exe):
foo1.vhd (created by VPC2007 wizard):
Why is the "Disk Geometry" in the footer in the VHD created by vhdtool.exe different?
BTW, I just tried another test, creating a 5GB+ VHD, then installed Win2K. Disk Management (in Computer Management) sees Disk 0 as a 127.49GB drive!!
So, it's not just Bootit NG that thinks that the vhdtool-created VHD is a 130GB drive... Win2K Disk Management also sees a 130GB drive :(...
I'm wondering, has anyone actually used vhdtool.exe to create a VHD, and then installed, say, Win2K on the VHD, and had Win2K report the "correct" disk size?
It sounds like there are a lot of people that are misunderstanding this tool. Given that it is unanswered and first hit on bing searches I'd like clarify the behavior.
Vhdtool.exe works by extending the end of file pointer of vhd. This gives it the great speed as its an index update but leaves the security vulnerability that the physical bytes are not zeroed out. Due to being a security risk it will never be shipped in a future release.
After AttachVirtualDisk() has occured the vhd to be treated as a larger Win32_DiskDrive. Inside of that DiskDrive are many "partitions" (Win32_Volume) which will all contain the existing values. Until the volumes have been expanded there is no way to utilize the additional space. This is why the values do not increase initially inside of the OS.
I dont know of these random tools people are using as everything is freely built into Windows. Right click on My Computer->Manage and navigate to Disk Management. Select the volume and request Extend Volume to solve those problems.
When I use this one some disks I get a hung server after the point where the tool tells me that VHD footer generated. It just hangs and the only way out is to reboot the server. What is going wrong? It worked on other servers, they are all manager with VMM 2012, have disks on cluster shared volumes.
Any chance of getting this tool updated to created VHDX files?