When working with an Ubuntu virtual machine (VM) on a host system like Windows or macOS, you may encounter an issue where shared files are missing in the
/mnt/hgfs directory. This can be a frustrating problem, but don’t worry, it’s fixable. In this article, we’ll walk you through some steps to resolve this issue.
If you are experiencing missing files in the
/mnt/hgfs directory on your Ubuntu VM, the problem can be resolved by installing the
open-vm-tools package, creating the
/mnt/hgfs directory if it doesn’t exist, and mounting the shared folders using the
sudo mount -t vmhgfs .host:/ /mnt/hgfs command. If these steps don’t work, there are alternative solutions mentioned in the post that you can try.
Understanding the Problem
/mnt/hgfs directory is where VMware shares files between the host system and the Ubuntu VM. If you’re unable to see your shared files in this directory, it could be due to several reasons, such as incorrect VM settings, missing packages, or issues with the host system.
Before we begin, ensure that you have:
- A running Ubuntu VM on VMware.
- Administrative (sudo) privileges on the Ubuntu VM.
- Shared folders enabled on the VMware settings.
Step 1: Install open-vm-tools
open-vm-tools is a set of services and modules that improve the interaction between the host and the VM. To install it, open the terminal in your Ubuntu VM and run:
sudo apt-get install open-vm-tools
sudo allows you to run commands with administrative privileges,
apt-get is the package handling utility in Ubuntu, and
install is the command to install a new package.
Step 2: Create /mnt/hgfs Directory
/mnt/hgfs directory does not exist, create it using the command:
sudo mkdir /mnt/hgfs
mkdir is the command to create a new directory.
Step 3: Mount the Shared Folders
To mount the shared folders, run:
sudo mount -t vmhgfs .host:/ /mnt/hgfs
mount is the command to mount a filesystem,
-t specifies the type of the filesystem,
vmhgfs is the filesystem type for VMware shared folders, and
.host:/ specifies the source of the mount (the host system).
If you encounter an error like “Error: cannot mount filesystem: No such device”, follow the troubleshooting steps below.
Check Your Ubuntu Version
Ensure you are running a supported version of Ubuntu. You can check your version by running
lsb_release -a in the terminal.
Verify VMware Settings
In the VMware settings, ensure that the “Always Enabled” option for folder sharing is checked.
Check Shared Folder Configuration
On your host system, verify that the shared folders are properly configured. The “Share this folder” option should be enabled.
Restart the VM
After making changes, always restart the VM and try the mount command again.
If the issue persists, try the following solutions:
- Follow the procedure suggested in this guide, which involves cloning a GitHub repository and running a script.
- Follow the steps mentioned in this tutorial to resolve the issue.
Missing files in
/mnt/hgfs on an Ubuntu VM can be a common issue, but with the right steps, it’s easily resolvable. Remember to check your settings, ensure you have the necessary packages installed, and don’t hesitate to seek further assistance if needed.
A virtual machine (VM) is a software emulation of a physical computer, running an operating system and applications. It allows you to run multiple operating systems on a single physical machine, providing flexibility and isolation.
To enable shared folders on VMware, go to the virtual machine settings, select the "Options" tab, and click on "Shared Folders." Check the "Enable Shared Folders" box and select the folders you want to share from your host system.
/mnt/hgfs directory is the default location where VMware shares files between the host system and the Ubuntu VM. It allows you to easily transfer files between the two systems.
You can check your Ubuntu version by opening the terminal and running the command
lsb_release -a. This will display detailed information about your Ubuntu release, including the version number.
If you encounter an error like "Error: cannot mount filesystem: No such device" while mounting shared folders, make sure you have installed the
open-vm-tools package and that the shared folders are properly configured in both the VMware settings and the host system. You can also try restarting the VM and running the mount command again.