Automounting of VirtualBox shared folder not working in openSUSE 12.2

I have openSUSE 12.2 in VirtualBox and I tried adding the mount command in /etc/fstab but it doesn’t mount the folder on startup. The command DOES work if i run it with sudo in a terminal.

Host OS: openSUSE 12.1
Guest OS: openSUSE 12.2
VirtualBox: Oracle 4.1.12.x

Command that works in terminal:

sudo mount -t vboxsf mysite /srv/www/mysite

Command that does NOT work in /etc/fstab (I have it at the end of fstab and added it using “vi”):

mount -t vboxsf mysite /srv/www/mysite

Any idea what I’m doing wrong?

Did you know there’s a forum for virtualization? Anyway, the fstab entry for mounting a shared folder on boot will look something like

sharename   mountpoint   vboxsf   defaults  0   0

So I have a two part solution I use:

  1. I activate the after.local bash script per my instructions here in the openSUSE 12.x guest:

systemd and using the after.local script in openSUSE 12.1 - Blogs - openSUSE Forums

  1. Next, for each folder I want to share, I must add the folder name to my VirtualBox configuration and I normally allow a read/write ability. Then, in the after.local file in the guest I add, per shared folder:
if  ! -d /folder_name ] ; then
  mkdir /folder_name
fi
mount -t vboxsf folder_name /folder_name -o defaults

I do this for each folder I want to share and it works great. I keep an example external in the host and just copy/paste over the info after the guest is up and running.

Thank You,

What’s the benefit of this over using fstab? I see the benefit for wanting to create new folder if it doesn’t exist, but since I already created it, isn’t it just easier to put the one line in fstab? (I might be missing something)

Thanks this worked!