VMware Shared Folders — Persistent Mount Setup
Enables automatic mounting of VMware shared folders at /mnt/hgfs on an Ubuntu guest.
This post and the technique described here are thanks to claude.ai .
Prerequisites
sudo apt install open-vm-tools
Steps
1. Create the unit file
sudo tee /etc/systemd/system/mnt-hgfs.mount << 'EOF'
[Unit]
Description=VMware Shared Folders
DefaultDependencies=no
Requires=open-vm-tools.service
After=open-vm-tools.service
[Mount]
What=.host:/
Where=/mnt/hgfs
Type=fuse.vmhgfs-fuse
Options=defaults,allow_other,auto_unmount,entry_timeout=0,attr_timeout=0
[Install]
WantedBy=multi-user.target
EOF
2. Enable and start it
sudo systemctl daemon-reload
sudo systemctl enable --now mnt-hgfs.mount
3. Verify
systemctl status mnt-hgfs.mount
ls /mnt/hgfs/
Notes
DefaultDependencies=nois required. Without it, systemd creates an ordering cycle:.mountunits are automatically added tolocal-fs.target, butopen-vm-toolsstarts afterlocal-fs.target, so the mount can never satisfy its own dependency.DefaultDependencies=noremoves the unit fromlocal-fs.targetordering, breaking the cycle.- An
/etc/fstabentry is not a viable alternative — fstab-generated units haveDefaultDependencies=yesand there is no fstab option to override it. - The mount point
/mnt/hgfsdoes not need to be created manually; the fuse driver creates it on first mount. - Shared folders appear as subdirectories under
/mnt/hgfs/(e.g./mnt/hgfs/shared).