Share Folders between Host and Guest OS in VirtualBox

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.

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.

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.

share folders between guest and host

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

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 and to make the shared folder permanent.

add a shared folder

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 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.

Linux Guest

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:

virtualbox shared folders

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

mapped network drive

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!

Comments [19]

  1. vinod says:

    Nice one:-). It reduced my pain using VirtualBox. Thanks


  2. Hissam says:

    Thank a ton.

    This really helped me


  3. ibrahim says:

    thank you very very much…this was great help! Who knew the process for sharing a file between the host and guest OS would be so convoluted!

  4. hypercaine says:

    Thanks a lot man!

  5. Ryan says:

    Hey im running windows 7 host and XP guest, im trying your directions for sharing but it doesnt seem to be working…. any suggestions?

  6. sasso says:

    That is very easy !!!, Thank you so much.

  7. sasso says:

    but after restarting I have "An error occurred while reconnecting X: to vboxsvrsharename"

    after I rerun the command it works !!!

  8. Alexander says:

    Thanks, a very useful article!

  9. yousef says:

    This was awesomely helpful. Thanks!

  10. ldorfman says:

    I’m running Windows 7 host and XP guest and finally managed to do it – I couldn’t believe it when if finally worked… Somehow it was not easy, even with the great help from reading the explanations here. I kept getting System error 53 and 85 on the command prompt and just when I was about to give up and start looking for another solution (some kind of an online folder), amazingly it worked. Thank you!

  11. mustafa says:

    very helpful! thank you very much

  12. Winnie says:

    What clear and precise step-by-step instructions. Thanks a ton.

  13. Raj kumar says:

    Awesome man, it worked for me, was able 2 configure within minutes time.

  14. giang says:

    Found this one, helped a lot. Thank you

  15. Vabbs says:

    After setting shared path, I get error “The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error. Broken shared folder!” Then it says,

    “Details: Error:BrokenSharedFolder
    Severity: Warning”

    The folder can be accessed properly from Win 7 which is my host OS. Guest OS is Mint Maya. I am a total newbie to Linux and virtual box stuff. Please let me know how this issue can be solved. Thank you.

  16. Herb Harrell says:

    it’s not quite working for me (host OS X 9, guest Oracle Linux 5);
    tried this:
    $ mount -t vboxsf -v sf_RPO_stuff /mnt
    got this:
    mount: only root can do that
    any help will be much appreciated

  17. habib says:

    Hello Herb Harrell. Try “$sudo mount -t vboxsf -v sf_RPO_stuff /mnt” it will ask for the account password

  18. steve says:

    I have the Shared drive configured on my VM, but how do I access the shared folder from my host machine?


  19. park says:

    Hey, this post saved me a lot of time. Thanks!

Leave a Reply