8

I have a Ubuntu virtual machine (Virtual Box) hosted on my MBP w/ Mountain Lion. OSX 10.8.6, VirtualBox 4.2.16, Ubuntu 12.4 LTS (32 bit)

PROBLEM The shared folder(s) as seen in Ubuntu is/are empty.


Diary of searching for an answer on interwebs (No joy so far)

Share folder in VirtualBox Host=Mac OS, Guest=Debian - No joy. The answer is for manual mounting. Auto mounting explicitly puts/mounts the shared folder in /media directory. Besides I tried it and got "no such file or directory" - but then I may not be understanding exactly where I'm creating this; no terminal guru, I.

Next ...

Set the shared folder via VirtualBox | Devices | shared folders menu. The dialog box indicates "full" access and "auto-mount". Then launched the VM. The shared folder is created, but empty. BTW, the folders are created in /media directory per the VB documentation.

After launching the VM, in Ubuntu, using VB | Devices menu, created a new shared folder. Restart Ubuntu, folder is created but empty.

Next ...

Tried the above, creating "machine folder" and/or "transient folder" - same result as above.

Next ...

Tried the above referencing folders on both drives on my MBP. Same result.

Next ...

Tried adding my logged-in user to the vboxsf group in Ubuntu. useradd -g vboxsf someUser Ubuntu responded: useradd: user 'someUser' already exists

  • Having the exact same problem on a Windows 7 host and Ubuntu 12.0.4 guest. The auto-mounted folder that appears on /media/sf... is empty (and lacks permission unless I chmod them). Using mount -t vboxsf works great, but it doesn't persist after rebooting.. Did anyone find a proper solution to this problem? – user72826 Mar 12 '14 at 14:21
  • I would like to add an insight to this question. This problem occurs mainly when the shared folder name is changed. – Ébe Isaac Sep 21 '15 at 18:10
9

Found my answer

Assumption: "VirtualShare" is the shared folder name set up via Devices | shared folders ... menu

sudo mkdir /mnt/MyShare
sudo mount -t vboxsf VirtualShare /mnt/MyShare

AH! Now I can see the files in /mnt/MyShare/VirtualShare/

  • the mounting :( does not survive a restart/reboot

This answer is bewildering because the VirtualBox documentation explicitly states that auto mounting is done in /media directory. And indeed, the shared folder is created - but its empty.

Further, I did/do not understand the significance of /mnt directory. That looked arbitrary to me, but apparently not. ../MyShare piece of it is; use any name you wish.

Now if I could only delete all those folders I created during experimentation. And to think I used to be an absolute wiz on the CP/M command line! (that sure dates me!!)

  • 1
    Any update on this? That mount command you posted doesn't work for me, I have to actually reinstall the VirtualBox Guest Additions every time and then when I restart the mount folder is empty and I have to reinstall the Guest Additions again. Very frustrating. – Muers Mar 9 '15 at 21:03
  • Ah, I figured out what the problem was. I had a startup script that was interfering with the VirtualBox Guest Additions, so all I had to do was instead of starting the script via init.d, I used Ubuntu's "Startup Applications" application and made sure that my script was started AFTER the "vboxclient" (apps here start in alphabetical order). – Muers Mar 10 '15 at 3:04
  • "VirtualShare", which one is trying to mount, is like a tag to the actual windows folder. This tag is generated, when the windows-folder is added in the virtual-box shared-folder "machine/transient". Ensure, this has been done already. And then the above command will work with no issues. – parasrish Jun 16 '16 at 10:36
1

In my case, I have found a temporary way to bypass this. by using

ls -la

I found out that the folder belongs to root instead of the user that was created when I provisioned the VM. Since trying to change the owner of the folder or its content did not work, I copied the folder to my home directory

sudo cp -r foldername ~/foldername

then I was able to change the owner of the target folder and its content.

chown -R myusername:myusername ~/foldername

1

Suppose Virtual_Share is the name given to the shared folder as shown below.

enter image description here

Create a directory in a desired place, e.g., /media/VirtualShare

Open this file

$ sudo gedit /etc/profile

Add the following line in the file then save and close.

mount -t vboxsf Virtual_Share /media/VirtualShare

Source the /etc/profile file in Terminal...

$ sudo source /etc/profile

... or just reboot.

This solved it for me.

0

I had the same/similar problem with empty folders for shared folders (e.g. in /media/sf_my_folder_name)

It turned out that although I thought I has installed the guest additions, in fact the installation had failed. (check this by running lsmod | grep -i vbox - if the install worked you should get output referring to vboxsf, vboxguest & vboxvideo)

To install manually, I first ran 'insert guest additions CD image..' from the Devices menu to mount it, then from a terminal window ran

sudo sh /media/build/VBOXADDITIONS_5.0.8_103449//VBoxLinuxAdditions.run

then, check that your folder is mounted ( Settings/ Shared folders/ add ..) before rebooting.

The mounted, non-empty folder should then be in /media/sf_your_folder_name

You must log in to answer this question.

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