5

I'm able to mount a shared folder after boot, but on boot it doesn't work.

I followed the instructions:

http://not403.blogspot.com/2016/05/how-to-mount-virtualbox-shared-volumes.html

And added it to /etc/fstab and created a file in /etc/sysconfig/modules/local.modules (and made it executable and owned by root)

but it still doesn't work. instead i get an error:

systemd[1]: Failed to mount /webapps/apps/destfolder

How do I get this to work?

FSTAB

sharedfoldername    /webapps/apps/destfolder    vboxsf    rw,uid=48,gid=48    0 0

local.modules

#!/bin/sh

lsmod |grep vboxsf >/dev/null 2>&1
if [ $? -gt 0 ] ; then
    exec /sbin/modprobe vboxsf >/dev/null 2>&1
fi
Don Rhummy
  • 231
  • 3
  • 10
  • Please, add to the question the /etc/fstab line that are you trying to use. What error do you get in boot time? Please, mount the directory after boot and add the content of your /etc/mtab file for reference use. – Eduardo Baitello Mar 07 '17 at 01:22
  • @EduardoBaitello Added both things to the post – Don Rhummy Mar 07 '17 at 04:38
  • @EduardoBaitello After mounting, /etc/mtab has : `sharedfoldername /webapps/apps/destfolder vboxsf rw,nodev,relatime 0 0` but when I use that it also throws an error – Don Rhummy Mar 07 '17 at 04:48
  • Is `Failed to mount /webapps/apps/destfolder` the only error message you see in your log? – cg909 Apr 16 '17 at 19:16

1 Answers1

4

I was unable to get it to work in fstab. The only thing that worked was rc.local (which is in an odd location in centos 7):

#Edit the startup script
vi /etc/rc.d/rc.local

#Add the line (at the end):
sharedfoldername /webapps/apps/destfolder    vboxsf  rw,uid=48,gid=48    0   0

#Make it executable: (This is required in CentOS 7)
chmod +x /etc/rc.d/rc.local

Then reboot.

Thanks to this: http://www.joe0.com/2016/01/03/how-to-automatically-run-script-at-boot-time-in-centos-7/

Don Rhummy
  • 231
  • 3
  • 10