WindowsMacSoftwareSettingsSecurityProductivityLinuxAndroidPerformanceConfigurationApple All

How to Share Folders Between Host and Guest in VirtualBox

Edited 2 weeks ago by ExtremeHow Editorial Team

VirtualBoxShared FoldersHostGuestFilesAccessSyncNetworkVM

How to Share Folders Between Host and Guest in VirtualBox

This content is available in 7 different language

VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product that allows users to run multiple operating systems on their host machines. A common task when using VirtualBox is to share folders between the host operating system and the guest operating system running in a virtual machine. This process allows files to be easily transferred back and forth, providing a seamless and efficient workflow. This guide will take you through the process of sharing folders between your host and guest operating systems in VirtualBox, explaining each step in detail.

Prerequisites

Before you can share folders between your host and guest operating systems, make sure you have the following:

VirtualBox Guest Edition is a set of utilities designed to enhance the performance and usability of the guest OS. It is required for seamless folder sharing. The installation of Guest Edition may vary depending on the guest operating system being used. The following section will explain how to install it.

Installing VirtualBox Guest Additions

To install VirtualBox Guest Additions, follow these steps:

  1. Start your virtual machine where you want to install the Guest Additions.
  2. Once the VM starts up, click on Devices in the VirtualBox menu.
  3. Select Insert Guest Additions CD Image....
  4. Download the Guest Additions image if prompted.
  5. Depending on your guest OS:
    • Windows: Setup should begin automatically. Follow the setup prompts to complete the installation.
    • Linux: Run the installation script by going to the mounted CD drive and executing the setup script.
  6. Restart your virtual machine once the installation is complete.

Set up shared folders

After Guest Additions is successfully installed, you can start setting up shared folders by following these steps:

  1. Make sure your virtual machine is shut down.
  2. Go to VirtualBox Manager and select the virtual machine you want to configure.
  3. Click on Settings.
  4. In the Settings menu, click Shared Folders.
  5. Click the Add Folder button (shaped like a folder with a plus sign) to create a new shared folder.
    • In the Add Share dialog:
      • Select Folder Path and choose an existing folder from your host OS to share.
      • Determine the folder name that your guest OS will recognize.
      • If you want the shared folder to be readable only from guests, check the Read-Only attribute.
      • If you want the folder to be mounted automatically each time the VM starts, check Auto-mount.
      • If you want this shared folder setting to persist in future sessions, check Make Permanent.
  6. Click OK to confirm and complete adding the shared folder.

Accessing shared folders in the guest OS

Once the folder is shared from the host, the next step is to access it from the guest OS. This method varies slightly from one OS to another. Let's take a look at Windows, Linux, and macOS guest systems:

Windows Guest

  1. Start your virtual machine.
  2. Once logged into the Windows guest OS, open File Explorer.
  3. Navigate to This PC.
  4. Under Network Location, you'll see the shared folder listed.
  5. If the shared folder doesn't appear automatically, you can map it manually by following these steps:
    • Right-click on This PC and select Map network drive....
    • Select the drive letter and enter the shared folder path in this format: \\VBOXSVR\SharedFolderName
    • Click Finish.

Linux Guest

  1. Start your virtual machine and log into the Linux guest OS.
  2. Make sure your user is part of vboxsf group. You can use the following command to add your user if necessary:
    sudo usermod -a -G vboxsf yourusername
  3. You may have to restart your session or reboot the virtual machine to apply the new group membership.
  4. Shared folders should be automatically mounted under /media/sf_SharedFolderName directory.
  5. Visit this directory in your favorite file manager or terminal to access the shared files.

macOS Guest

Unfortunately, native support for shared folders may not be directly available for macOS guests in VirtualBox. In such cases, consider using alternative file transfer methods such as external file servers, cloud storage, or configuring network access to transfer files between your host and macOS guest.

Troubleshooting common problems

If you have problems sharing a folder, consider these general troubleshooting steps:

Guest Additions not installed correctly

Make sure the Guest Additions are installed and running. Sometimes, reinstalling them can solve problems.

Permission Denied Error in Linux

If you are facing “Permission Denied” error while accessing folders on Linux guest OS, verify that your user is added to the vboxsf group as discussed earlier.

Shared folder not showing

Check if the shared folder is set to auto-mount. If not, try manually navigating to the path mentioned in the guest OS instructions above.

Network drive mapping fails on Windows

Make sure that network discovery is enabled and check the network settings to confirm that the virtual machine is on the expected network type (such as bridged or NAT).

Conclusion

Sharing folders between the host and guest operating systems in VirtualBox can greatly improve efficiency by streamlining data transfer processes. Whether your guest OS is Windows, Linux, or macOS, understanding the specific steps and nuances for each system will help you get the most out of this feature. Always ensure that the guest additions are installed properly, as they facilitate important functionalities, including shared folders. As you become accustomed to using VirtualBox, these processes will become second nature, increasing the productivity and usability of your virtual computing environment even more.

If you find anything wrong with the article content, you can


Comments