Tactical Technical Strike

Musings, Thoughts, Notes, & a brain dump of what I come across

Virtualbox: Mounting shared folders in a Linux guest

Posted on | May 13, 2010 | No Comments

Mounting and sharing drives between a host OS and a guest OS is dirt simple on Windows. You use the virtual box Shared Folders control (Devices Menu > Shared folders) to map a host location to a shared name, and then you just surf around the Network Places explorer to the VboxShared section, and viola!, the host filesystem is right there. But of course, nothing is ever as easy in Linux.

Well, I searched around more than once to finally figure this out and get it right, so that’s a clue to me to write it down somewhere (and then close the browser tab). Main tricks:

  • You need to use the VBOX file system
  • Like other *Nix mounting, make sure you have a mount point already created

So, what did I do? Well, here it is.

1. Create the shared folder using the typical Virtual Box Shared Folder process. Note the share name (listed in the folder name field), i’ll refer to this as {shared-name}).
2. Create a location within the guest to mount the share to (I’ll refer to this location as {mount-name}:

> cd /mnt
> mkdir {folder-name}
> mount -t vboxsf {shared-name} /mnt/{mount-name} //This command will likely need to be run as root (or via sudo if possible)

And there you go! You now have a mounted folder (in /mnt/{folder name}) that points to the folder you shared within the virtual box infrastructure. Yeah, you could go ahead and share the host OS’s folder via normal network techniques and using samba to get back to it, but that isn’t portable in the same way that Virtual Machines are meant to be. Hopefully this will get your virtual box shares working on Linux guest OSes.

**NOTE: The file system used for mounting is the vboxsf, not the vboxfs. Don’t ask me why…***

References:
[1] VirtualBox Shared Folders : Discussion of the different techniques and whether you need to use the vbox file system

Comments

  • Links, feeds, and all the other info that I need to be fully self-indulgent, shared, and organized. These links and widgets are subject to change.