VHD工具-VHDTOOL

因为想对Hyper-V上Guest VM的VHD进行扩容.开始想找有没有online的办法,结果发现网上都说需要把VM关机后通过Disk configure extend .后来发现MSDN Archive上有个叫VHDTool.exe 的工具,可以快速对VHD文件进行操作,比如 新建 ,扩展,转换.速度还很快.经过试验后,确实很好用:)

 

附上使用方法:

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

新建 一个1G左右大小的Test.VHD

vhdtool.exe /create D:\Test.vhd 1000000000

把test.vhd 扩展到2G左右

vhdtool.exe /extend D:\test.vhd 2000000000

后面size的计算是根据byte大小,和实际产生的文件会有误差.

 

下面是原文地址:

http://archive.msdn.microsoft.com/vhdtool

 

 

 

 

你可能感兴趣的:(tool,VHD)