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?

Questioner
  • 6,839

9 Answers9

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.

Louis Matthijssen
  • 11,885
  • 6
  • 44
  • 50
  • 1
    Thanks for this response. I got the error response: mount: unknown filesystem type 'vboxsf'. – Questioner Apr 27 '14 at 14:19
  • 4
    According to this you have to execute sudo apt-get install virtualbox-ose-guest-utils. – Louis Matthijssen Apr 27 '14 at 14:20
  • I installed the guest utils, and now I get the error /sbin/mount.vboxsf: mounting failed with the error: No such device. – Questioner Apr 27 '14 at 14:34
  • 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. – Louis Matthijssen Apr 27 '14 at 14:56
  • I found the command /etc/init.d/vboxadd setup on an answer on Stack Overflow. I also followed your revised instructions. Now the error I get with the mount command is mount: wrong fs type, bad option, bad superblock on New. – Questioner Apr 27 '14 at 15:14
  • 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. – Louis Matthijssen Apr 27 '14 at 15:14
  • That's just about done it. The mount command at the command line is now working. However, the line in fstab to make it permanent isn't working though, I get an error on boot saying it didn't work. – Questioner Apr 27 '14 at 15:22
  • 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. – Louis Matthijssen Apr 27 '14 at 15:46
  • That's done it! Working like a charm now. – Questioner Apr 27 '14 at 15:50
  • Doesn't work on my Ubuntu 15.10 on VirtualBox 5.0 on Windows 8.1. Ubuntu newly installed. When I "Install the necessary packages" I get a message that everything is up to date. When I try to install the Guest Additions, I get "The headers for the current running kernel were not found." I also tried apt-get update followed by apt-get install linux-generic. Still the kernel headers are not found. Why is this not working on a brand new Ubuntu install? – Buttle Butkus Feb 12 '16 at 05:31
  • It's working on Mac OS X 10.11.3 (host) + Debian 8 (guest), thank you. – Chu-Siang Lai Feb 27 '16 at 20:35
  • For fstab, I need to change defaults to defaults,_netdev to make it working. Thanks: http://askubuntu.com/a/539137/119378 – Xiaofan Hu May 15 '16 at 03:18
  • I did all the Windows and VirtualBox settings, but I needed also the linux mount command. Thanks. +1 – Roland Sep 30 '19 at 10:16
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).
muru
  • 197,895
  • 55
  • 485
  • 740
Vikas
  • 749
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.

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

Chad C
  • 1
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.

dario
  • 11
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.