
You know the problem? Something happens, and all your systems go
down—scheduled or otherwise. When you boot them up, one box is
faster than the other; and as a result, some network mounts don't really
work correctly. While this doesn't really happen at work, I've seen it
after a power failure at home.
I
thought this was a feature that Windows had but Linux
doesn't. I
really should've known better...
wouter@country:~$ mount
/dev/hda5 on / type ext3 (rw,errors=remount-ro,commit=0)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
(...)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
automount(pid15173) on /autofs type autofs (rw,fd=5,pgrp=15173,minproto=2,maxproto=4)
wouter@country:~$ ls /mnt/stuff
(lots of private data snipped...)
wouter@country:~$ mount
/dev/hda5 on / type ext3 (rw,errors=remount-ro,commit=0)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
(...)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
automount(pid15173) on /autofs type autofs (rw,fd=5,pgrp=15173,minproto=2,maxproto=4)
goa:/stuff on /autofs/stuff type nfs (rw,addr=192.168.119.23)
And after I wait a minute, that last line is gone. Automounters are
cool. And not too hard to set up, either, if only a bit confusing at
first.
My
/etc/auto.master contains the following (not counting
commented-out examples):
/autofs /etc/auto.autofs --timeout=60
I then need to have a directory
/autofs, on which the
automounter mounts a special filesystem if it's started; this is the
"automount" in the above
mount output. The autofs needs a
second automounter map, which looks like this in my case:
cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
stuff -fstype=nfs goa:/stuff
camerab -fstype=vfat,ro,umask=133,dmask=22 :/dev/disk/by-id/usb-GENERIC_USB_Storage-SDC_200606191719424ND-0:1-part1
floppy -fstype=auto :/dev/disk/by-id/usb-Y-E_DATA_USB_Floppy_Drive
Occasionally, yes, from the above lines it can be inferred that this
indeed also works for my USB floppy drive, my multicardreader, and my
CD-ROM drive.
Finally, I need a symlink into the automount filesystem, like so:
wouter@country:~$ ls -l /mnt/stuff
lrwxrwxrwx 1 root root 13 2007-10-23 19:21 /mnt/stuff -> /autofs/stuff
et voila: if I now try to access anything below
/autofs/stuff, the automounter kicks in, transparently mounts the
filesystem, and without any further delay or ado, I can get at my
files.
Well—unless the server is down, that is.