3

Question:

When in Ubuntu Linux boot process are filesystems (from /etc/fstab) mounted?


Rational:

I defined the following shared-folders on my Ubuntu VirtualBox VM.

openstack@ubuntu:~$ grep vboxsf /etc/fstab
tmp     /home/openstack/shared/tmp      vboxsf  defaults        0       0
images  /home/openstack/shared/images   vboxsf  defaults        0       0
openstack@ubuntu:~$

Mounting them from the shell is no problem.

However, during the boot process, their mounting fails:

enter image description here

Upon entering maintenance mode, I verify the problem to be that the vboxsf module is not loaded in the kernel (and subsequently, after it's loaded, the mount succeeds):

enter image description here

I want to solve this by creating a new rc file, that will execute the modprobe vboxsf command before /etc/fstab is read.

So, I tried executing modprobe vboxsf at the start of run-level 2:

openstack@ubuntu:/etc/rc2.d$ ls -ls /etc/rc2.d/S10modprobe-vboxsf
0 lrwxrwxrwx 1 root root 25 Apr 28 14:36 /etc/rc2.d/S10modprobe-vboxsf -> ../init.d/modprobe-vboxsf
openstack@ubuntu:/etc/rc2.d$ cat ../init.d/modprobe-vboxsf
/sbin/modprobe vboxsf
openstack@ubuntu:/etc/rc2.d$ ls -ls ../init.d/modprobe-vboxsf
4 -rwxr-xr-x 1 root root 22 Apr 28 14:33 ../init.d/modprobe-vboxsf
openstack@ubuntu:/etc/rc2.d$

but the shared folders still fail to mount from /etc/fstab.

Google did not bear fruit, so - my question is:

How do I load the vboxsf module to the Ubuntu kernel, before /etc/fstab is read and file-systems are mounted?

1
  • Be aware that the answer, and even the behaviour shown in the question, are radically different on Ubuntu version 15. The handling of failed auto mounts, the interaction with fsck, the point at which mount units are activated, the way in which such dependencies can be expressed, and even the mechanisms available for loading modules, are very different with systemd.
    – JdeBP
    May 3, 2015 at 20:41

2 Answers 2

3

Try adding vboxsf to /etc/modules (check to see if it is already there first, though I have a feeling it is not) and see if that helps.

Otherwise, a similar question has been asked over at askubuntu. See if any answers there help you at all:

https://askubuntu.com/questions/252853/how-to-mount-a-virtualbox-shared-folder-at-startup

Edit to try and answer the question as asked in the title: I am not sure when exactly mounts take place during the boot process, though I suspect it happens after (most?) kernel modules are loaded, since at least some file systems require certain modules to be loaded in order to work (eg, nfs, vboxfs, etc).

2
  • Thanks for the /etc/modules suggestion, @yzhernand. Indeed, after adding vboxsf to /etc/modules, the shared file-systems get mounted during boot.
    – boardrider
    Apr 28, 2015 at 16:53
  • Excellent! Glad that worked.
    – yzhernand
    Apr 28, 2015 at 18:11
0

Disclaimer:

The answer for those who found the question by google search for phrase similar to the title of the question.

On Linux with systemd (at least on systems I use) it is systemd that processes mounts (below two variants of listing system output, where entries are found depends on whether messages already moved from ring buffer to syslog, /media/drive is from /etc/fstab:

dmesg | grep media
dmesg -F /var/log/syslog | grep media
               [    4.494745] systemd[1]: Mounting /media/drive...
               [    4.499664] systemd[1]: Mounted /media/drive.

P.S. systemd is started right after kernel is loaded fully (AFAIK).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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