virtual box 映象檔縮小法 - Linux

Table of Contents


VirtualBox 的映像檔隨著時間的使用,會不斷的長大,即使 guest (windows)
只用到 5 G,映像檔還是有可能使用超過 10 G 的。

解決方法是先清除 (guest) windows 佔用的未使用區塊:

c:\sdelete.exe -c

sdelete 可以在 ms 那下載:

http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx

清理完後,關閉 guest。

再到 ~/.VirtualBox/VDI/ 找 foo.vdi (看你當時用什麼名稱,這裡用 foo 代替)
再執行:

VBoxManage modifyvdi foo.vdi compact

就好囉!
怕的話,縮小之前先備份 vdi 檔。

--

All Comments

Mary avatarMary2008-04-26
我之前都是到Vbox下載 shrank 的binary程式.....
Oscar avatarOscar2008-04-30
shrink, modifyvdi 都只能回收未佔有空間,要真的壓縮
Blanche avatarBlanche2008-05-04
一定要先清掉 (zero out) 被空白佔有的空間