FREE: VHD tool – Create, convert, and extend a VHD quickly

Michael PietroforteMVP By Michael Pietroforte - Fri, April 24, 2009 - 0 comments google+ icon

Michael Pietroforte is the founder and editor of 4sysops. He is a Microsoft Most Valuable Professional (MVP) with more than 30 years of experience in system administration.

Contents of this article
  1. VHD tool

Have you ever wondered why it takes so long to create a fixed virtual hard disk (VHD) in Hyper-V or Virtual Server 2005? The Virtual PC Guy dealt with this issue in a blog post. The reason is that the hard disk space assigned to the VHD is wiped out. This is just as if you are using a tool like Active@ Kill Disk to make sure that deleted data can’t ever be recovered again. The process is so time-consuming because every byte on the disk has to be overwritten.

It is unnecessary to zero out dynamically growing disks, because they only occupy disk space when they actually write data to disk, thereby erasing all the data still stored on the corresponding hard disk sectors. Fixed virtual disks already occupy the hard disk’s space before the virtual machine writes data on it. Therefore, if you don’t wipe out the data on the disk, it is possible to recover data that has been stored on the hard disk before the space was assigned to the VHD.

What I wasn’t previously aware of is that this is even possible if you move the VHD to another host. This is probably the main reason why such “low level formatting” is required for fixed VHDs. As opposed to hard disks, VHDs can easily be moved to other locations, where people who should not be able to access data from the original host might have access to it.

Of course, in most environments virtual machines are only moved to hosts where the same administrators are responsible. This is where the VHD tool comes in. You can use it to create VHDs without having to first bother with the time-consuming wiping of the corresponding hard disk space. It can also be used to convert and extend existing VHDs.

This is the VHD tool’s usage description:

VhdTool.exe /create <FileName> <Size> [/quiet]
VhdTool.exe /convert <FileName> [/quiet]
VhdTool.exe /extend <FileName> <NewSize> [/quiet]

Create: Creates a new fixed format VHD of size <Size>.
WARNING – this function is admin only and bypasses
file system security. The resulting VHD file will
contain data which currently exists on the physical disk.

Convert: Converts an existing file to a fixed-format VHD.
The existing file length, rounded up, will contain block data
A VHD footer is appended to the current end of file.

Extend: Extends an existing fixed format VHD to a larger size <Size>.
WARNING – this function is admin only and bypasses
file system security. The resulting VHD file will
contain data which currently exists on the physical disk.

VHD tool

Disclaimer
Your question wasn't answered? Please ask in the new 4sysops forum!
Please share your thoughts in a comment!

Login

Lost your password?