iN2gN3jT

导航

部署 hgfs 存储:使用VMware Tools共享文件夹的方法(Linux虚拟机)

环境要求:
Rocky Linux 9.4 虚拟机 (已经安装好了 open-vmtools)

注意事项

  1. 注意【备份数据】
  2. hgfs 不适合并发写入的场景,可能出现【文件损坏】的情况

第一步:更改虚拟机配置,启用共享文件夹

首先打开 Virtual Machine Settings 页面(虚拟机配置界面) [1][2]

其次,在 Virtual Machine Settings 页面的 Options 子标签页中点击左侧边栏中的设置的行 Shared Folders | Disabled

然后在右侧边栏中,在 Folder sharing 区域点击 Always enabled,随后在 Folders 区域点击 Add... 按钮,从而选择和添加要共享的 Windows 宿主机文件

最后点击 OK 按钮

第二步:挂载共享文件夹,并配置永久挂载

使用 root 用户运行如下命令

ln -s "$(command -v vmhgfs-fuse)" /sbin/mount.fuse.vmhgfs-fuse
mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
cat >> /etc/fstab << EOF
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0
EOF
systemctl daemon-reload
mount -a

附录

  • 安装 open-vm-tools 的方法
dnf install open-vm-tools

参考文献


  1. (4 条消息) 主机与VMware虚拟机共享文件夹:解决虚拟机找不到共享文件夹问题 - 知乎 ↩︎

  2. 在Linux虚拟机中配置VMware共享文件夹:完整指南 — geek-blogs.com ↩︎

posted on 2026-10-23 14:45  笔记和文档  阅读(22)  评论(0)    收藏  举报