nfs and bind-mount order in /etc/fstab
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?
/etc/fstab: 137.xxx.xxx.xxx:/var/chroot/etch-ia32 /var/chroot/etch-ia32 nfs defaults,ro 0 0 /tmp /var/chroot/etch-ia32/tmp none bind 0 0 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. |
add _netdev to your bind mount to postpone it being mounted.
Code:
/tmp/ /var/chroot/etc-ia32/tmp none _netdev,bind 0 0 Hope this helps. |
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
/etc/fstab: 137.xxx.xxx.xxx:/var/chroot/etch-ia32 /var/chroot/etch-ia32 nfs defaults,ro 0 0 /tmp /var/chroot/etch-ia32/tmp none _netdev,bind 0 0 everything gets mounted at boot, with the nfs partition mounted first and then the bind-mount of /tmp. Thanks again for your help. |
Thanks for the followup response. I thought it odd to not have worked but I didnt have access to the system where I'd configured something similar to check my exact configuration(s) for comparison.
Good to hear it is working for you. :) |
Quote:
Code:
#!/bin/bash |
All times are GMT -5. The time now is 08:44 PM. |