CentOS – VirtualBox Shared Folder

I’m not sure if this is just a thing with CentOS or what, but I experienced some difficultly in getting shared folders to mount inside the a CentOS VirtualBox image. What I found was that the vboxsf kernel module was not loaded as indicated by the following message in dmesg:

automount Error: vbsvcAutoMountWorker: Could not mount shared folder 'Documents' to '/media/sf_Documents': No such device (19)

The solution is to do:

modprobe vboxsf

Followed up with:

mount.vboxsf -o rw,uid<UID>,<GID>dmode=775,fmode=664 <SF_NAME> <MOUNT_POINT>

Where:

  • UID: default file owner user id to UID
  • GID: default directory owner group id to GID
  • SF_NAME: name of shared folder
  • MOUNT_POINT: where to mount the shared folder

To get this to happen at boot, add the following to /etc/rc.d/rc.local:

modprobe vboxsf
mount.vboxsf -o rw,uid<UID>,<GID>dmode=755,fmode=644 <SF_NAME> <MOUNT_POINT>

On CentOS, the permissions on /etc/rc.d/rc.local are set to 0644 (-rw-r--r--) by default so be sure to change permissions to 0744 (-rwxr--r--) so that it’s executed on boot.

I’ve been using Linux in a VirtualBox environment for a number of years, and this is the first distro I had to jump through so many hoops to get working properly. I won’t even get into the BS of having to deal with a proxy and getting YUM & RPM to operate properly in that paradigm; because why should those two programs not use the system level proxy settings, right? Wrong; they have a separate configuration for them to understand proxy settings.

And that’s all I have to say about that.

This entry was posted in Geek, Linux and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply