Operating System - HP-UX
1834747 Members
2586 Online
110070 Solutions
New Discussion

Mount sequence from /etc/fstab

 
Jakes Louw
Trusted Contributor

Mount sequence from /etc/fstab

We're having an argument here at work: does the /etc/fstab file get read from top to bottom, or bottom to top, when running "mount -a"? From what we can see, it's bottom to top, but where's the logic in that?
Trying is the first step to failure - Homer Simpson
4 REPLIES 4
Darren Prior
Honored Contributor

Re: Mount sequence from /etc/fstab

Hi,

As far as I'm aware there isn't a special order that it's read. The man page for mount(1m) states that "file systems are not necessarily mounted in the order listed in /etc/fstab." Also the fstab(4) man page states that entries without a pass number are sequentially checked by fsck.

Sorry that doesn't really resolve your argument!

regards,

Darren.
Calm down. It's only ones and zeros...
Pete Randall
Outstanding Contributor

Re: Mount sequence from /etc/fstab

Jakes,

All I can say is that the man page for fstab claims

"The order of entries in /etc/fstab is important only for entries
without a pass number field. Entries without a pass number are
sequentially checked by fsck (see fsck(1M)) after the entries with a
pass number have been checked."

Thus, we see in a typical fstab that / and /stand have pass number 1 and are checked first:

/dev/vg00/lvol4 / vxfs delaylog 0 1
/dev/vg00/lvol1 /stand hfs defaults 0 1
/dev/vg00/lvol3 ... swap defaults 0 0
/dev/vg00/lvol5 /home vxfs delaylog 0 2
/dev/vg00/lvol6 /opt vxfs delaylog 0 2
/dev/vg00/lvol7 /tmp vxfs delaylog 0 2
/dev/vg00/lvol8 /usr vxfs delaylog 0 2
/dev/vg00/lvol9 /var vxfs delaylog 0 2

I would assume that the remaining file systems would be processed sequentially but the man page doesn't really say what the order is unless there is no pass number. *AND*, the man page only talks about what order they will be fsck'd, not the order in which they're mounted.

If you look at /etc/mnttab, you will see the time each file system was actually mounted and, on my system, it appears to be sequential.

/dev/vg00/lvol4 / vxfs log 0 1 1075397862
/dev/vg00/lvol1 /stand hfs defaults 0 0 1075397864
/dev/vg00/lvol9 /var vxfs delaylog,nodatainlog 0 0 1075397871
/dev/vg00/lvol8 /usr vxfs delaylog,nodatainlog 0 0 1075397871
/dev/vg00/lvol7 /tmp vxfs delaylog,nodatainlog 0 0 1075397872
/dev/vg00/lvol6 /opt vxfs delaylog,nodatainlog 0 0 1075397872
/dev/vg00/lvol5 /home vxfs delaylog,nodatainlog 0 0 1075397872


Pete


Pete

Pete
Pete Randall
Outstanding Contributor

Re: Mount sequence from /etc/fstab

On closer inspection, that looks more like inversely sequential!!

Pete
Jakes Louw
Trusted Contributor

Re: Mount sequence from /etc/fstab

The manpage entry is noted. I assume that is why the rule has always been not to mount something on a mount-point that is below an existing mount-point? That is:

/dev/vg01/fs1 /fs1
/dev/vg01/fs2 /fs1/fs2
Trying is the first step to failure - Homer Simpson