VirtualBox is one of the best (and free!) Virtual machine apps, but it’s even more useful if your virtual machine can integrate more tightly with the host machine.
While you can network the host and guest computer fairly easily, most people probably want an easy way to exchange folders between the host and guest OS in VirtualBox. The good news is, it’s pretty easy to do!
Clarification of terms
It is important to quickly clarify a few key terms that will be used in this article:
- A virtual machine is a simulated computer running on another computer.
- The “host” computer is the physical computer in front of you.
- A “guest” computer is a virtual machine that is started by VirtualBox.
- “Pure metal” means running directly on a physical computer.
If you’ve ever watched the movie The Matrix , you can think of a virtual machine as a computer living in a simulated world. He thinks it is a real computer, but in reality it is just a program.
To use the shared folders feature built into VirtualBox, you need to install something called “Guest Additions” on the guest computer. At the time of writing, there are add-ons for:
For most people, the guest machine will probably be running Windows or Linux. If you’re running something a little more exotic (or trying to start macOS), this method won’t work.
Install Guest Add-ons
Before you can get shared folders to work, you need to install Guest Additions on the appropriate virtual machine It works by placing a virtual CD in the virtual machine‘s imaginary CD drive. We’re using Ubuntu Linux here, but VirtualBox will automatically detect which add-ons are appropriate for the guest operating system.
All you have to do is start your virtual machine and then click Devices and then Insert Guest Additions CD Image
In our case, the “CD” is played automatically, and the add-ons are installed without problems. To be on the safe side, we have restarted our virtual machine, but this is not entirely necessary. After installing the Guest Additions, you can add the shared folder to your virtual machine
Create a shared folder on the host
VirtualBox presents a shared folder on a host computer as a shared network drive or as a special file system extension for the guest operating system. Therefore, you need to assign this folder on the bare computer to use.
Each guest virtual machine can be assigned a different shared folder. This may be an existing folder or a folder that you have created specifically for this purpose. In any case, once you have decided which folder you want to share with the virtual machine, we must select and mount it.
We created a folder with a test text file inside for demonstration purposes.
Enable file sharing on guest device
You can add a shared folder to your virtual machine when it is running or stopped. We are going to mount a shared folder on our Ubuntu machine.
- Click the Devices menu and then Shared Folders> Shared Folder Options.
- In this settings menu, click the blue icon to add a new shared folder.
- Select the drop-down folder path and choose a different option. Select the folder you want to share and click Select Folder.
- Select automatic mount and click OK. Then click OK again.
The shared folder has appeared on the Ubuntu desktop, but you might have to look for it in your operating system’s list of network drives or in File System Explorer. In Ubuntu, we had to enter the admin password when opening a folder.
To remove a shared folder, simply go back to the same window you added it to and remove it from the list. Although the folder is shared, you can use it like any other mapped drive or drive.
Alternative ways to share folders between host and guest
Using the official method of exchanging files between host and guest isn’t the only way to move files between your bare computer and virtual machine
One of the easy ways to transfer files is to use a USB stick. VirtualBox allows you to transfer control of a USB device to a virtual machine Just copy all the files you want to transfer to the USB flash drive, and then switch control to the virtual machine using the VirtualBox menu.
Since your virtual machine also has Internet access, you can install a cloud storage package like Dropbox on both systems, as long as a version is available for the guest operating system. Though this means files will sync over your internet connection, which can be slow and consume a limited amount of data if you have one.
If all you have to do is copy something that will fit on the clipboard (like a password), then you better enable the shared clipboard in VirtualBox, which is also part of the Guest Additions.
Sharing files with virtually no errors?
Virtual machines are an incredible technological feat, but in terms of elegance they are still the computer equivalent of duct tape and cardboard. Ultimately, any solution for sharing files between host and guest will be somewhat messy.
That being said, we had no problem getting it to work between our Windows host and the Ubuntu guest. Many users will find it difficult to understand how different types of host and guest operating systems can be, but luckily the VirtualBox community has seen it all.
Therefore, if you run into a problem that you cannot solve, we recommend that you first search the forum and then post a question if there is no answer yet. However, most people who follow the instructions above will be fine.