最近经常遇到,windows上用vmware安装好linux虚拟机,设置好共享文件后,也生效了。但是每次重启linux虚拟机之后,共享文件就无法访问了,每次都要手动在vmware的设置里禁用共享,然后再开启共享,操作有点麻烦而且慢,有什么方法可以比较简单快速的解决么,下面介绍一个命令就能解决的方法。

vmware共享文件,需要启动vmhgfs相关模块,应用程序为vmhgfs-fuse。

共享文件生效时,可以用ps命令看到vmhgfs-fuse进程

[root@zyg ~]# ps -ef |grep vm
root        520      1  0 16:30 ?        00:00:00 /sbin/lvmetad -f
root        821      1  0 16:30 ?        00:00:00 /usr/bin/vmtoolsd
root       6681      1  0 16:36 ?        00:00:00 /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
root       6888   6295  0 16:36 pts/2    00:00:00 grep --color=auto vm

在linux系统上,执行vmhgfs-fuse -h,查看用法:

[root@zyg ~]# vmhgfs-fuse -h
Usage:  vmhgfs-fuse sharedir mountpoint [options]
Examples:vmhgfs-fuse .host:/ /mnt/hgfsvmhgfs-fuse .host:/foo/bar /mnt/bargeneral options:-o opt,[opt...]        mount options-h   --help            print help-V   --version         print version-e   --enabled         check if system is enabledfor the HGFS FUSE client. Exits with:0 - system is enabled for HGFS FUSE1 - system OS version is not supported for HGFS FUSE2 - system needs FUSE packages for HGFS FUSEFUSE options:-d   -o debug          enable debug output (implies -f)-f                     foreground operation-s                     disable multi-threaded operation-o allow_other         allow access to other users-o allow_root          allow access to root-o auto_unmount        auto unmount on process termination-o nonempty            allow mounts over non-empty file/dir-o default_permissions enable permission checking by kernel-o fsname=NAME         set filesystem name-o subtype=NAME        set filesystem type-o large_read          issue large read requests (2.4 only)-o max_read=N          set maximum size of read requests-o numa                 enable numa-o hard_remove         immediate removal (don't hide files)-o use_ino             let filesystem set inode numbers-o readdir_ino         try to fill in d_ino in readdir-o direct_io           use direct I/O-o kernel_cache        cache files in kernel-o [no]auto_cache      enable caching based on modification times (off)-o umask=M             set file permissions (octal)-o uid=N               set file owner-o gid=N               set file group-o entry_timeout=T     cache timeout for names (1.0s)-o negative_timeout=T  cache timeout for deleted names (0.0s)-o attr_timeout=T      cache timeout for attributes (1.0s)-o ac_attr_timeout=T   auto cache timeout for attributes (attr_timeout)-o noforget            never forget cached inodes-o remember=T          remember cached inodes for T seconds (0s)-o nopath              don't supply path if not necessary-o intr                allow requests to be interrupted-o intr_signal=NUM     signal to send on interrupt (10)-o modules=M1[:M2...]  names of modules to push onto filesystem stack-o max_write=N         set maximum size of write requests-o max_readahead=N     set maximum readahead-o max_background=N    set number of maximum background requests-o congestion_threshold=N  set kernel's congestion threshold-o async_read          perform reads asynchronously (default)-o sync_read           perform reads synchronously-o atomic_o_trunc      enable atomic open+truncate support-o big_writes          enable larger than 4kB writes-o no_remote_lock      disable remote file locking-o no_remote_flock     disable remote file locking (BSD)-o no_remote_posix_lock  disable remove file locking (POSIX)-o [no_]splice_write     use splice to write to the fuse device-o [no_]splice_move      move data while splicing to the fuse device-o [no_]splice_read      use splice to read from the fuse device-o [no_]auto_inval_data  use automatic kernel cache invalidation logic-o readdirplus=S         control readdirplus use (yes|no|auto)-o [no_]async_dio        asynchronous direct I/O-o [no_]writeback_cache  asynchronous, buffered writesModule options:[iconv]-o from_code=CHARSET   original encoding of file names (default: UTF-8)-o to_code=CHARSET      new encoding of the file names (default: UTF-8)[subdir]-o subdir=DIR           prepend this directory to all paths (mandatory)-o [no]rellinks         transform absolute symlinks to relative

临时解决的话,直接执行:

vmhgfs-fuse .host:/ /mnt/hgfs 

或者用上面ps打印出的命令:

/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

即可。

永久生效:
在/root/.bashrc 中添加命令:

vmhgfs-fuse .host:/ /mnt/hgfs或者/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

然后执行source命令,让本次修改生效:

source ~/.bashrc

之后,就可以cd到/mnt/hgfs/下的共享文件目录中了。

重启vmware中的linux虚拟机后跟windows主机共享的文件失效解决方法相关推荐

  1. 关于VMware下使用linux虚拟机出现仅主机模式适配器驱动程序似乎未运行的解决方法

    关于VMware下使用linux虚拟机出现"仅主机模式适配器驱动程序似乎未运行"的解决方法 这是我第一次开始写博客,所出现的问题都是针对我当时遇到的情况 在自学linux的某天,打 ...

  2. win台式找不到计算机管理,win10系统计算机右键-管理打不开windows找不到文件的解决方法...

    很多小伙伴都遇到过win10系统计算机右键-管理打不开windows找不到文件的困惑吧,一些朋友看过网上零散的win10系统计算机右键-管理打不开windows找不到文件的处理方法,并没有完完全全明白 ...

  3. win7计算机找不到clsid,win7系统提示windows找不到文件的解决方法

    我们在操作win7系统电脑的时候,常常会遇到win7系统提示windows找不到文件的困惑吧,一些朋友看过网上零散的win7系统提示windows找不到文件的处理方法,并没有完完全全明白win7系统提 ...

  4. 向VMware中的Linux虚拟机共享Windows宿主机的文件/文件夹

    鼠标移到虚拟机标签上,右键单击"设置" 在虚拟机设置弹出框中,打开"选项"选项卡. 在列表中单击"共享文件夹" 在右侧单击"添加& ...

  5. vmware虚拟机中的linux怎么和windows主机做目录映射?

    宿主机:windows 10 客户机:fedora 29 server vmware:vmware workstation 15 已经用下面的步骤做了目录共享: 1.在fedora中安装open-vm ...

  6. Windows环境:VMware下linux虚拟机与Windows主机进行文件共享的方法

    转载至:https://blog.csdn.net/kai1001/article/details/79668327 感谢原作者的分享 操作主要分两大步骤: 一.是对主机进行配置: 二.是在虚拟机上安 ...

  7. vmware中的linux虚拟机如何增加磁盘容量

    vmware中 centos的磁盘大小 20G->30G 现象:fdisk -l可以看到增大后的磁盘总量,但是需要增加分区并格式化然后挂载才能使用. 一.vmware中的设置 先关闭虚拟机 vm ...

  8. 在VMware中安装新版Ubuntu后,无法跨虚拟机复制粘贴和拖拽文件的解决方法

    首先确保已经安装了VMware Tools: sudo apt install open-vm-tools 然后发现还是不能复制粘贴和拖拽文件?原因是Ubuntu(22.04,20.04等)默认启用了 ...

  9. windows和Linux虚拟机或者云主机之间传输文件

    在这里用一种比较简单的方法来实现互相传输文件: 1.打开远程控制服务器软件,连接上云主机,我用的是xshell5 2.检查是否安装 sz rz命令 rpm -qa |grep sz 和 rpm -qa ...

最新文章

  1. 桌面开发者的界面故事,该醒醒了
  2. 【转载】SAP 计划策略组40、50对比分析
  3. mysql unique count_MySQL - Count Number of Unique Values
  4. 电话光端机的电话业务不通问题,该怎么去检查?
  5. 【转】DICOM:DICOM Print服务中PresentationContext协商之 MetaSOPClass与SOPClass对比分析!!!!!!!!
  6. VMware HA与VMotion的部署与搭建
  7. Python 内置函数之 open (文件操作)
  8. Anaconda如何重新在开始菜单显示
  9. Java之类的构造器(反射)
  10. python 保证所有数据能够显示,而不是用省略号表示,不以科学计数显示
  11. 《统计学习方法》——逻辑斯蒂回归
  12. 现代信号处理——阵列信号处理(空域滤波原理及其算法)
  13. 【UAV】串级 PID 控制原理及应用
  14. Semi迎来重要试驾客户,特斯拉致力于将其推向市场
  15. java算法:1234组成无重复的三位数
  16. matlab ode45使用,ODE45函数的使用——翻译
  17. Android手机电池耐用吗,手机电池是否还耐用?一招教你识别
  18. 【Python自动化任务】让运维更简单的7种定时任务实现方式,总有一种适合你的场景
  19. Win10 双屏:主屏和左右屏设置
  20. 【C4】基于深度学习的心电信号分析

热门文章

  1. c++ vector的内存释放
  2. 用自己的电脑搭建我的世界服务器教程,详细步骤
  3. 小米手机证书信任设置在哪里_用小米手机的一定要调整这5个设置,让手机丝滑柔顺,用多4年...
  4. 图片加水印转网络图片(COS)
  5. 【机房】概要设计说明书
  6. Android系统ODEX文件格式解析
  7. 蓝桥杯数学题:天平称重:巧用三进制。基于python3.9的原创代码
  8. Spark-----Spark 与 Hadoop 对比,Spark 集群搭建与示例运行,RDD算子简单入门
  9. c语言程序设计河北,2020春C语言程序设计赵玲玲单元测试参考答案查询,工程经济与应用...
  10. shell-条件判断 “并且” “或者”