回收VMWare虚拟机占用的磁盘空间,虚拟机里装了个Ubuntu 10.04,是老早以前了的了,由于仅安装了开发环境和Oracle 10g,占用空间
虚拟机里装了个Ubuntu 10.04,是老早以前了的了,由于仅安装了开发环境和Oracle 10g,占用空间在8G左右。
前几天升级了12.04.01,麻烦来了,虚拟机硬盘空间暴增至16G左右,卸载了openoffice等不用的软件,apt-get clean了,apt-get autoremove了。
df -H了一下,OK,磁盘占用8G左右了,可是虚拟机硬盘还是16G大小!
折腾了半天,查了N多资料,终于搞定:
1. 虚拟机设置的硬盘选项中先Compac一下;
2.开虚拟机
Before we try to shrink the virtual disk files, we should try to remove any unneeded files from the virtual machine to free space. For example, on Debian-based VMs, you can run
apt-get clean
to clear out the local repository of retrieved package files.
Next, run
cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
to fill the unused space with zeros.
Then power down the VM and