menges@menges.cs.unc.edu (John Menges) (06/22/91)
Has anyone written a program that given a server name will query the server and return the names of the file systems my host is allowed to mount from that server? There must be a way to do this since automounter does something similar, but I'd like to avoid figuring out how to make the necessary RPC call(s). Or perhaps there's another way to solve my problem. I maintain a few hosts loosely associated with a big administrative domain with lots of nfs servers each of which exports lots of file systems. I'm allowed to import most but not all of these file systems. The root file systems of the servers are not exported, so I can't look at the /etc/exports files. I want to mount (or automount) all the file systems I'm allowed to mount. I don't want to maintain a table of all the file sytems I'm allowed to mount, as that changes too frequently. I don't mind keeping alist of servers, though it would be nice to avoid that too. Automounter doesn't work well for two reasons. One is that, in the big administrative domain, nfs file systems are mounted in /<servername> directories rather than /net/<servername> directories (or something similar), I'm importing the NIS passwd database, and the home directories in the passwd database start with /<servername>. So if I use "/net -host ..." with automounter, I have to maintain /<servername> soft links into /net, and I have some indication that if files are referenced through a symbolic link (e.g., /<servername>/<fs>/myfile) automounter won't be asked to mount the file system. The second reason automounter doesn't work well is that it apparently tries to mount all the file systems from <servername> even if I'm referencing /<servername>/<fs>/foo and /<servername>/<fs> is already mounted. Since each server exports lots of file systems this means long delays, and often timeouts and failed file accesses. So my fallback position is to query all the servers at boot time (and maybe periodically) and build an automounter map from the information I get, in such a way that each file system is automounted separately. I'm not an nfs expert, so please let me know if I'm missing something obvious. In case it matters, the servers are SunOS and Ultrix (mostly) and my hosts are AIX RS_6000s and RTs running mach (the latter without automounter... sigh).
barmar@think.com (Barry Margolin) (06/22/91)
In article <4528@borg.cs.unc.edu> menges@menges.cs.unc.edu (John Menges) writes: >Has anyone written a program that given a server name will query the >server and return the names of the file systems my host is allowed to >mount from that server? There must be a way to do this since >automounter does something similar, but I'd like to avoid figuring out >how to make the necessary RPC call(s). On SunOS and Ultrix, "/usr/etc/showmount -e <server>" will display the export list of <server>. It includes file systems you don't have access to, so you'd have to use awk, perl, or something like that to restrict it to the accessible file systems. >In case it matters, the servers are SunOS and Ultrix (mostly) and my >hosts are AIX RS_6000s and RTs running mach (the latter without >automounter... sigh). I don't know whether AIX or Mach have showmount. But I think it's available in the public BSD sources. You should be able to modify it to discard inaccessible file systems pretty easily. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar