VirtualBox: Ubuntu Host and Ubuntu Guest. Where is my shared folder in the Guest?

20
2014-04
  • Peter.O

    I am running VirtualBox OSE in an Ubuntu Lucid host.
    The Guest system is also Ubuntu Lucid.

    I've set up a Host directory to share with the Guest via VirutulBox's Shared Folders.
    This directory is owned by the same user who is running the VM.
    The permissions on the directory are: drwxrwxrw

    I've installed virtualbox-guest-additions(via Synaptic)

    I can't find the shared diretory on the Guest.

    I've looked high and low, in /media and /mnt... nothing!

    I managed to share the same directory with a Windows Guest, but I am familiar with Windows...

    Am I just missing something simple?

  • Answers
  • evgeny

    Yep, you just need to mount the directory manually. To do that, use mount -t vboxsf SHARENAME /path/to/where/to/mount.

    SHARENAME depends on your shared folder, it is the name you entered into VirtualBox Shared Folders dialog.

    /path/to/where/to/mount should ideally be inside your user directory (inside VBox). In my case, I use /home/evgeny-vbox/Documents.

    EDIT: if you want it to be mounted at boot-time too, add this to your /etc/fstab:

    SHARENAME /path/to/where/to/mount vboxsf defaults 0 0
    

  • Related Question

    mount - Error mounting VirtualBox shared folders in an Ubuntu guest
  • skaz

    I have Ubuntu 10 as the guest OS on a Windows 7 machine. I have been trying to setup shares through VirtualBox, but nothing is working. First, I create the share in VirtualBox and point it to a Windows folder. Then I try to mount the drive in Linux, but I keep getting

    /sbin/mount.vboxsf: mounting failed with the error: Protocol error

    I have read so many solutions to this, but none seem to work. I have tried:

    • Using the mount.vboxsf syntax
    • Reinstalling VBox additions
    • Rebooting
    • Enabling and trying as root account

    I made a share called "Test" in VBox Shared folders. Then I made a directory in ubuntu named "test2". Then I tried to execute this command:

    sudo mount -t vboxsf Test /mnt/test2

    Any other ideas?


  • Related Answers
  • Takkat

    In order to use shared folder functionality few prerequisites need to be met:

    • Make sure that Guest Additions are properly installed on the guest OS.
    • Users in a guest Ubuntu must be in the group vboxsf to be able to access shares.
    • Define a directory on the host that will be used in the virtual machine using the settings dialogue of Virtual Box.
    • Do not share personal folders like /home/username or My Documents
    • avoid special characters or empty spaces in the path to the shared folder
    • use different names for share and mountpoint
    • create a mountpoint on the guest OS (best in your HOME directory).

    Testing shared folders functionality can thus be done by creating a shared directory on the host (e.g. C:\myshare), define this as a shared folder for your guest system in Virtual Box settings (e.g. share), create a mount point in your guest os (e.g. mkdir /home/username/host)and mount this in the guest OS with the command:

    sudo mount -t vboxsf -o uid=1000,gid=1000 share /home/username/host
    

    where the option -o makes sure that you will have access to the mount (that will otherwise be owned by root).

    For further information on shared folders see also the Virtual Box User Manual.

    Files or directories can also be shared over the network by using Samba on the host and the guest.

  • Community

    I also met this trouble. I found that the shared folder were already mounted at /media/sf_share.

    I tried to delete /media/sf_share, but I couldn't.

    So I deleted shared folder "share" in my home directory.

    $ rm -r ~/share
    

    And then switch to root user with the following way:

    $ sudo -i
    

    Create softlink/shortcut to the /media/sf_share folder that owns by root user modify the ownership of softlink with chown command. Exit from root user to normal user

    # ln -s /media/sf_share /home/username/share
    # chown username.username /home/username/share
    # exit
    logout
    
    $ chmod 777 ~/share
    

    You can see the files in Windows through the shared folder. And username must be a member of group vboxsf.

  • user1482789

    I also struggled a lot with the mounting, and tried everything I come up with in the interwebz but I finally found a very weird workaround to solve it! My guest is Ubuntu 13 and my host is Windows 7.

    Change to the media folder and from there type user@os:/media$ sudo mount -t vboxsf share /home/username/folder

    Yeah, that's it. But I don't understand how come it only works if it's done from the media folder. If someone knows please kindly explain us below. Thanks.

    P.s. Editing my /etc/rc.local to do the automounting at startup doesn't work for me.