VMware中centos7无法共享文件夹的问题

在安装虚拟机VMware之后安装系统想要把windows的目录共享在centos下面,但是我们按照centos6的挂在方法发现不管用.在网上找了半天才知道centos7的VMware tools和centos6的不一样,需要重新再安装一次,用yum安装,而不是在VMware软件里面安装!!

1.先安装VMware软件里VMwareTools
VMware中centos7无法共享文件夹的问题
没安装过的,点击安装,我的已经安装过了
然后挂载镜像

[root@centos7 ~]# mkdir /dvd
[root@centos7 ~]# mount /dev/cdrom /dvd
mount: /dev/sr0 is write-protected, mounting read-only
[root@centos7 ~]# cd /dvd/
[root@centos7 dvd]# ls
manifest.txt  run_upgrader.sh  VMwareTools-10.2.5-8068393.tar.gz  vmware-tools-upgrader-32  vmware-tools-upgrader-64
[root@centos7 dvd]# cp  VMwareTools-10.2.5-8068393.tar.gz /root/
[root@centos7 dvd]# cd /root/
[root@centos7 ~]# tar xf VMwareTools-10.2.5-8068393.tar.gz
[root@centos7 ~]# cd vmware-tools-distrib/
[root@centos7 vmware-tools-distrib]# ./vmware-install.pl

然后一直回车就行

2.系统下安装vmtools:
安装相关软件包

yum install open-vm-tools *headers perl gcc make kernel-devel -y

安装完成就关闭系统,配置共享文件夹

3.配置VMware
右击虚拟机,点击配置,点击选项,如图所示:
VMware中centos7无法共享文件夹的问题
VMware中centos7无法共享文件夹的问题

点击浏览,选择你要共享的文件夹,然后下一步就完成了

VMware中centos7无法共享文件夹的问题

4.配置完成了,启动系统就可以看到共享的文件夹/mnt/hgfs

记住:/mnt/hgfs这个文件夹不是手动创建的,是安装完成vmtools后产生的!
我们进入这个文件夹,但是并没有我们想要的共享文件夹,hgfs是空的,这是应为我们没有挂载.这里不像是centos6,给我们自动挂载的!
这可能是mnt缺少共享支持,打开terminal输入mount -t vmhgfs .host:/py_script /mnt/hgfs挂载该共享文件夹
我们可以用命令查看共享的文件夹
vmware-hgfsclient
VMware中centos7无法共享文件夹的问题

5.然后挂载就可以使用了
mount -t vmhgfs .host:/py_script /mnt/hgfs
如果出现:Error: cannot mount filesystem: No such device这样的报错
则再运行vmhgfs-fuse .host:/py_script /mnt/hgfs,往往就成功了(前提是VMware Tools安装已成功)
到此为止,可以正常使用共享文件夹了,但每次都要重新mount挂载一次,所以设置为启动后自动挂载:

VMware中centos7无法共享文件夹的问题
进入/mnt/hgfs下面就有文件了
VMware中centos7无法共享文件夹的问题

注:别的博客写可以放在/etc/fstab里面,但是我这样写不知道有没有问题,我这样写重启的时候报错了报错如下:

welcome to emergency mode!:after logging in ,type “journalctl -xb” to view system logs,“systemctl reboot” to reboot ,“systemctl default” to try again to boot into default mode。 give root password for maintenance (?? Control-D???)

因此我就把这个挂载的卸载了开机启动文件里面:

echo "vmhgfs-fuse .host:/py_script /mnt/hgfs" >> /etc/rc.d/rc.local

这样就没问题了

转载于:https://blog.51cto.com/853056088/2286704

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值