Share Folders between Host and Guest OS in VirtualBox

VirtualBox is a great free virtualization software from Oracle. I’ve previously written many articles on VirtualBox, including how to install Ubuntu in VirtualBox and how to run VirtualBox from a USB drive.

If you’ve had any experience with virtualization software, you’ve probably also heard of VMWare and Hyper-V. I’ve previously used Hyper-V from Microsoft for converting my PC into a virtual machine and one feature that I really liked was the ability to easily share files and folders between the guest and host operating system.

In VMWare and Hyper-V, all you have to do in order to share files from the host OS to the guest OS is drag and drop between the desktops. Super easy. When I switched over to VirtualBox, I realized that sharing folders in VirtualBox was not as simple as dragging and dropping.

virtualbox share folders

This was really annoying to me at first and it took me a little while to figure out exactly how to do it! In this article, I will walk you through the steps for sharing folders between guest and host OS in VirtualBox.

Share Between Guest and Host in VirtualBox

First, you have to install VirtualBox Guest Additions in the guest OS. You can do this by going to Devices and clicking on Install Guest Additions CD image.

Once installed and your guest OS rebooted, you need to create a virtual shared folder. You can do this by going to Devices again and clicking on Shared Folders – Shared Folders Settings.

Now click on the Add New Shared Folder button on the right.

share files virtualbox

In the Folder Path box, click the down arrow and then click Other. Browse to the folder on the host OS that you would like to share with the guest OS. In the Folder Name box, give your share a name. You can choose to make it read-only, auto-mount the folder after restarts, and make the shared folder permanent.

Click OK and the new shared folder will show up under Machine Folders if you chose to make it Permanent, otherwise it will show under Transient Folders.

share folders virtualbox

Now click OK to close the Shared Folders dialog. You have to do one more thing in order to be able to actually access the folder on the host OS. Depending on whether the guest OS is running Windows or Linux (Ubuntu, etc), the method is different.

Windows Guest

In this case, you can either browse to the shared folder by going to ComputerNetworkVBOXSVR or you can map a drive letter to that shared folder.

I prefer the second method to make it easily accessible. The easiest way to map the folder to a drive letter on the virtual PC is to simply right-click on the folder as shown above and choose Map Network Drive.

Pick a drive letter, make sure Reconnect at login is checked and then click the Finish button.

You can also map the network drive using the command prompt, if required. To do this, open a command prompt and type in the command below.

net use z: \\vboxsvr\sharename

Simply replace sharename with the Folder Name you used when adding a share. Note that you do NOT need to change vboxsvr. Also, you can use any letter that is currently free; it doesn’t have to be Z if you don’t want. That’s it! You should get a message like The command completed successfully as shown below.

Now when you go to Explorer or My Computer, you’ll see the new drive mounted and ready for access!

Linux Guest

To mount a shared folder in a Linux Guest OS such as Ubuntu, type in the following command in terminal:

mount -t vboxsf [-o OPTIONS] sharename mountpoint

Replace sharename with the name of the share and mountpoint with the path where you want the share to be mounted (i.e. /mnt/share).

Not too hard eh? Of course, if you didn’t know you had to do all this, it could get quite frustrating! Now when you need to share files or folders in VirtualBox, you’ll be able to do it easily. Enjoy!