Automount Virtualbox Shared Folder in Fedora

Recently I have been trying to mount my shared folder in Virtualbox, during boot time. I have browsed all over the internet, and asked everywhere. If anyone wants to have some references, i tried all these:

I have posted these, hoping that will help someone else and that he won’t need to resort to my weird solution. Because i learnt the hardway, that fstab, fedora and virtualbox, are something that do not intend to work together. At least not in a way that i found.

My host OS is Fedora 20 and its uname -a is :

Linux localhost.localdomain 3.17.7-200.fc20.x86_64 #1 SMP Wed Dec 17 03:35:33 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

My Virtualbox version is:

sudo yum info VirtualBox-4.3.x86_64
Loaded plugins: langpacks, refresh-packagekit
Installed Packages
Name : VirtualBox-4.3
Arch : x86_64
Version : 4.3.20_96996_fedora18
Release : 1
Size : 145 M
Repo : installed
From repo : virtualbox
Summary : Oracle VM VirtualBox
URL : http://www.virtualbox.org/
License : GPLv2

My Guest Os is Fedora 21 and its uname -a is:

Linux localhost.localdomain 3.17.7-300.fc21.x86_64 #1 SMP Wed Dec 17 03:08:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

The solution i found, is not one that i actually recommend, but if for some reason, you really want to mount your shared folder, during the guest boot, this seems to work for me. We will create an rc.local file, with our mount command, which will run during boot time and will mount the vboxsf filesystem. Although Fedora says that it moved from SysV and init.d to systemd, those wishing to execute additional programs at boot could insert commands into /etc/rc.local

Moving on… We create this file:

sudo vi /etc/rc.d/rc.local

and inside it, we write what we usually use to manually mount the Virtualbox shared folder. What works for me is:


#!/bin/bash

mount -t vboxsf -o rw,uid=48,gid=48 site /var/www/html/

Pay special attention at including the line: “#!/bin/bash” at the new file. We should then make the file executable, like this:

chmod 755 /etc/rc.d/rc.local

and reboot the Guest OS.

This should work fine, and the shared folder will be mounted before your default user logs in. Once again, this does not seem as a sane solution from my part, but it does the job for now. Hope i helped you.

Advertisement
Tagged , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: