[olug] Network drives on a laptop?

Christopher Cashell topher-olug at zyp.org
Mon Jan 7 18:36:09 UTC 2008


On Jan 7, 2008 8:41 AM, Daniel Pfile <daniel at pfile.net> wrote:
> How do you all handle your network drives on a laptop? With nfs or samba
> if I'm plugged in on ethernet, put the laptop to sleep, and wake it back
> up with wifi, the network mounts (of course) hang. Then I sit there are
> have to locate who has the mount open, get it to close out and convince
> the share to unmount. :( There are a few options, like write some
> scripts to fire off with acpid on network/lid events. Or, I could try
> something like AFS, but I'm not sure how well that would work in
> practice. I have full control of my home server, which is all I'm
> concerned about, so server side changes are an option.
>
> Any suggestions?

AutoFS.  It's the main automount daemon for Linux.  Extremely useful
for this kind of situation.  Here's the package description from Red
Hat: "autofs is a daemon which automatically mounts filesystems when
you use them, and unmounts them later when you are not using them.
This can include network filesystems, CD-ROMs, floppies, and so
forth."

Basically, you setup some mappings of local directories to remote
network drives (or floppies, CD, etc).  Whenever you try to access the
local directory that points to a remote drive, it will automatically
mount the share (assuming it's not already mounted).  After a certain
amount of inactivity, it will automatically unmount the drive until
it's needed again.

We make very heavy use of this at work for network shares (including
/home), mostly for NFS, but we've set it up for Windows shares a few
times, too.  If you're using LDAP, you can even store your automount
maps in LDAP, which makes it even more convenient for large numbers of
hosts.  Oh, and I do use it at home, too, so it's not an
enterprise-only solution.

Just install the autofs package and check autofs(1) and
auto.master(5).  Googling will provide some example maps and more
docs, too.  Let me know if you have any questions, and I'd be happy to
try to help (I'm not an expert, though! ;-).

> -- Daniel


-- 
Christopher



More information about the OLUG mailing list