当前位置: > 虚拟化 Virtualization > VMware >

VMware虚拟磁盘空间过大如何进行回收

时间:2016-06-24 01:20来源:linux.it.net.cn 作者:IT

    vmware上的虚拟应为长期使用或者下载东西导致磁盘空间变大,物理磁盘已经没有多少空间,可是释放虚拟机上的磁盘并不能解决物理磁盘空间不足的问题。后来在网上找了可以使用vmware的tools实现虚拟磁盘shrink。
 1,安装vmware-tool 
     首先选择vmware的菜单VM-Install VMware-Tools,等一会可以再linux的/media/VMware tools,里面有软件的安装包按照提示进行安装就可以了,  VMwareTools-6.5.0-118166.tar.gz

 

 [root@yqrh5u2 home]# cd vmware-tools-distrib/
[root@yqrh5u2 vmware-tools-distrib]# dir
bin  doc  etc  FILES  INSTALL  installer  lib  vmware-install.pl
[root@yqrh5u2 vmware-tools-distrib]# ./vmware-install.pl
A previous installation of VMware Tools has been detected.

The previous installation was made by the rpm installer (version 4).

Converting the rpm4 installer database format
        to the tar4 installer database format.

You have a version of VMware Tools installed.  Continuing this install will
first uninstall the currently installed version.  Do you wish to continue?
(yes/no) [yes] yes

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 6.5.0 build-118166 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]

It looks like you are trying to run this program in a remote session. This
program will temporarily shut down your network connection, so you should only
run it from a local console session. Are you SURE you want to continue?
[no]

Please re-run this program from a local console shell.
Execution aborted.

Found VMware Tools CDROM mounted at /media/VMware Tools. Ejecting device
/dev/hdc ...
[root@yqrh5u2 vmware-tools-distrib]#

    


 2,执行shrink操作 
     对于已经安装vmware-tool的Linux,Solaris或者FreeBSD,启动一个终端窗口,以root用户登录(磁盘空间的shrink需要root权限。
在窗口中启动vmware-toolbox,将弹出vmware-toolbox,选择shrink的tab页,选择你要释放的虚拟磁盘的分区。单节shrink就可以了。可以参见截图。假如不能执行shrink系统会显示原因。虚拟磁盘的清理工作完成时,会有一个提示信息。磁盘的空间的回收需要一个相当长的时间。需要耐心等待。

     shrink  操作

 

   




(责任编辑:IT)
------分隔线----------------------------