Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am writing to ask what the effect of the auto-mounting process is in VirtualBox, and where the folders can be accessed within a guest Linux system if auto-mount is used.

I have VirtualBox 4.0.4 installed on Mac OS 10.6.7, with Guest Additions apparently running correctly. The guest OS is Ubuntu 10.04, and I observe no apparent problems with it. I find that if the shared folders have "auto-mount" unchecked in the VirtualBox settings, they can then be mounted using the prescribed syntax

sudo mount -t vboxsf folder_name path_to_mount_point

and all works as it is supposed to.

But if the auto-mount option is checked, then I find that I can no longer mount the shared folders manually. I get the error

mounting failed with the error: Invalid argument

and the folders also do not appear to mount anywhere else accessible to me. Using the syntax

sudo mount -t vboxsf

without specifying a path installs them in /media, with their names prefixed with sf_, but they are not easily accessible there and I have not been able to change their owner using chown, either.

Thanks for your patient explanation.

share|improve this question

migrated from stackoverflow.com Apr 7 '11 at 0:33

This question came from our site for professional and enthusiast programmers.

1  
I don't have a fix, either but I'm running into the same issue with an Ubuntu 11.04 server guest running on a Windows 7 ultimate host. My work-around was to uncheck the auto-mount option in VirtualBox, and instead add the shared folders to fstab and have Ubuntu mount them automatically at boot time. –  quanticle Jul 23 '11 at 9:02
    
The thing I find interesting is that in an older installation of 10.04 (on an earlier version of VB) I did not have this problem and was able to mount shared folders easily. So I suspect it has something to do with VB rather than Ubuntu itself. –  brannerchinese Aug 6 '11 at 22:23
    
See also: superuser.com/questions/252257/… –  Skyborne Sep 26 '12 at 14:03

4 Answers 4

I had similar problems and found that my fstab wasn't auto mounting for some reason, whether I had the Auto mount checked or not. So I tried this approach instead and it worked fine:

  1. Create a directory to mount into (if you haven't already): mkdir -p /mnt/path_to_mount_point
  2. Edit your rc.local file: nano /etc/rc.local
  3. Append the following line and save: mount.vboxsf -w -o fmode=0777,dmode=0777 folder_name /mnt/path_to_mount_point

Reboot and it should mount with the correct permissions.

share|improve this answer
    
I got this to work finally,thanks +1 –  Phill Pafford Sep 6 '12 at 16:31
    
This works unless you're trying to mount something that needs to be loaded earlier in boot sequence - I'm trying to get VB to mount a new /home/user folder, and it seems that rc.local boots too late and the windowing system freaks b/c the home/user folder is missing.. –  stevemidgley Jul 22 at 3:29

As described in here:
https://www.virtualbox.org/manual/ch04.html#sf_mount_auto

With Linux guests, auto-mounted shared folders are mounted into the /media directory, along with the prefix sf_. For example, the shared folder myfiles would be mounted to /media/sf_myfiles on Linux and /mnt/sf_myfiles on Solaris.

Then it's also said that:

Access to auto-mounted shared folders is only granted to the user group vboxsf, which is created by the VirtualBox Guest Additions installer. Hence guest users have to be member of that group to have read/write access or to have read-only access in case the folder is not mapped writable.

So, you have to add your user to the group vboxsf with this command:

gpasswd -a your_user_name vboxsf

or

usermod -a -G vboxsf your_user_name


Then verify it:

groups your_user_name


For file manager, it will not reflect the change immediately, you have to log-out and log-in again too see the change.

share|improve this answer

That is happening because you haven't indicated to your Guess OS that it has to mount that folder, you just told VirtualBox to share that folder. In order to auto mount a folder in Debian (it should be simillar for other Linux)

Edit as root the file /etc/fstab and at the bottom add the following line:

folder_name      path_to_mount_point        vboxsf  defaults        0       0

The path_to_mount must exist

then just run:

sudo mount -a

or reboot your VM

share|improve this answer
2  
/etc/fstab does not work correctly for vboxsf –  Atilla Filiz Aug 10 '12 at 13:55
    
This also doesn't work, I get the error: '/sbin/mount.vboxsf: mounting failed with error: No such device' –  Phill Pafford Sep 6 '12 at 12:29

I shared a folder in Virtual box for the AndroVM machine but it was not visible under /mnt/shared. So I copied my data to a USB drive and added the USB filter to the AndroVM Virtual machine. I was able to access the data using /mnt/USB. This is one work around which was convenient for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.