centos7.2下 vmware-tool 与window 共享文件夹
虚拟机centos下找不到共享文件夹
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/roodyszz2013/article/details/56276173
贡献文件夹后在centos /mnt目录下存在hgfs文件夹,但文件夹内容为空
参考文章资料说需要挂载,于是执行:
一、安装VMWare tools
首先在vm虚拟机菜单栏找到 虚拟机->安装VMware Tools。把文件挂载到Linux上,然后重启一下Linux。
重启完在 /dev/目录下有一个cdrom文件。把他挂载到别的目录下。
我是这么做的:
[root@localhost tmp]# mkdir /mnt/cdrom [root@localhost tmp]# mount -t iso9660 /dev/cdrom /mnt/cdrom/然后 把VMwareTools压缩包拷贝到/tmp/目录下。
[root@localhost tmp]# cp VMwareTools-9.6.0-1294478.tar.gz /tmp/解压
[root@localhost tmp]# cd /tmp [root@localhost tmp]# tar -zxvf VMwareTools-9.6.0-1294478.tar.gz
安装
[root@localhost tmp]# cd vmware-tools-distrib/ [root@localhost tmp]# ./vmware-install.pl接下去一直按enter,然后重启,按理就搞定了。
但是我提示缺少Linux Kernal Header,不知道怎么搞。但貌似还是成功了。
二、解决安装VMWare tools后/mnt中有hgfs但没共享文件
前提:在虚拟机软件中设置了共享目录
此时在linux中进入 /mnt/hgfs 文件夹,但发现共享的文件没有显示
使用以下办法解决(root权限):
sudo passwd root
输入root的密码就可以正常切换到root权限了
1. vmware-hgfsclient 命令查看当前有哪些共享的目录,这里我只使用了shared文件夹2. 使用 mount -t vmhgfs .host:/shared /mnt/hgfs 命令挂载该共享文件夹(注意:带.号的哦),其中.host:/Documents是共享名,只需把Documents换成
使用vmware-hgfsclient 命令得到的目录,/mnt/hgfs是挂载点
3. 到此为止是可以使用该共享文件夹了,但每次都得重复mount一次,所以需要设置为随机启动后自动挂载
编辑 /etc/fstab,添加下面一行
.host:/shared /mnt/hgfs vmhgfs defaults 0 0 (按需写)
补充:
如果显示
Error: cannot mount filesystem: No such device
ubuntu则先执行 sudo apt-get install open-vm-dkms
如果是centos安装过VM tool的话直接运行命令:sudo vmhgfs-fuse .host:/share /mnt/hgfs 然后就有了,
其中 host:/share 中的share是共享名,可以通过命令:vmware-hgfsclient 查看