By default, VMware creates “growable” disks that grow larger in size as you add data. Unfortunately, they don’t automatically shrink when you remove data. You’ll need to clean up or compact your disks to actually free up space on your hard drive.
默认情况下,VMware创建“可增长”磁盘,这些磁盘在添加数据时会变得越来越大。 不幸的是,它们在删除数据时不会自动缩小。 您需要清理或压缩磁盘以实际释放硬盘驱动器上的空间。
The process is a little different on different versions of VMware. We’ll cover the process for VMware Player, VMware Fusion, and VMware Workstation here.
在不同版本的VMware上,此过程略有不同。 我们将在此处介绍VMware Player,VMware Fusion和VMware Workstation的过程。
Before you begin, you may want to free up additional space inside the virtual machine. Empty your recycle bin, uninstall programs you don’t use, and delete other unnecessary files to free up space.
在开始之前,您可能要释放虚拟机内部的其他空间。 清空回收站,卸载不使用的程序,并删除其他不必要的文件以释放空间 。
This process only works with growable, or “sparse”, disks. Preallocated disks are always their maximum size. If you have a preallocated disk you want to compact, you’ll need to convert it to a growable disk before continuing.
此过程仅适用于可增长或“稀疏”的磁盘。 预分配的磁盘始终是其最大大小。 如果您有要压缩的预分配磁盘,则需要先将其转换为可增长磁盘,然后再继续操作。
Your virtual machine probably has a growable disk, though. VMware Player can only create growable disks, VMware Fusion always uses growable disks unless you allocate the disk space in a virtual machine’s settings after creating it, and VMware Workstation creates growable disks unless you go into the custom settings and check “Allocate all disk space now” while creating a new virtual machine.
但是,您的虚拟机可能具有可扩展磁盘。 VMware Player只能创建可增长的磁盘,除非在创建后在虚拟机的设置中分配了磁盘空间,否则VMware Fusion始终使用可增长的磁盘,除非您进入自定义设置并选中“立即分配所有磁盘空间”,否则VMware Workstation会创建可增长的磁盘。 ”,同时创建新的虚拟机。
On VMware Workstation or VMware Player, right-click a virtual machine and select “Settings”. Check whether it says “Preallocated” next to the disk’s size in the Summary view or not.
在VMware Workstation或VMware Player上,右键单击虚拟机,然后选择“设置”。 检查“摘要”视图中磁盘大小旁边是否显示“ Preallocated”。
On VMware Fusion, select a virtual machine and click Virtual Machine > Settings > Hard Disk > Advanced options. Check whether the “Pre-allocate disk space” option under Advanced options is checked or not.
在VMware Fusion上,选择一个虚拟机,然后单击虚拟机>设置>硬盘>高级选项。 检查是否选中了“高级”选项下的“预分配磁盘空间”选项。
VMware Player doesn’t have the convenient “Clean Up Disk” button you’ll see in paid VMware products, but you can still do this with a few options in its interface.
VMware Player没有在付费VMware产品中会看到的便捷的“清理磁盘”按钮,但是您仍然可以通过其界面中的一些选项来执行此操作。
In VMware Player, first power off your virtual machine. You can’t compact its disk if it’s powered on or suspended.
在VMware Player中,首先关闭虚拟机电源。 如果电源已打开或挂起,则无法压缩其磁盘。
With the virtual machine powered off, select it and click “Edit virtual machine settings”, or right-click it and select “Settings”.
关闭虚拟机电源后,选择它并单击“编辑虚拟机设置”,或右键单击它并选择“设置”。
Click the “Hard Disk” option in the device list on the Hardware tab.
单击“硬件”选项卡上设备列表中的“硬盘”选项。
First, click the “Defragment” button under Disk utilities to defragment the virtual machine’s disk.
首先,单击磁盘工具下的“碎片整理”按钮以对虚拟机的磁盘进行碎片整理。
When VMware finishes the defragmentation process, click the “Compact” button under Disk utilities. VMware will compact the underlying virtual hard disk (.vmdk) files to free up space.
VMware完成碎片整理过程后,单击“磁盘”实用程序下的“压缩”按钮。 VMware将压缩基础虚拟硬盘(.vmdk)文件以释放空间。
VMware Player does not support snapshots, so you won’t have any snapshots taking up additional space on your computer.
VMware Player不支持快照,因此您不会有任何快照占用计算机上的额外空间。
In VMware Fusion, first power down a virtual machine. You can’t do this while a virtual machine is powered on or suspended.
在VMware Fusion中,首先关闭虚拟机。 虚拟机开机或挂起时,您无法执行此操作。
In the main VMware Fusion window, select a virtual machine and click the “Refresh Disk Space” icon to the right of its disk usage, at the bottom right corner of the window. You won’t see up-to-date disk usage information for the virtual machine until you do this.
在VMware Fusion主窗口中,选择一个虚拟机,然后在其窗口右下角,单击其磁盘使用情况右侧的“刷新磁盘空间”图标。 在执行此操作之前,您将看不到虚拟机的最新磁盘使用信息。
The yellow “Reclaimable” data is how much space you can free up by cleaning up your virtual machine. If your virtual machine has free space you can reclaim, you’ll see a “Clean Up Recommended” message appear at the bottom of the window. Click it to continue.
黄色的“可回收”数据是您可以通过清理虚拟机释放多少空间。 如果您的虚拟机具有可用空间,则可以回收,您将在窗口底部看到“建议清理”消息。 单击它继续。
Click the “Clean Up Virtual Machine” button in the window that appears. VMware will automatically clean up your virtual machine and you’ll free up however much space appears as “Reclaimable” here.
在出现的窗口中,单击“清理虚拟机”按钮。 VMware将自动清理您的虚拟机,并且您将释放很多空间,但此处显示为“可回收”的空间很大。
VMware Fusion also allows you to create snapshots, which capture a virtual machine’s state at a point in time. If these are using a lot of space according to the disk usage information here, you can delete snapshots to free up space if you no longer need them.
VMware Fusion还允许您创建快照,以捕获某个时间点的虚拟机状态。 如果根据此处的磁盘使用信息,这些磁盘占用了大量空间,则可以删除快照以释放空间,如果不再需要它们。
To view snapshots, select a virtual machine in the main Virtual Machine Library window and click the “Snapshots” button on the toolbar. Select a snapshot and click “Delete” to delete it.
要查看快照,请在“虚拟机库”主窗口中选择一个虚拟机,然后单击工具栏上的“快照”按钮。 选择一个快照,然后单击“删除”将其删除。
You won’t be able to restore your virtual machine to that point in time after deleting the snapshot, of course.
当然,删除快照后,您将无法将虚拟机还原到该时间点。
In VMware Workstation, first power off the virtual machine you want to compact. You can’t complete this process if it’s powered on or suspended.
在VMware Workstation中,首先关闭要压缩的虚拟机的电源。 如果电源已打开或已暂停,则无法完成此过程。
Select the virtual machine you want to compact in the main window and click VM > Manage > Clean Up Disks.
在主窗口中选择要压缩的虚拟机,然后单击VM>管理>清理磁盘。
The tool will analyze the selected virtual machine’s disk and show you how much space you can reclaim. To reclaim the space, click “Clean up now”.
该工具将分析所选虚拟机的磁盘,并向您显示可以回收多少空间。 要回收空间,请单击“立即清理”。
If no space can be freed, you’ll see a “Cleanup is not necessary” message here instead.
如果无法释放空间,则会在此处看到“不需要清理”消息。
VMware Workstation also allows you to create snapshots, which contain a complete “snapshot” of a virtual machine’s state at the point in time you created them. These can take a lot of space if the virtual machine has changed significantly since then. You can free up additional space by deleting snapshots you no longer need.
VMware Workstation还允许您创建快照,其中包含创建快照时虚拟机状态的完整“快照”。 如果此后虚拟机发生了显着变化,则这些操作可能会占用大量空间。 您可以通过删除不再需要的快照来释放更多空间。
To view the snapshots for a virtual machine, select the virtual machine in VMware Workstation and click VM > Snapshot > Snapshot Manager.
要查看虚拟机的快照,请在VMware Workstation中选择虚拟机,然后单击VM>快照>快照管理器。
To delete a snapshot you no longer need, right-click it in the Snapshot Manager window and select “Delete”. It will be removed from your computer.
要删除不再需要的快照,请在“快照管理器”窗口中右键单击它,然后选择“删除”。 它将从您的计算机中删除。
You won’t be able to restore your virtual machine to that previous point in time after deleting the snapshot, of course.
当然,删除快照后,您将无法将虚拟机还原到先前的时间点。
翻译自: https://www.howtogeek.com/313102/how-to-shrink-a-vmware-virtual-machine-and-free-up-disk-space/