Hostingweb.info

How To Create and Access a VMware Shared Folder


Let’s say you’re developing new software and want to test it on Microsoft Windows and Linux operating systems. Assuming you have a Windows computer, you can set up the Linux environment on a virtual machine using VMware Workstation Pro. 

Now, assume you must modify a configuration file to create different test scenarios. The Windows-based host system and the Linux virtual machine must access the updated configuration file whenever they run a new test. 

Since the virtual machine is an isolated environment, it can’t access the configuration file on the host system. So, copying the configuration file from the host to the virtual machine every time you run a test could be time-consuming. 

The good news? You can solve this issue using a VMware shared folder.

In this article, we’ll explore how to create, enable, and troubleshoot VMware shared folders.

What is a shared folder?

A VMware shared folder is a folder on a host computer that is shared between the host and virtual machines. The shared folder could also be a network directory accessible from the host machine.

Multiple virtual machines that run on the same host can also share a folder if they all have enabled the VMware folder-sharing option for that specific folder on the host system. 

A shared folder allows virtual machine users to access the files on the host system without copying the files. The virtual machines can read and write the files in the shared folder based on their access rights.

Benefits of using shared folders with virtual machines

The VMware shared folder option has many advantages that make working with virtual machines easy. 

Saves time and storage

Copying large files like installers or high-resolution videos between the host and the virtual machine can take a long time. A VMware shared folder helps you save time by allowing the host and client machines to share large files. 

When you copy and paste large files to the virtual machines, the file will occupy storage on both the host and client machine. These large files will reduce the storage available for virtual machines. Sharing folders will eliminate the need to duplicate the files. 

Seamless integration of guest and host systems

Virtual machines are isolated environments, but sharing folders between the host and guest system will help you integrate them seamlessly. Folder sharing will ensure you can use software and media on both environments as if they’re one machine.

Access control

You can share a host system’s folder in read-only mode so that the virtual machines can only view or copy the files — they can’t modify or delete the files within the folder. 

Access control prevents data corruption and ensures no unauthorized virtual machine accesses the host folders.

How to add a shared folder in VMware

You can share a folder between the host and virtual machines by enabling folder sharing from the virtual machine’s settings. For this, you need to go to the virtual machine library in the VMware workstation, click on the virtual machine settings, and enable folder sharing.

You must follow the same steps to share a folder between a host system and a virtual machine and among multiple virtual machines. 

But first, let’s look at the prerequisites for sharing folders. 

Prerequisites for VMware folder sharing

To enable VMware shared folders, the guest operating system must support file sharing. Here’s a list of guest operating systems that support folder sharing. 

  • macOS
    • 10.12/10.13/10.14/10.15 
    • 11/12/13
    • 10.6/10.7/ 10.8/ 10.9/10.10/10.11
  • Windows 7/8/8.1/10
    • XP
    • Vista
    • Server 2003/2008/2012/2016
  • Linux guest operating systems with a kernel version of 2.4 or later 

The user account on the host system that runs VMware Workstation Pro must have permission to access the folder. VMware folder sharing doesn’t work on a remote virtual machine. It means the virtual machine should be running on the same host where the shared folder resides.

Installing VMware tools on the virtual machine is also a crucial prerequisite to ensure the folder sharing works correctly. 

Install VMware tools on the host machine 

Installing the VMware tools is vital for the correct functioning of the virtual machine. VMware tools include drivers to improve a virtual machine’s graphics, networking, mouse, and storage.

Sharing files between host and virtual machines also requires the “VMHGFS” driver. This driver allows file system redirection from the host to the guest operating system. 

After you create a new virtual machine with VMware Workstation Pro, installing the VMware tools is very easy. You just need to right-click on the virtual machine and select the Install VMware Tools menu item.

How to install VMware tools on a virtual machine.

Step-by-step guide to creating a VMware shared folder

Assuming that you have a host operating system that supports folder sharing and have installed the VMware tools, let’s look at the step-by-step process for enabling file sharing in VMware.

Note: Turn your virtual machine off during this step. Otherwise, the sharing options will be inactive.

Step 1

Launch the VMware Workstation Pro and open the virtual machines library by clicking View > Customize > Library.

Note: Sometimes, the library tab might be open by default when you launch VMWare Workstation. 

Launching virtual machine library in VMware Workstation Pro.

Step 2 

Go to the virtual machine library and locate the virtual machine for which you want to enable folder sharing. 

Enabling VMware shared folder option for an Ubuntu virtual machine.

Step 3 

Right-click on the virtual machine and select the Settings… option.

Open Ubuntu virtual machine settings to enable folder sharing.

Step 4

On the new dialog that opens, select the Options tab and click on Shared Folders. Choose your preferred out of the following two sharing options:

  • Always enabled: this will keep the folders shared even when the virtual machine is powered off, suspended, or shut down.
  • Enabled until next power off or suspend: the sharing is enabled when the virtual machine is powered on. It is disabled when the machine is powered off, suspended, or shut down.
How to enable the VMware shared folder feature.

Step 5 

Choose your sharing preference and click on the Add button. 

Add a shared folder on the host to enable access for the guest machine.

Step 6 

After that, the Add Shared Folder Wizard will open. On this new window, click Next.

VMware Add Shared Folder Wizard.

Step 7 

On the Add Shared Folder Wizard, choose the host path to share with the virtual machine and the name in which the folder must appear in the virtual machine.

dd shared folder attributes for the VMware host machine.

Step 8

Select the additional attributes of the shared folder and click Finish.

You’ll find two options here:

  • Enable this share: the shared folder will be enabled if you select this option. If it is deselected, sharing will be turned off without deleting the shared folder from the virtual machine configuration.
  • Read only: the virtual machine can view and copy files, but it won’t have permission to add, change, or remove files.
Add shared folder attributes for a VMware host machine.

Note: Go back to the Virtual Machine Settings window, and the shared folder should appear in the Folders list. A tick mark on the ‌checkbox next to it indicates that the folder is now shared with the virtual machine. If you want to turn off sharing, you can uncheck the folder.

How to add shared folders in a VMWare host machine.

How to access a shared folder in VMware

Once you share a folder between the host system and the virtual machine, you must access the files within the shared folder. However, accessing a VMware shared folder might not be as straightforward as accessing a local file on your computer.

Let’s look at where to find the shared folder and how to access them on Windows or Linux virtual machines. 

View shared folders on Windows guest OS

The location of the shared folder on a guest Windows machine varies based on the version of the operating system. The shared folder might appear as VMware Shared Folders in one of the following places on your Windows host machine:

  • My Network Places.
  • Network Neighborhood.
  • Network.

Conversely, if you have mapped the shared folder as a network drive, go to My Computer and check under network drives to locate the folder Shared Folders on VMware-Host.

View shared folders on Linux guest OS

In a Linux virtual machine, all the shared folders will appear in the /mnt/hgfs directory by default. In addition, you can mount a shared folder or a subfolder to any location in your Linux file system by using the mount command.

The mount command is slightly different for Linux kernels before version 4.0 and with Linux kernel version 4.0 and later. 

Here are a few examples of mounting the shared folders using the Linux command line interface. 

Note: To run these commands, you must install VMware tools on your virtual machine.

Example 1: Mount all VMware shared folders to /home/user/vmshare 

In Linux kernels prior to version 4.0:

mount -t vmhgfs .host:/ /home/user/vmshare

In Linux kernel versions 4.0 or later:

/usr/bin/vmhgfs-fuse .host:/ /home/user/vmshare -o subtype=vmhgfs-fuse,allow_other

Example 2: Mount a share named test to /home/user/test 

In Linux kernels prior to version 4.0:

mount -t vmhgfs .host:/test  /home/user/test

In Linux kernel versions 4.0 or later:

/usr/bin/vmhgfs-fuse .host:/test  /home/user/test -o  subtype=vmhgfs-fuse,allow_other

Example 3: Mount a subfolder named “tools” under the share “test” to /var/lib/vmtools

In Linux kernels prior to version 4.0:

mount -t vmhgfs .host:/test/tools  /var/lib/vmtools

In Linux kernel versions 4.0 or later:

/usr/bin/vmhgfs-fuse .host:/test/tools  /var/lib/vmtools -o subtype=vmhgfs-fuse,allow_other

How to enable folder sharing for all the users of a virtual machine

Let’s say a host computer has two user accounts, user A and user B, and both use the same VMware virtual machine. 

Assume user A enables folder sharing between the host and virtual machine. When user B powers on the same virtual machine, folder sharing will be deactivated by default. That is a security precaution by VMware to prevent unauthorized access to shared folders. 

However, you can enable folder sharing for all the users. For this, open VMware Workstation Pro, go to the Edit tab, and choose Preferences.

Steps to enable folder sharing for all virtual machine users.

From the window that pops up, select Workspace and check Enable all shared folders by default.

How to enable shared folders for all virtual machine users.

Note: VMware considers enabling all shared folders by default as a security risk as it allows another user to access the folders you shared. You should enable this option only if you trust all the users of the host system. 

Troubleshooting common shared folder issues in VMware

When you try to share folders between a host system and virtual machines, you might encounter certain issues. Here are two common problems and how to troubleshoot them.

Issue 1: The shared folder doesn’t appear on the guest

Even if you have shared a folder between the host and guest machines, the folder doesn’t appear on the virtual machine’s file system.

  1. Ensure the host file system supports file sharing.
  2. If yes, install the latest version of VMware tools on your host system to ensure VMHGFS drivers are installed.
  3. If it’s a Linux virtual machine, run the “mount” command to mount the host file system on Linux manually. 

Issue 2: Shared folder disappears after reboot on Linux

The shared folder might disappear whenever you restart your virtual machines. In Linux, you might not see any folders under /mnt/hgfs when you reboot your virtual machine. 

You may manually enable shared folders from the virtual machine’s settings. But this might not be easy to do all the time.

You must have VMware tools on your host machine to fix this issue permanently. 

Then, you may add the following entry into your /etc/fstab to mount the shared folders automatically on reboot:

sudo vmhgfs-fuse  /mnt/hgfs fuse defaults,allow_other    0 0

Final thoughts: How to create and access a VMware shared folder

VMware folder sharing helps you transfer data between the host system and virtual machines. To do this, you must install VMware tools and enable file sharing on the virtual machine.

In some cases, where the host operating system doesn’t support folder sharing or in the case of remote virtual machines, you might not be able to use the VMware folder sharing option. So, you’ll need to move or copy files between the host and virtual machines.

If you need to move files between virtual machines seamlessly and have safeguards against data corruption, Liquid Web’s private cloud can help you. Try Liquid Web’s Managed Private Cloud Powered by VMware today.



Source link

Leave a Comment

Your email address will not be published. Required fields are marked *