106

I have Ubuntu 14.04 as my host system, and then on Virtualbox, I have Lubuntu 14.04.

I am trying to share a folder on my host system so that my guest system can write files to it. I've followed instructions as best I can, installed the Virtualbox guest additions. I've got to the point where I've added the shared folder in the Devices interface:

shared folder

However, even after rebooting, I can't find the folder anywhere in my guest system.

How do I get my shared folder to actually show up in my guest Lubuntu machine?

5
  • How are you trying to access the shared folder? Apr 27, 2014 at 14:08
  • @LouisMatthijssen, I was led to believe it would show up in my /media folder on my guest machine. There is no folder there, or in /opt or /mnt, or anywhere else.
    – Questioner
    Apr 27, 2014 at 14:09
  • this askubuntu.com/a/161883/202806 may help you. Apr 27, 2014 at 14:30
  • @AvinashRaj, I tried the commands suggested there, but I'm getting the same mount errors I've reported in the comments below.
    – Questioner
    Apr 27, 2014 at 14:42
  • 1
    This may help too: askubuntu.com/questions/30396/…
    – Takkat
    Apr 27, 2014 at 15:44

9 Answers 9

130

You have to mount your folder on your VM.

First you need to install Guest Additions (although I already did this during the installation).

  1. Start your VM
  2. Devices > Insert Guest Additions CD image...
  3. I had to manually mount the CD: sudo mount /dev/cdrom /media/cdrom
  4. Install the necessary packages: sudo apt-get install make gcc linux-headers-$(uname -r)
  5. Install the Guest Additions: sudo /media/cdrom/VBoxLinuxAdditions.run

Now you can mount your share using:

mkdir ~/new
sudo mount -t vboxsf New ~/new

Where New is the name of your shared folder.

Now you can access the shared folder at ~/new.


Note: this is not permanent. To permanently mount your folder you should add the following line to /etc/fstab (sudo nano /etc/fstab):

New /home/user/new vboxsf defaults 0 0

Obviously you should replace user in /home/user/new by your own username.

13
  • 1
    Thanks for this response. I got the error response: mount: unknown filesystem type 'vboxsf'.
    – Questioner
    Apr 27, 2014 at 14:19
  • 4
    According to this you have to execute sudo apt-get install virtualbox-ose-guest-utils. Apr 27, 2014 at 14:20
  • 1
    I've updated my answer, but you already seem to have the Guest Additions. I'll try it with Lubuntu myself and update my answer if I find a solution. Apr 27, 2014 at 14:56
  • 2
    Okay, I managed to get it working. It seems that /sbin/mount.vboxsf is linked to the wrong file (this will be fixed in the next version). Please create a link to the good file (for x64): sudo ln -sf /usr/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf. Apr 27, 2014 at 15:14
  • 3
    I couldn't get it working in a clean way too. The following works for me: execute sudo nano /etc/rc.local and add mount -t vboxsf New /home/user/new before exit 0. Apr 27, 2014 at 15:46
64

How to access Windows Host shared directory from Ubuntu VirtualBox Guest:

  1. Create a directory in Windows on any location of your choice.
  2. In the VirtualBox go to the settings of the Ubuntu Guest.
  3. Under the Shared Folder section add the location of you folder created with full permission.
  4. Now start the ubuntu guest, and make sure that you have the latest VirtualBox Guest Additions installed
  5. Now add your user to the vboxsf group:

    sudo usermod -aG vboxsf $(whoami)
    
  6. Logout the user and login again.

  7. Now you can access your shared directory in /media/sf_(shared_folder_name).
4
  • 7
    This answer helped me a lot. That was the ONLY reason. sudo usermod -aG vboxsf $(whoami)
    – user565447
    Mar 27, 2017 at 13:19
  • 1
    The usermod part worked for me ... after I logged out and back in again. Just opening a new terminal did not cut it, a login was required. Feb 24, 2018 at 3:22
  • Thanks. This is the proper way to do it, since it lets you add and remove shares easily from the VirtualBox GUI.
    – japzone
    Jun 27, 2019 at 23:05
  • "sudo usermod -aG vboxsf (myUbuntuUsername)" worked for me thanks
    – GforGIS
    Jun 3, 2021 at 8:58
16

How to share folders in virtual box (Step by Step Guide)

  1. Go to Virtual Box/Device/Shared Folder (on host OS)
  2. Add a folder that you want to share in the pop-up. (on host OS)
  3. Let’s name this folder “Shared” (on host OS)
  4. Now Go to Device and install guest addition.
  5. Now next step would be to create a folder that you want to sync with host OS, but make sure that you are at /home/UserName.

    You can check it by typing pwd in the terminal. Now creating directory -

    mkdir Share
    sudo chmod 777 /home/userName/Share
    
  6. Now install guest additional package (Crucial step! People generally miss this which creates an error “Unknown file type “vboxsf”)

    sudo apt-get install virtualbox-ose-guest-utils
    
  7. Now do the final step by mounting the folder (on guest OS)

    sudo mount -t vboxsf share ~/Share/
    
  8. Done! now sync files between Host and Guest OS through virtual box.

3
  • Can you explain 4-th point? Mar 24, 2017 at 16:42
  • @gstackoverflow: From the host OS, in the VirtualBox menu, click [Devices] -> [Insert Guest Additions CD Image]. You will see a popup within the host prompting whether to automatically run the contents on the CD—do so. Jun 21, 2017 at 2:28
  • Working for me in Deepin Linux 20 with VirtualBox 6.1.6, only I install Guest Addition from VirtualBox, but is the same. thanks May 11, 2020 at 15:32
9
  1. Highlight the VM, go to Settings > Shared Folders and add folder.
  2. Start VM Go to Devices > Insert Guest Additions CD image.
  3. Allow VM to run Guest Additions installations.
  4. In terminal run: sudo adduser (your user name here) vboxsf
  5. Restart VM.
2
  • 2
    Simplest solution! Worked for me. Thanks!
    – Mobi Zaman
    Jan 13, 2022 at 5:47
  • I had run the guest additions before and some things were working, but not shared folders. Seems like we have to run it again after sharing the folders. Thanks! :)
    – marcelocra
    Apr 8, 2022 at 16:57
6

I think you missed manually creating and mounting the Host OS folder into the Guest OS. Here is how I got it working on my system. System configurations :

Host OS : Windows 10
Guest OS : Ubuntu Xenial
Virtual Box : Oracle Virtual Box 6.0

Created SharedFolder from the desired VirtualBox settings as given in below image :

enter image description here

Folder Path is the actual folder path on the Host OS. Folder Name is any arbitrary name you choose to have for your shared folder; it need not be physically present either on Host OS or Guest OS. Now, we need to actually mount the shared folder on the Guest OS. Run the following commands on the Guest OS, from the user's home directory : mkdir -p ~/shared3; sudo mount -t vboxsf shared2 ~/shared3 . Hereon, the ~/shared3 folder on the Guest OS will show same content as the Folder Path on the Host OS, and the folder will be readable/writable both ways.

3

It`s important verify that you have upgraded the virtual box version. In my case I was trying to mount my very old version of guess additions on Ubuntu 15.04 and every thing failed. The solution were simple: Upgrade your Virtual box app.

0

I solved it by installing samba and sharing the folder with unity features. Then I could see the folder in the network of my virtual machine.

0

The easiest thing to do would be to create a homegroup in windows if you are running the ubuntu OS in Virtual box for windows. Install guest additions. Then go to Files and look for Network. Ubuntu will help you join the home-group in windows and depending on how you have set sharing privileges, you can access, edit and transfer data. Please bear in mind that you should be connected to a network, and ADHOC, some wireless LAN etc but not necessarily to the Internet.

0

I know this post is a little old, but I have the same issue using VBox Guest tools v. 6.0.14, running an Oracle Linux 7.7 guest host kernel 4.1.12-124.33.4.el7uek.x86_64. The workaround is to downgrade the guest tools to 6.0.10. You can download the specific guest tools iso from http://download.virtualbox.org/virtualbox/6.0.10/

Once downloaded, I just had to rename it to "VBoxGuestAdditions.iso", then I was able to mount it with the GUI (not manually). It uninstalled the 6.0.14 version without any issues (even though it is the higher version), and issue resolved.

There are two logged defects with VirtualBox for this error, so hopefully it will be corrected in the next version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .