灌溉梦想,记录脚步
« »

VirtualBox虚拟硬盘的压缩

用 Sun VirtualBox 软件虚拟出来的硬盘文件是 VDI 文件,这个文件会随着使用而变大,因为磁盘碎片的产生,这个文件里也有很多的没用的空闲空间,为了节省空间,就需要对 VDI 文件进行压缩。

指导思想
1. 虚拟机: 清理系统,卸载、删除系统垃圾文件
2. 虚拟机: 将磁盘数据靠“前”移动,并将剩余磁盘空间写“零”
3. 物理主机: 清除“零”字节空间,使用 VBoxManage modifyhd 工具压缩 VDI 磁盘镜像文件

Windows 虚拟机
1. 虚拟机: 删除系统垃圾文件,运行磁盘整理程序…
2. 虚拟机: 用 SDelete 工具写”零”,下载地址 http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx,下载后存到 Windows\System32\目录中,在命令行下执行 “sdelete -c”… 关机…
sdelete -c c:
3. 物理主机: 执行 “VBoxManage modifyhd /the-path-of-VDI.vdi –compact”
使用这个命令时可能出错,错误信息是:“Shrink hard disk operation is not implemented!”有高人写了一段小代码,实现了这个功能,PackVDI,下载地址:http://jerome.hode.free.fr/opensource/PackVDI.zip。执行 PackVDI 文件名即可。

Linux 虚拟机
1. 虚拟机: 清理、卸载系统垃圾文件
2. 虚拟机: 写“零”,好像 “dd if=/dev/zero of=/fillerup.zero” 方法并不是很有效,几经苦难在 官方网站找到一个很老的“终极办法” (链接)!
2.1 用一张 LiveCD (ubuntu) 启动虚拟机,使用 System – Administration – GParted 分区软件,将虚拟硬盘空间收缩到最小,应用…
2.2 在刚才腾出来的空间上建立新分区,执行 “dd if=/dev/zero of=/dev/{?}”, 然后删除此分区
2.3 回到主分区,恢复它的所有空间,应用 … 关机…
3. 物理主机: 执行 “VBoxManage modifyhd /the-path-of-VDI.vdi –compact”

日志信息 »

该日志于2011-07-17 02:01由 kevin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

13 条评论

  1. livraison de nuit en ligne kamagra

    pharmacie-fr kamagra

  2. ordering enclomiphene generic usa

    cheapest buy enclomiphene us prices

  3. cheap androxal canadian discount pharmacy

    discount androxal generic online pharmacy

  4. discount flexeril cyclobenzaprine generic name

    how to buy flexeril cyclobenzaprine united kingdom

  5. dutasteride achat

    buy cheap dutasteride generic where to buy

  6. buying gabapentin generic available in united states

    online order gabapentin lowest cost pharmacy

  7. discount fildena cheap alternatives

    buying fildena generic pharmacy usa

  8. cheapest buy itraconazole purchase online uk

    order itraconazole uk in store

  9. buying avodart online from canada

    how to order avodart price new zealand

  10. purchase staxyn cheap no prescription

    how to buy staxyn cheap buy online no prescription

  11. buying rifaximin real price

    order rifaximin generic canada no prescription

  12. order xifaxan usa overnight delivery

    cheap xifaxan uk order

  13. fedex kamagra přes noc

    cvs kamagra ceny

发表回复