VirtualBox is a great virtualization software from Sun Microsystems. I’ve previously written many articles on how to create a virtual machine in VirtualBox and how to install Windows 7 using VirtualBox.
If you’ve had any experience with virtualization software, you’ve probably also heard of VMWare and Virtual PC. I’ve previously used Virtual PC from Microsoft for all my needs and one feature that I really liked was the ability to easily share files and folders between the guest and host operating system.
In Virtual PC, all you had to do in order to share files from the host OS to the guest OS was drag and drop onto the desktop. Super easy. When I switched over to VirtualBox, I realized that sharing folders in VirtualBox is not as simple as dragging and dropping.
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.
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 Editions.
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.
Now click on the Add New Shared Folder button on the right.
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 and to 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.
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.
In this case, you can either browse to the shared folder by going to My Network Places – Entire Network – VirtualBox Shared Folders or you can map a drive letter to that shared folder. I prefer the second method to make it easily accessible.
net use x: \\vboxsvr\sharename
To do this, open an command prompt and type in the above command. Simply replace sharename with the Folder Name you used when adding a share. Note that you do NOT need to change vboxsvr.
To mount a shared folder in a Linux Guest OS such as Ubuntu, type in the following command:
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).
That’s it! You should get a message like “The command completed successfully” like shown below:
Now when you go to Explorer or My Computer, you’ll see the new drive mounted and ready for access!
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!