加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

VirtualBox 收缩 vdi镜像文件

发布时间:2020-12-14 03:55:31 所属栏目:Windows 来源:网络整理
导读:VirtualBox?guest os用久了vdi文件就会越来越大,就算在guest os中删除了一些文件,vdi也不会变

VirtualBox?guest os用久了vdi文件就会越来越大,就算在guest os中删除了一些文件,vdi也不会变小。

如果guest os 是windows:

?

1、先在guest os上运行磁盘碎片管理器,将各个磁盘的磁盘碎片减少;

2、下载sdelete(http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx);

3、运行sdelete -c -z ;

4、关闭guest os 和 VirtualBox

5、在host os上运行VBoxManage modifyhd?--compact?yourImage.vdi

如果guest os 是Linux:

?

1、进入su

2、$ dd if=/dev/zero of=test.file

3、$ rm test.file

4、关闭guest os 和 VirtualBox

5、在host os上 运行?$ VBoxManage modifyhd --compact yourImage.vdi

这样在guest上看到占用的空间就和host上看到的空间就一样了。

作业环境:host os :Scientific Linux 6.1(X64)

? ? ? ? ? ? ? ? ?guest os:Windows xp,Scientific Linux 6.1(X64)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读