New posts Mondays and Thursdays (usually). RSS.
Tell me what to install next: writingonlinux@gmail.com

Mounting a share on VirtualBox (Windows host, Mint guest)

I’ve already mentioned a way to sync documents between computers, but what if you’re writing in a virtual machine, like I am? It doesn’t make sense to use Dropbox or some other file synchronization service between your VM and your computer “proper,” as you’d essentially be storing a redundant copy of your files. This is why VirtualBox gives you the option to share folders.

It’s pretty simple to do actually, but there is a subtle catch. Before you do anything, anything at all, make sure the user you’re logged in as is part of the group vboxsf. To do this, open the Users and Groups application under the Administration menu. Select your username (it’s usually selected by default) and click Manage Groups. Scroll down until you see vboxsf, then click Properties, and tick the box next to your username. (For the curious: if you don’t do this, you won’t have read/write access to the share you’ve mounted! Whoops!)

If you don’t see a group called vboxsf, don’t worry – you probably don’t have Guest Additions installed. (Though how you managed to live without them I’ll never know.) On the VM window itself, go to Devices -> Install Guest Additions and double-click the CD that pops up on your desktop. The script should run automatically; log out, then back in, and you’re set.

There are two kinds of shares – temporary and permanent. If you add a temporary share (that is, you don’t tick the “make permanent” box) you’ll have to mount it yourself by entering a couple commands into Terminal. First you have to make the empty directory you want to mount to (for example, let’s say I’m going to mount my Dropbox folder to my Desktop):

mkdir ~/Desktop/Dropbox

Now to perform the mount itself, let’s assume the share’s name is My_Dropbox:

sudo mount -t vboxsf My_Dropbox ~/Desktop/Dropbox

And that’s it. But if you want a permanent share, it’s even easier. When adding a permanent share, be sure to tick the “auto-mount” box – this means you won’t have to enter a mounting command every time you start up Linux again. Once you reboot, you’ll find the share mounted at /media/sf_sharename. Of course, that’s not terribly handy, so why not make a symlink to it (a shortcut)?

In this example I’m going to assume, again, that my share’s name is My_Dropbox, and I want to create a shortcut to it from the Desktop:

ln -s /media/sf_My_Dropbox ~/Desktop/Dropbox

The nice thing about permanent shares is that they’re, well, permanent, so you’ll never have to go through this procedure again unless you’re mounting another share.

And that’s it, now the writing on your hard drive is easily accessible from inside your virtual machine.

Advertisements

6 Comments on “Mounting a share on VirtualBox (Windows host, Mint guest)”

  1. hj says:

    Thanks! Your solution for Win7 Host/ LinuxMint 13 KDE Guest folder access helped me resolve the problem after after 4 hours of searching and “bashing” elsewhere!

    One thing to note, as a newbie to linux, I was unclear initially what you meant by “…make sure the user you’re logged in as is part of the group vboxsf. To do this, open the Users and Groups application under the Administration menu.” Was it in VirtualBox, Windows or Linux I wondered? I finally uncovered it in LM of course, but it was confusing at first.

    Again, thanks. Now I can use my 12 year old scanner in LM and transfer the jpegs to Windows 7 which won’t recognize the old equipment!

  2. Darius says:

    Thank you very much! Your post really helped me to manage problem with shared folders.
    Darius from Lithuania

  3. Basu says:

    Thanks a lot. It solved my problem too with vboxsf.

  4. Earl Fong says:

    Very nice write-up about VirtualBox mounting shared folders with Windows host and Linux guest.

    My current setup is Windows 7, VirtualBox 4.3.10 and Linux Mint 16 as the guest. So far, I have not been able to successfully manually use the “mount” command, even when both the login user and root are already members of group vboxsf.

    What does work is to set the Shared Folder as both Make Permanent and Auto-Mount. By default the share then gets mounted to /media/sf_* after a reboot. For me, this is what I eventually wanted anyway, although it was frustrating not to be able to get the mount command to work.

    And as noted in this post, in any case the login user must be a member of group vboxsf in order to be able to access the shared folder after it has mounted.

    Thanks again for a well-written and informative post.

  5. Dero says:

    ^This. Still having trouble mounting on Mint Petra, Windows 8 Host, VirtualBox.

  6. thecolins says:

    Many thanks. An excellent concise post. I use a Macbook host and Ubuntu 14.04 in a VB guest environment and the permanent mount works perfectly.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s