Windows 7 上玩 VHD 的筆記 (2)

July 6th, 2009

上一篇提到了如何製作 VHD 並從 VHD 去開機,接下來就是要怎麼做成像硬碟保護卡的功能了。首先仍舊從 Windows 7 安裝光碟開機,按 Shift-F10 叫出命令列,我們得先造一個 differential VHD: (你得先找找原來的 VHD 現在所在的碟是哪一顆,例子中是 D 碟)

diskpart
create vdisk file=d:\win7-diff.vhd parent=d:\win7.vhd
exit

接下來就是用 bcdedit,把開機的映像指到新造的 win7-diff.vhd 去

bcdedit /set {default} device vhd=[locate]\win7-diff.vhd
bcdedit /set {default} osdevice vhd=[locate]\win7-diff.vhd

這樣日後對於系統所有的改變,都會只寫入 win7-diff.vhd,而不會動到原來的 win7.vhd。因此若是系統遭受破壞的時候 (例如中毒或是軟體灌壞了),只要用 Windows 7 光碟開機,殺掉 win7-diff.vhd,再重複上面造 win7-diff.vhd 以及 bcdedit 的步驟 (因為 GUID 會變更) 就可以將系統回復成乾淨而良好的狀態了。

若是灌好軟體後要把這些變更合併成新的基底檔案要如何做呢? 照例用 Windows 7 光碟開機,然後 Shift-F10 叫出命令列

diskpart
select vdisk file=d:\win7-diff.vhd
merge vdisk depth=1
exit

這樣 win7-diff 的內容就會被合併到 win7 裡頭了。

Windows, 技術文章 | Comments Jump to the top of this page

One comment on “Windows 7 上玩 VHD 的筆記 (2)”

  1. 01

    cool!

    感謝你的兩篇win7 vhd文章

    wy at July 27th, 2009 around 7:32 am
    Jump to the top of this page

隨便寫寫大家隨便看看的不出名小格子

舊文索引

站內管理