To share a folder between a VirtualBox host and guest, install the Guest Additions and configure a shared folder in the VM settings, then mount it inside the guest OS. This lets both systems read and write the same files, which is handy for moving data, editing code, or keeping backups. The exact steps differ slightly by guest OS, but the core process is the same.
What Is a Shared Folder?
A VirtualBox shared folder is a directory on your host machine (Windows, macOS, or Linux) that you make accessible to a virtual machine. It appears as a normal folder inside the guest OS, so you can drag files in and out, edit documents, and run scripts without copying data back and forth. The folder is not a virtual disk—it’s a direct link to the host’s filesystem.
This feature is part of VirtualBox’s Guest Additions, a set of drivers and utilities that improve integration between host and guest. Without Guest Additions, shared folders won’t work, and you’ll also miss out on better video resolution, mouse pointer integration, and clipboard sharing.
How Shared Folders Work
VirtualBox implements shared folders using a network filesystem protocol. On the host side, the VirtualBox service exposes the folder to the VM. Inside the guest, a driver (part of Guest Additions) mounts that folder at a designated path. The folder appears as a local directory, but all file operations are forwarded to the host.
There are two main types of shared folders: transient and permanent. A permanent folder is saved in the VM’s configuration and is available every time you start the VM. A transient folder is temporary—it disappears when the VM stops. You can create both through the VirtualBox Manager or the command line with VBoxManage.
You can also set a folder as read-only if you only want the guest to read files, not modify them. This is useful for distributing software or documentation without risking accidental changes.
Setting Up a Shared Folder (Step by Step)
Here’s how to create a shared folder for a typical VM. The steps assume you have VirtualBox installed and a VM already created.
- Install Guest Additions in the guest OS. With the VM running, go to the Devices menu in the VM window and select Insert Guest Additions CD image. Then run the installer inside the guest (on Linux, you may need to mount the CD and run
VBoxLinuxAdditions.runas root). Reboot the guest if prompted. - Open VM Settings. With the VM powered off (or while running, but some changes require a restart), go to Settings → Shared Folders.
- Add a folder. Click the folder-plus icon. Choose a host path (e.g.,
C:\Users\YourName\Sharedon Windows or/home/yourname/Sharedon Linux). Give it a name (no spaces, e.g.,shared). Check Auto-mount if you want it to appear automatically, and Read-only if needed. - Start the VM and log in.
- Access the folder in the guest. On Windows guests, it appears as a network drive (e.g.,
Z:). On Linux, it’s usually mounted under/media/sf_shared(wheresharedis the folder name). If you don’t see it, you may need to mount it manually:sudo mount -t vboxsf shared /mnt/shared.
That’s the basic flow. The folder is now shared.
Common Problems and Fixes
Many users hit a few typical issues. Here are the most common and how to resolve them.
- Shared folder not visible in guest: The most common cause is missing or outdated Guest Additions. Reinstall them and reboot. On Linux, also ensure the
vboxsfkernel module is loaded (runlsmod | grep vboxsf). - Permission denied when accessing the folder: On Linux guests, the folder is owned by root and the group
vboxsf. Add your user to that group:sudo usermod -aG vboxsf yourusername, then log out and back in. - Auto-mount doesn’t work: On some Linux distributions, auto-mount fails because the mount point isn’t created. Create it manually:
sudo mkdir /media/sf_shared, then mount. - Folder is read-only even though you didn’t set it: Check the folder’s permissions on the host. The guest’s access depends on the host user’s rights. Make sure the host user has write permission to that directory.
- Windows guest shows “Access Denied”: This often happens when the host folder is on a system-protected location (like
C:\Program Files). Move the folder to a user directory.
If you still have issues, check the VirtualBox logs (View → Logs) for errors related to shared folders.
Choosing the Right Sharing Method
Shared folders are not the only way to move data between host and guest. Here’s how they compare to other methods:
- Shared folders are best for ongoing, two-way access to a directory. They’re easy to set up and work well for development, document editing, and general file exchange.
- Drag and drop (also part of Guest Additions) lets you copy files by dragging them between windows. It’s convenient for occasional transfers but not for continuous access.
- Clipboard sharing copies text and images, not files (though you can paste a file’s content if it’s text).
- Network shares (SMB/NFS) are more complex but work across different machines and VMs. Useful if you need to share with multiple guests or remote hosts.
- Virtual disk images (like a second VDI) are slower to set up but give you a dedicated filesystem that can be encrypted or resized independently.
For most users, shared folders are the sweet spot: simple, fast, and reliable.
Performance and Limitations
Shared folders are generally fast, but they’re not as quick as a native disk. The overhead comes from the network protocol and the host’s filesystem. If you’re doing heavy I/O (like compiling large projects or running a database), you might notice a slowdown. In that case, consider using a virtual disk instead.
There are a few limitations to keep in mind:
- Shared folders are not supported for some guest OSes (like very old Windows versions) without extra drivers.
- You can’t share a folder that is already in use by another VM with conflicting access, though multiple VMs can share the same host folder simultaneously.
- Symbolic links and special files (like sockets) may not work correctly across the shared folder.
- If the host folder is on a network drive, performance will be worse and reliability may suffer.
Also, be careful with permissions: if you set a folder as read-only, the guest cannot write to it, but the host still can. This can lead to confusion if you forget the setting.
Security Considerations
Sharing a folder gives the guest full access to that directory (unless you set read-only). If the guest is compromised, the attacker could read or modify files on the host. So, only share what you need, and avoid sharing your entire home directory or system folders.
For sensitive data, consider using a separate user account on the host with limited permissions for the shared folder. You can also use VirtualBox’s encryption feature for the whole VM, but that doesn’t protect the shared folder because it’s not part of the virtual disk.
If you’re using a VM for testing untrusted software, it’s safer to use a virtual disk for data transfer and avoid shared folders altogether.
Alternatives to Shared Folders
If shared folders don’t work for you, here are some alternatives:
- Virtual disk: Add a second virtual hard drive to the VM and format it. You can then move files by shutting down the VM and mounting the VDI on the host (with tools like
VBoxManageor third-party software). - Network transfer: Set up a simple HTTP server on the host or use
scpif you have SSH. This works for one-off transfers but is clunky for continuous use. - Cloud storage: Use Dropbox, Google Drive, or similar to sync files between host and guest. This requires internet and may have privacy concerns.
- USB passthrough: If you have a USB drive, you can pass it through to the guest and copy files. This is good for large transfers but not for ongoing sharing.
Each method has trade-offs in speed, convenience, and security. Choose based on your specific needs.
Frequently Asked Questions
Why can’t I see my shared folder in the guest?
Most likely, Guest Additions aren’t installed or are outdated. Reinstall them and reboot. Also, check that the folder is properly configured in the VM settings and that you’ve mounted it manually if auto-mount fails.
How do I mount a shared folder manually in Linux?
Use the command sudo mount -t vboxsf shared_folder_name /mount/point. Replace shared_folder_name with the name you gave the folder in VirtualBox settings, and /mount/point with an existing directory (e.g., /mnt/shared). You might need to create that directory first.
Can I share a folder between multiple VMs?
Yes, you can add the same host folder to multiple VMs. Each VM will have its own mount, and they can all access the same files. Be aware of potential conflicts if two VMs write to the same file simultaneously.
Does a shared folder work when the VM is headless?
Yes, shared folders work in headless mode. You can configure them via the command line using VBoxManage sharedfolder add. The guest still needs Guest Additions installed.
Why is my shared folder slow?
Performance can degrade if the host folder is on a network drive, or if the guest is doing many small file operations. Try moving the folder to a local SSD, or use a virtual disk for heavy I/O tasks.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Poco C51 Airtel Prepaid Locked Variant India?
- Jenkins vs GitHub Actions: Which CI/CD Fits Your Team?
- Turn Off Backup Encryption in iTunes?
- Campus Tech Innovation Hubs: What They Are
- Shared VPS Hosting: Is It Better?
- Disk Defrag Pro: What It Does and Whether You Need It