Among some other nice features:
Repairs a broken Hyper-V snapshot chain where an administrator has expanded the size of the root VHD.
The base VHD will be returned to its original size.
"Repair" function which is designed to undo an expand operation on a base VHD when differencing VHDs are present. This is useful in cases where an admin accidentally expands a base VHD when Hyper-V snapshots are present.
To ensure data integrity in the case of an error, please make a backup copy of your VHDs before altering them with this tool.
VHD tool is an unmanaged code command-line tool which provides useful VHD manipulation functions including instant creation of large fixed-size VHDs. The source code is included.
VhdTool.exe /create <FileName> <Size> [/quiet]
VhdTool.exe /convert <FileName> [/quiet]
VhdTool.exe /extend <FileName> <NewSize> [/quiet]
VhdTool.exe /repair <BaseVhdFileName> <FirstSnapshotAVhdFileName> [/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 RAW disk image 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>.
Repair: Repairs a broken Hyper-V snapshot chain where an administrator
has expanded the size of the root VHD. The base VHD will be
returned to its original size. THIS MAY CAUSE DATA LOSS if the
contents of the base VHD were changed after expansion.
The web site for download the tool is missing. :-(