如何缩减VMware虚拟机的磁盘空间

本文介绍了一种有效的方法来减少VMware虚拟机所占用的硬盘空间。通过整理虚拟磁盘碎片、压缩磁盘并创建新的虚拟磁盘文件,可以显著减少未使用空间,从而节省大量硬盘空间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

引自:http://blog.youkuaiyun.com/justinavril/article/details/8687975


In my laptop, I have two virtual machines, and their VM disks take about 80GB-100GB hard disk. But if you mount the VM disks, you will find that half of the space is pre-occupied, but not used. Luckily, VMware provides some ways of shrinking the VM disks. I’ll take my Windows XP VM as an example to tell how to reduce the hard disk space of VM.

我的笔记本上有两个虚拟机,它们的虚拟磁盘占用了大约80GB-100GB硬盘。但如果加载上这些虚拟磁盘,你会发现其中有一半的空间都是预分配而没有使用的。幸运的是,VMware提供了一些途径来压缩虚拟磁盘。(下面)我将以我的Windows XP 虚拟机为例,介绍怎样降低虚拟机(占用)的硬盘空间。



1. Find the Virtual Machines folder. Normally, it locates ‘C:\Users\<your NT ID>\Documents\Virtual Machines\<specified VM>’ and in this case, it’s ‘C:\Users\wuj28\Documents\Virtual Machines\WinXP’. You can find there is one file, whose extension is vmdk, and size is about 25GB. This is the target we’re going to shoot today. If you have a good memory, the value of 25BG is set by the VM creator, and its value can be viewed in the VM settings.

1、找到虚拟机文件夹。通常它位于‘C:\Users\<your NT ID>\Documents\Virtual Machines\<specified VM>’ ,针对此例就是在‘C:\Users\wuj28\Documents\Virtual Machines\WinXP'。你会在这找到一个扩展名为vmdk、大小约为25GB的文件。这就是我们今天要操作的目标。如果你还记得的话,25GB这个参数值是VM creator设定的,可以在VM设置(VM Machine Settings)里看到。


2. Defrag the VM disk. 

2、运行虚拟机的磁盘碎片整理
a. Run the CMD as the administrator, and go to the VM folder. 

a、以管理员身份运行命令行(CMD),进入虚拟机文件夹
b. Run the vmware-vdiskmanager to defrag the VM disk.

b、运行vmware-vdiskmanager来进行虚拟机的磁盘碎片整理

c. Repair the VM disk file after the defragment.

c、磁盘碎片整理完毕后,修复虚拟机磁盘文件

d. Shrink the VM disk and repair again.

d、压缩虚拟机磁盘,再次修复

Now we have a very solid VM disk file.

现在我们拥有一个非常可靠的虚拟机磁盘文件
3. Create the new VM disk file by converting the original one.

3、通过转换原有文件来创建新的虚拟机磁盘文件


You can find the new VM disk file is a lot less than the original one. Now you can move the original VM disk file to another folder, and rename the new VM disk file as the original one. Then power on your VM. If there is no problem, you can shift-delete the old & fat VM disk file now, and the disk space comes back大笑

你会发现新的虚拟机磁盘文件比原有文件小了许多。现在,你可以将原有虚拟机磁盘文件移动到其他文件夹下,将新的虚拟机磁盘文件名称改成原有文件那样。然后启动你的虚拟机。如果没问题,你就可以永久删除那个又老又臃肿的虚拟机磁盘文件了,(浪费掉的)磁盘空间又回来啦!


TIP: These operations need you have enough disk space, so if you have snapshots for VMs, you can deleted them all. It will free some GBs space, depends on how many snapshots you have.

小贴士:这些操作需要你有足够的磁盘空间,因而如果你有虚拟机快照,你可以将它们统统删除了。根据你快照的数目多少,这样会释放出大约几个GB计的空间。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值