Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a particular row in /etc/fstab to be mounted always after two other rows:

# Always mount these first
UUID=fdf38dd4-9e9d-479d-b830-2a6989958503 / ext4 noatime,discard,errors=remount-ro 0 1
UUID=2b548eb8-fa67-46ce-a998-91d587dba62f /home/.hdd ext4 errors=remount-ro 0 2

# Always mount this second
none /home/ak aufs br:/home/.ssd/ak=rw:/home/.hdd/ak=rw 0 0

The current behavior is to often reverse the order of the last two rows in an unpredictable manner. How can I specify the necessary order?

share|improve this question
Possible workaround (untested): Configure the last one as noauto and mount in rc.local? – j-g-faustus May 5 '11 at 1:18
@j-g-faustus Thank you, the workaround appears to be successful. – ændrük May 6 '11 at 5:19
@j-g-faustus This bounty is ending soon and your workaround is the closest thing to an answer. If you post it below I'll give you the +50. – ændrük Jun 15 '11 at 17:29
up vote 11 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Ubuntu uses mountall at boot time, not mount -a. Mountall waits for the underlying devices to appear and then mounts the fs on them immediately, unless the fs it is being mounted under has not yet been mounted, then it waits for that fs.

You should be able to get the order you want by setting the mount points of the 3 filesystems so they are stacked one under the other. Instead of mounting all three in /home/.something, put the first one in /home/.x, and the second one in /home/.x/.y, and the third in /home/.x/.y/.z.

share|improve this answer

According to man fstab, the showthrough option might be what you're looking for. Try setting it on /home/ak and seeing if it works.

It's possible that mount forks when mounting filesystems during boot; if so, the order in which your partitions are mounted would be undefined.

share|improve this answer
showthrough did not solve the problem. – ændrük Jun 5 '11 at 23:08

Your Answer


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.