When working with virtual machines (VMs), it is often necessary to share files and folders between the host machine and the VM. This allows for easy transfer of files and collaboration between the two systems. In this article, we will explore how to get shared folders to work on a VM using open-vm-tools.
What are shared folders?
Shared folders are directories on the host machine that can be accessed from within the VM. These folders appear as network shares, allowing you to copy files to and from them just like you would with any other network share.
Installing open-vm-tools
The first step is to ensure that open-vm-tools is installed on your VM. Open-vm-tools is a set of utilities that enhance the performance and functionality of VMs running on VMware. To install open-vm-tools, follow these steps:
- Open a terminal on your VM.
- Run the command
sudo apt-get install open-vm-tools(for Ubuntu-based systems) orsudo yum install open-vm-tools(for CentOS/RHEL-based systems). - Enter your password when prompted and wait for the installation to complete.
Enabling shared folders
Once open-vm-tools is installed, you can enable shared folders by following these steps:
- Ensure that your VM is powered off.
- In the VMware Workstation or Fusion menu, go to VM > Settings.
- In the Options tab, select Shared Folders.
- Click on the Add button to add a new shared folder.
- Select the folder on your host machine that you want to share.
- Choose a name for the share and specify the folder path within the VM where you want to mount the share.
- Click OK to save the settings.
Accessing shared folders
Now that shared folders are enabled, you can access them from within the VM:
- Power on your VM.
- Open a terminal on your VM.
- Create a directory where you want to mount the shared folder. For example,
mkdir /mnt/shared. - Mount the shared folder using the following command:
sudo mount -t vmhgfs .host:/shared_folder_name /mnt/shared. Replaceshared_folder_namewith the name you specified when setting up the shared folder. - You can now access the shared folder's contents under the
/mnt/shareddirectory.
That's it! You have successfully set up and accessed shared folders on your VM using open-vm-tools. Now you can easily transfer files between your host machine and the VM.
References
| Source | Link |
|---|---|
| VMware Documentation | https://docs.vmware.com/... |
| VMware Knowledge Base | https://kb.vmware.com/... |