Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
If you have so many mount points that this is an issue, you're probably looking for an automounter such as autofs. –  Gilles Jan 28 '13 at 22:23
add comment

2 Answers

up vote 8 down vote accepted

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.

share|improve this answer
add comment

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...

share|improve this answer
    
I have a lot of computers that mount the same nfs, I want to centralize the fstab life relating to that nfs (so I don't have to change it on all machines when it changes) –  trideceth12 Jan 28 '13 at 11:01
add comment

Your Answer

 
discard

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.