How can I specify the order in which filesystems are automatically mounted?

One option is to postpone mounting until after /etc/fstab has completed, this gives you full control over the mount order.

Just add noauto to the mount options in fstab, and mount in rc.local.

According to the man page, mount -a mounts the entries in fstab sequentially, while adding the -F ('fork') option will mount them in parallell. It appears that the standard boot is using 'fork', presumably to reduce boot time, so I guess mounting (semi-)manually afterwards is the simplest way to regain control of the mount order.


Systemd has now included a dependency option that enforces mount ordering. In your case add the fstab arguments:

x-systemd.requires-mounts-for=/,x-systemd.requires-mounts-for=/home/.hdd

The noauto option will not work if you need to mount over other mounted file systems. In my case the above worked see commit https://github.com/systemd/systemd/commit/3519d230c8bafe834b2dac26ace49fcfba139823 for more details.


I might consider setting up a script that mounts the second disks after the mount script has been called. In Ubuntu initd is the service that starts up all the componets of you operating system, and it is called upstart.

It is event based, meaning it looks / waits and emits events during the boot up process. As this post pointed out the initd service try to do things in parallel, which is probably what is causing your problems. So you could set your script to run straight after mount has finished and completed it processes.

The mount scripts are kept in the /etc/init/ directory. I would add your additional mount script there as well. Look at this description of the start up process. That site will probably help you get stared with your own script the fastest.

You need to have a start on section in your own script. See this section for starting a job after an other has finished.

I am still looking at how to create my own start up scripts my self, so I cant be any more helpful. If you do find a working solution please post it back here.

Tags:

Mount

Fstab