I created a new Fedora 21 VM for myself this weekend.


As usual, I had to look up how to mount the VirtualBox shared-folders correctly in the guest so that the user account in the guest OS has full RW access to the system’s harddrive.

Note

Shared-Folder support works best when you have the VirtualBox Guest Additions properly installed. The kernel support for the Guest Additions greatly simplifies these details. On fedora I needed to upgrade the kernel and install gcc in order to successfully install the Guest Additions.

On VirtualBox, just mounting a shared-folder temporarily is as simple as using sudo mount -t vboxfs <shared-folder-name> <mount-point>. However, if you want the folders to be mounted and ready right after booting up the system - like I do - then you’ll want to put something like this into your /etc/fstab file:

<shared-folder-name> <mount-point> vboxsf rw,uid=1000,gid=1000,comment=systemd.automount 0 0

Where:

shared-folder-name
This is just the name given to the shared folder in the VirtualBox Shared Folders GUI.
mount-point
This is a path to a directory that the shared folder will be mounted to.
uid=1000,gid=1000
This will set the file ownership to match the given UID/GIDs. It depends on the filesystem type, whether or not this is desireable. My mounts are both NTFS (which has no ownership concept) so this makes my user the owner instead of root.
comment=systemd.automount
This one is only necessary if your guest system runs the systemd Init system. In general, fstab mounts will often happen before all of the additional kernel modules are loaded. Often this is because a kernel module could be on a filesystem that needs to be mounted before the kernel module can be read from disk. In some cases the "vboxfs" filesystem support modules can fall into this category. Adding this option tells systemd that it needs to load the required modules before attempting to set up this filesystem mount. Without this option, the vboxfs mounts will fail at boot time and will need to be manually mounted after boot.

There. Maybe that will save somebody - or me - some time in the future.

" "