0

A coworker asked me to help mount a shared Windows 10 folder in an Arch Linux guest using VirtualBox. The system had been set up by another coworker who was out to lunch.

The folder to be shared was E:\virtual_shared\. Guest Additions was installed and enabled. I could see the shared folder in /media/sf_virtual_shared/ and there existed a mount point at /mnt/share/. An ls -al /mnt/share/ showed that the target directory was empty. The user was part of the vboxsf group. All the permissions seemed to check out on both the host and the guest. Everything seemed to okay. However, I still couldn't mount it!

To mount it, I was using

# mount -t vboxsf /media/sf_virtual_shared/ /mnt/share/

and getting the error

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

I tried mounting to a new folder (~/test/) but received the same error.

Eventually, the person who set up the system came back from lunch. He simply ran

# mount /mnt/share

It turns out that fstab contained the following:

#
# /etc/fstab :static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
# UUID=5392b506-dde2-4a21-9c7e-86a6f9f94907
/dev/sda2               /               ext4             rw,relatime,data=ordered              0 1

# UUID=d6236258-9bea-446a-b38b-0244c048bb1
/dev/sda1               /boot           ext2             rw,relatime     0 2
virtual_shared                 /mnt/share       vboxsf        defaults               0 0

My question is, why wouldn't the mount call using absolute paths mount the directory? How does mount use fstab?

I know that mount is called at boot and goes through fstab sequentially. Even though /mnt/share/ was listed as empty, had something been mounted there, preventing the absolute path call from mounting? Why couldn't I still mount the shared folder to ~/test/?

2
  • Do any of the answers in this thread seem to apply?askubuntu.com/q/30396
    – sippybear
    Commented Oct 17, 2018 at 18:38
  • No, unfortunately, not. That was one of the resources I used while troubleshooting. They're all variations of mount -t vboxsf source/ target/. None of them seem to account for the fstab. Commented Oct 17, 2018 at 19:11

1 Answer 1

2

The vboxsf filesystem does not mount local directories on other directories – its source parameter is neither a relative path nor an absolute path; it is not a path at all. It is a string that only has meaning to vboxsf and to the VirtualBox app. (More specifically, it's the "share name" that you've configured within VirtualBox VM settings.)

Therefore fstab is not related here. The sources specified by these two mount calls simply aren't equivalent in any way.

(If it helps, imagine that vboxsf is a remote filesystem that works just like cifs/smbfs – because that's what it really is. And just like cifs requires a remote "share name" instead of local path, so does vboxsf.)

And what about the shared folder that's visible at /media/sf_virtual_shared? Well, this path itself is a mount point. If you look at findmnt, you'll probably see that a vboxsf instance has already been mounted to that location – presumably the vbox guest services automatically mounted it for you. So it's not a source that you can use; it's a target that has already been used.

(If you really want to mount a local directory on another directory, don't use any filesystem type at all – do it with mount --bind.)

1
  • 1
    To make it explicit for anyone who comes across this in the future, the share name in my case was virtual_shared. So, I needed to call mount -t vboxsf virtual_shared /mnt/share. Commented Oct 18, 2018 at 11:56

You must log in to answer this question.

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