Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Want to add the command

sudo mount -t vboxsf H_DRIVE /media/windows7share

to /etc/init.d/rc.local file, to run the command every time when system starts up but I don't have such a file (rc.local) in that folder. What is the workaround?

share|improve this question
2  
Shouldn't that be /etc/rc.local? –  Piskvor Mar 4 '12 at 14:14
1  
filesystems to be mounted at boot are in /etc/fstab, even cifs mounts can be added, with security credentials stored in another file. Search for fstab cifs credentials –  bdowning Mar 4 '12 at 14:30
add comment

4 Answers

The workaround is to mount the entry in /etc/fstab. It should look something like this:

H_DRIVE    /media/windows7share   vboxsf    defaults        0 0

There's no reason for an RC script (which runs as root) to run 'sudo' to mount the volume. In this case, you don't even need to use an rc script at all.

share|improve this answer
add comment

Another option is using the automounter to mount that partition only if needed. Look at autofs and /etc/auto.mnt for details.

share|improve this answer
add comment

Where the "local" scripts file lies is distro-dependent. Here it is the set of files under /etc/local.d/, some systems will have /etc/init.d/rc.local, others, as Piskvor mentions, may have /etc/rc.local.

According to fedorafaq.org, this file is /etc/rc.local. If there's no such file, create it. Depending on how Fedora does it, the file may need the executable bit (chmod +x).

share|improve this answer
    
Fedorafaq is wrong about the location. It should be /etc/rc.d/rc.local. Fedora 15 creates a symlink from /etc/rc.local to /etc/rc.d/rc.local, I believe, but Fedora 16 does not, so creating it will do nothing. It must be executable. –  jsbillings Mar 7 '12 at 1:06
add comment

I am running Fedora 20. Mounting in fstab fails for me. There is a documented bug that mounting vboxsf in fstab fails at boot time. I moved the mount to /etc/rc.d/rc.local which made with the joyousness.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.