📒 

Introduction

When using VMware to run virtual machines (VMs), one of the common tasks is sharing files between the host operating system (OS) and the guest OS running inside the virtual machine. VMware allows you to create a shared folder that acts as a bridge between the host and the guest, making it easier to transfer files. This guide will walk you through the steps for setting up a shared folder between your host machine and a VMware guest, covering both Windows and Linux guest operating systems.

Prerequisites

Before setting up a shared folder, ensure the following:

  • VMware Workstation, VMware Player, or VMware Fusion is installed on your host system.
  • A virtual machine is set up and running.
  • VMware Tools is installed on the guest OS. VMware Tools is necessary for the shared folder feature to work properly.

Step 1: Install VMware Tools

If VMware Tools is not yet installed on your guest operating system, you need to install it first. VMware Tools provides enhanced graphics performance, clipboard sharing, and the ability to use shared folders.

  1. Start your Virtual Machine and log in to the guest OS.
  2. From the VM menu, select Install VMware Tools. If you see an option to Reinstall VMware Tools, select it.
  3. VMware will mount a virtual CD containing the VMware Tools installer.
    • For Windows Guests: Open the mounted drive in File Explorer and run the setup.exe file. Follow the prompts to install.
    • For Linux Guests: Open the terminal and extract the contents of the mounted VMware Tools CD, then run the vmware-install.pl script.
  4. Reboot the guest operating system after the installation is complete.

Step 2: Enable the Shared Folder

Once VMware Tools is installed, you can enable and configure a shared folder between the host and the guest.

  1. Power off the Virtual Machine if it is currently running.
  2. Open VMware Workstation or VMware Player and select your virtual machine from the list.
  3. Click on Edit virtual machine settings or Settings.
  4. In the Settings window, go to the Options tab.
  5. Select Shared Folders from the list on the left.
  6. On the right side, choose Always enabled or Enabled until next power off or suspend based on your preference.
  7. Click Add to create a new shared folder.

Step 3: Configure the Shared Folder

After clicking Add, you will be guided through a wizard to create the shared folder:

  1. Shared Folder Wizard will open. Click Next.
  2. Select the host folder that you want to share with the guest OS:
    • Click Browse to choose an existing folder on your host system.
    • Alternatively, you can create a new folder on the host machine and select it here.
  3. Name the shared folder: This is the name that the folder will appear as within the guest OS.
  4. Enable the shared folder by checking Enable this share.
  5. If you want the shared folder to be read-only, select Read-only. This means the guest OS can view but not modify the contents of the folder.
  6. Click Finish to complete the setup, and then OK to close the virtual machine settings window.

Step 4: Access the Shared Folder in the Guest OS

The process for accessing the shared folder varies depending on the guest operating system (Windows or Linux).

For Windows Guests

  1. Start the Virtual Machine and log in.
  2. Open File Explorer.
  3. Go to Network or This PC in File Explorer, and you should see a folder named vmware-host.
  4. Open vmware-host and navigate to Shared Folders. Here, you will find the shared folder you created earlier.
  5. You can now copy, paste, and access files between the host and guest operating systems using this shared folder.

For Linux Guests

  1. Start the Virtual Machine and log in.
  2. Open a terminal window.
  3. By default, shared folders are usually mounted under the /mnt/hgfs/ directory. To access the shared folder, use:
    cd /mnt/hgfs/
    ls

    This should list the shared folder that you configured in the previous steps.

  4. You can now navigate to the shared folder and access its contents:
    cd /mnt/hgfs/shared_folder_name

    Replace shared_folder_name with the name you assigned to the shared folder.

  5. If you cannot see the shared folder, you might need to manually mount it:
    sudo mount -t vmhgfs .host:/shared_folder_name /mnt/hgfs/shared_folder_name

Step 5: Troubleshooting Common Issues

If you encounter issues with the shared folder, consider the following troubleshooting steps:

  • Ensure VMware Tools is Installed: Shared folders rely on VMware Tools, so double-check that it’s installed correctly.
  • Check Folder Permissions: Verify that the shared folder has the proper read/write permissions on the host system.
  • Restart the Virtual Machine: Sometimes, a restart of the guest OS is necessary for changes to take effect.
  • Manually Mount Shared Folders: On Linux guests, if the shared folder does not appear under /mnt/hgfs/, try manually mounting it as shown above.
  • Check VMware Settings: Make sure that shared folders are enabled in the VMware settings (Edit virtual machine settings > Options > Shared Folders).

Step 6: Managing Shared Folders

You can manage or remove shared folders at any time:

  1. Power off the Virtual Machine.
  2. Go to Edit virtual machine settings > Options > Shared Folders.
  3. Select the shared folder and click Remove if you no longer want to share it, or Edit to change its properties (e.g., read-only mode).

Conclusion

Setting up a shared folder in VMware allows seamless file transfer between your host and guest operating systems, improving productivity and workflow. By following the steps in this guide, you can easily configure, access, and manage shared folders, whether you’re running Windows or Linux on your virtual machines. Remember to keep VMware Tools up to date to ensure compatibility and performance of shared folders.