by wintpe » Aug 1st, '12, 14:57
ok so heres example (working from my system).
install the autofs package
so exports on a file server
/local/0 *(rw,insecure,all_squash)
/local/1 *(rw,insecure,all_squash)
/local/2 *(rw,insecure,all_squash)
now on the client
cd /etc/autofs
im going to make the above mounts appear under /local
so first edit edit auto.master and add a line
/local /etc/autofs/auto.local
now edit auto.local (which is a new file to contain all the mounts appearing under /local.
0 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/0
1 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/1
2 -rw,soft,bg,tcp,vers=3,rsize=262144,wsize=262144 fileserver:/local/2
you only need to start the line with the mount point under /local
when you run service autofs restart a virtual mount point will be created called /local
(this is not a directory, but looks like one) you cant create any files in it, its read only.
now if you cd /local/0 you will see the mount appears almost magically
and you dont need to be root, as the autofs daemon intercepts your change directory request and starts a mount command with the options in the auto.local file for that matching entry.
if you have not used it for a while or dont have any open files holding it open, it will quietly dismount until its needed again
similarly as per this thread an ISO or cdrom could be mounted using the same system as long as the mount options are in the autofs file associated with the mount path.
those mount options ive put in my autofs file also greatly improve NFS performance on standard mageia/mandriva which I found to be absolutely appalling using the mageia/mandriva default options (ie the vers=3,rsize=262144,wsize=262144 ).
regards peter
Redhat 6 Certified Engineer (RHCE)
Sometimes my posts will sound short, or snappy, however its realy not my intention to offend, so accept my apologies in advance.