Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
How can I bind-mount local directories into part of the tree delivered via nfs at boot time? For example, if /var/chroot/etch-ia32 is on another machine and mounted via nfs how can I bind-mount the local /tmp directory at var/chroot/etch-ia32/tmp at boot time?
The problem is that at boot time the second entry for /tmp is mounted before the first entry for /var/chroot/etch-ia32, so that the contents of /var/chroot/etch-ia32/tmp end up being masked. Mounting these manually in the right order works, so how can I force the order in /etc/fstab to be honored at boot time? All comments extremely welcome.
Thank you very much for this suggestion---hugely appreciated. Adding _netdev does indeed prevent /var/chroot/etch-ia32/tmp from mounting. So this is almost a complete solution. The remaining problem is that /var/chroot/etch-ia32/tmp does not get mounted at all during boot. (I can't find any errors or reports in the log files either.) While this is obviously better than having it mounted in the wrong order and thus masked by the nfs mount of /var/chroot/etch-ia32, is there any way to have /var/chroot/etch-ia32/tmp mounted _after_ the nfs mounts during boot? I could, for example, add mount commands to rc.local, but maybe there is a better way?
hmmm, not sure off-hand. rc.local (like you note) could do the trick. just toss a 'mount -a' or call the bind mount from within rc.local. If you wanted to get "fancier" you could write a script around it that would check to see if it is mounted and, if not, mount it for you.
Your suggestion in fact worked perfectly. I'd accidentally included a noauto in the options for /var/chroot/etch-ia32/tmp which messed things up by preventing it from being automatically mounted at boot. But with these entries in /etc/fstab
rc.local (like you note) could do the trick. just toss a 'mount -a' or call the bind mount from within rc.local. If you wanted to get "fancier" you could write a script around it that would check to see if it is mounted and, if not, mount it for you.
Perhaps because my NFS server is an old SunBlade, the _netdev trick + 'mount -a' in rc.local didn't work for me - it seems like there's a delay of about 5-10 seconds before the NFS mount is ready. Here's a "fancier" script that does the job
(( "$#" == 0 )) && exit
declare -i count
for mountpoint in "$@" ; do
while ! mount | grep "$mountpoint" > /dev/null ; do
if mount "$mountpoint" 2>&1 | grep '/etc/fstab' > /dev/null ; then # not in fstab
if mount | grep "$mountpoint" > /dev/null ; then # successful mount
echo "Mounting of $mountpoint SUCCESSFUL after $count tries"
if (( "$count" >= 5 )) ; then # too many retries
echo "Mounting of $mountpoint UNSUCCESSFUL after $count tries"
call this script, followed by a list of mount points, from /etc/rc.local