Win10
VMware Workstation 12
虚拟机:Xubuntu 14.04 (内核4.4)
之前虚拟机中安装过VMware-tools,可能没有安装完整导致现在开启共享文件夹设置后在虚拟机中无法显示(没有hgfs/目录)。
检查虚拟机发现:
/usr/lib/vmware-tools目录没有;
vmware-config-tools.pl和vmware-uninstall-tools.pl脚本指令也都没有;
但命令行下运行vmware-hgfsclient
命令能输出我自己设置的共享文件夹名称。
首先,打开虚拟机后点击VMware工具的“重新安装VMware Tools(T)…”,
然后在虚拟机中su - root
进入到root用户, 再进入VMware-tools解压缩后的vmware-tools-distrib目录,运行./vmware-install.pl
。
安装过程中以下三个选项更改了默认选项:
For kernels >= 4.0.0, open-vm-tools need to be of version 10.0.0 or higher for VMware Host Guest Filessystem (vmhgfs) to function with VMware Tools. Please upgrade open-vm-tools and rerun this installer, or uninstall open-vm-tools. Alternatively, you can disable using the vmhgfs when VMware Tools are configured.
Enter yes to proceed. [no] yes
这一步选择了yes
The VMware Host-Guest Filesystem allows for shared folders between the host OS and the guest OS in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [no] yes
这一步选择了yes
Would you like to enable VMware automatic kernel modules? [no] yes
这一步选择了yes //该项在Ubuntu16.04中选择no也是能成功的。
具体选项与执行信息如下:
root@ubuntu:/home/jeremy/disk2/xx/vmware-tools-distrib# ./vmware-install.pl
The installer has detected an existing installation of open-vm-tools on this
system and will not attempt to remove and replace these user-space
applications. It is recommended to use the open-vm-tools packages provided by
the operating system. If you do not want to use the existing installation of
open-vm-tools and attempt to install VMware Tools, you must uninstall the
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-dkms
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes]
For kernels >= 4.0.0, open-vm-tools need to be of version 10.0.0 or higher for
VMware Host Guest Filessystem (vmhgfs) to function with VMware Tools. Please
upgrade open-vm-tools and rerun this installer, or uninstall open-vm-tools.
Alternatively, you can disable using the vmhgfs when VMware Tools are
configured.
Enter yes to proceed. [no] yes
Creating a new VMware Tools installer database using the tar4 format.
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]
What is the directory that contains the init scripts?
[/etc/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]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
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 10.0.6 build-3595377 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]
The file /usr/bin/vmware-hgfsclient that this program was about to install
already exists. Overwrite? [no]
The file /sbin/mount.vmhgfs that this program was about to install already
exists. Overwrite? [no] yes
Initializing...
Making sure services for VMware Tools are stopped.
The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.
The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.
The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [no] yes
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.
Would you like to enable VMware automatic kernel modules?
[no] yes
Thinprint provides driver-free printing. Do you wish to enable this feature?
[yes]
Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-137-generic
vmware-tools start/running
vmware-tools-thinprint start/running
The configuration of VMware Tools 10.0.6 build-3595377 for Linux for this
running kernel completed successfully.
Enjoy,
--the VMware team
root@ubuntu:/home/jeremy/disk2/xx/vmware-tools-distrib#
现在就可以看到自己设置的共享文件夹Share了:
jeremy@ubuntu:~$ ll /mnt/hgfs/
total 9
dr-xr-xr-x 1 root root 4192 Feb 25 03:34 ./
drwxr-xr-x 3 root root 4096 Feb 25 02:51 ../
drwxrwxrwx 1 root root 0 Feb 24 23:20 Share/
解决用vmhgfs-fuse .host:/ /mnt/hgfs挂载后需要超级用户才能ls hgfs的问题
$sudo vmhgfs-fuse .host:/winshare /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other,nonemptybb
其中winshare 是win7下的共享目录,如果不是直接对应到具体的目录就用
$sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other,nonemptybb