VHDTool – VHD 파일을 조작할 수 있는 툴과 소스

VHDTool - a must have

https://blogs.msdn.com/robertvi/archive/2010/02/25/vhdtool-a-must-have.aspx

위의 포스트에서는 VHD 파일을 조작할 수 있는 툴을 소개하고 있습니다. VHD 파일은 VM에서도 사용되고 Windows 7 이나 2008 R2 에서 직접 사용할 수도 있어서 아주 유용한 툴이 될 것 같습니다. 거기다 아래 링크에서 다운 및 소스를 받으실 수 있습니다. 소스를 통해 동작을 이해할 수 있어서 더 좋아 보입니다.

https://code.msdn.microsoft.com/vhdtool

 

사용법은 아래와 같습니다.

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>.
         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.

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.

 

Examples
Create a new 10 GB fixed VHD in the current directory.
VhdTool.exe /create "c:\Program Files\MyApp\foo.vhd" 10737418240

Convert an existing flat image file into a VHD & do not output status to the command line.
VhdTool.exe /convert bar.img /quiet

Extend an existing fixed format VHD to a larger size.
VhdTool.exe /extend foo.vhd 21474836480

Repair a Hyper-V snapshot chain broken by expanding the base VHD.
VhdTool.exe /repair base.vhd base_EF2F9402-E85B-402F-A979-631CB287C2C4.avhd