Can I include another file in my fstab
file?
I.e. can I have fstab
execute lines from another file at an arbitrary point, and then return to the main file when completed?
Can I include another file in my fstab
file?
I.e. can I have fstab
execute lines from another file at an arbitrary point, and then return to the main file when completed?
Generally not, but with newer versions of mount
/swapon
/fsck
... on Linux (from util-linux 2.19) at least, you can have more files (with .fstab
extension) in /etc/fstab.d
. So you can have a /etc/fstab.d/00_header.fstab
, /etc/fstab.d/50_middle.fstab
, /etc/fstab.d/99_end.fstab
.
Another approach if all you want is mount -a
to run some command is have an entry with your own filesystem type and create a /sbin/mount.own
that does the work for you.
Note that recent versions of Ubuntu
have that mountall
that might get in the way.
Also note that some distributions process mounts in several stages using -t fstypes
, which you may need to take into account as well.
I have never seen a Unixy system with such an fstab(5)
-setup. Look at mount(8)
for the gory details of what can be done at mount time.
What do yu want this for? If really useful in more than a narrow range of usecases it just might get implemented...
In the case of svn, you can have a script that checks out from svn, and then builds/appends to /etc/fstab
, monitor it periodically, compare from svn.
If you have a config management, you can build your fstab from a template. For example, in salt, you can use jinja2 template to build the mounts portion of your /etc/fstab
, and that would also prevent accidental typing errors.