vhd修復工具vhdtool,資源比較難找
1小時
如果使用vhd中一不小心斷電了,vhd就報錯.
提示無法裝載,檔案或目錄損壞!
gogo好久找到一個死鏈:
受不了
2小時
然後又找到了:vhdxtool
http://systola.com/support/KB100005
結果都沒有修復功能.
3小時
又找到一個:
https://web.archive.org/web/20130504064711/http://archive.msdn.microsoft.com/vhdtool/Release/ProjectReleases.aspx?ReleaseId=5344
結果不能下載.
4小時
還找到了這個:
https://blog.workinghardinit.work/tag/vhd-tool/
結果沒有修復功能
5小時:
又上github
https://github.com/andreiw/vhdtool
可惜根本不是我需要的哪個版本.只是同名而已
.
6小時:
最後終於找到了:
http://www.mediafire.com/download/f96bmsvjz4qdvbu/VhdTool.zip
版本為2.0,大小為58K(gogo: vhdtool 2.0 )
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. 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.
然後 repair
然後我還上傳了百度盤,有需要的哪去,可惜沒有找到原始碼:
http://pan.baidu.com/s/1qY25NrQ
由於我沒有avhd(備份檔案所以這個辦法行不通)
7 結果
研究了好久,發現損壞的vhd可以用diskgenius開啟,可以讀出檔案!
說明vhd只是ntfs系統不完整.
其實只要chkdsk一下就可以了.但是chkdsk不支援虛擬磁碟!!
猜想:
還可以上終極大法!
安裝virtualBox,把vhd檔案當硬碟映象!然後進入虛擬機器chkdsk!
可惜它讀取vhd不像虛擬光碟機一樣直接讀取的,會報錯.不能載入.
還可以用hyper-v方式來處理,參考:
http://www.techieshelp.com/hyper-v-vhd-the-file-or-directory-is-corrupted-and-unreadable/
8 另外的
還有通過程式來解決
vb和C#/vbs都可以連線系統硬體掛載服務
如下連線:
https://msdn.microsoft.com/zh-cn/library/cc136982(v=vs.85).aspx
9 用指令碼來解決
比較方便的是用指令碼來解決: (powsershell)
$VHDName = "V:\serverx.vhd"
#Get the MSVM_ImageManagementService
$VHDService = get-wmiobject -class "Msvm_ImageManagementService" -namespace "root\virtualization" -computername "."
#Now we mount the VHD
$Result = $VHDService.Mount($VHDName)
chkdsk
只能在windows server 2008上這樣操作.(要安裝 hyper-V管理工具:關閉或開啟windows功能 )
注:windows sever 2008以後 namespace有v2 (win10上成功, win7 沒有hyper-v管理工具)
相應的命令要改成: Get-WmiObject -computername "." -namespace "root\virtualization\v2" -class "Msvm_ImageManagementService"
還是萬能的stackoverflow強大.
http://stackoverflow.com/questions/tagged/vhd
10 回到起點
windows系統支援虛擬硬碟. 所以" 虛擬硬碟軟體工具"很少,不像虛擬光碟機一大把.
https://social.technet.microsoft.com/Forums/windowsserver/en-US/a08ad18f-4b6a-46a0-bd1f-274fbbc5b737/attach-a-vhd-in-windows-7
用diskpart attach abc.vhd
然後 chkdsk