On Tue, Jun 17, 2003 at 09:36:30AM +0300, Ira Abramov wrote:
> Quoting Oded Arbel, from the post of Mon, 16 Jun:
> > Ira Abramov wrote:
> > 
> > >How can one get a list of mounted filesystems without getting blocked
> > > 
> > >
> > How about reading /etc/mtab ?
> 
> can I trust the state it holds? I think I read somewhere once that it
> can be giving me the wrong info in some odd cases (read-only
> filesystems, RAMfs and other cases I have to deal with.

There are actually two different questions here:
One is to find out what file systems are mounted.
This is traditionally done by running mount without args, which simply
dumps the contents of /etc/mtab. BTW, never hung for me (unlike df).
Under Linux, you can also cat /proc/mounts, which is kernel-maintained
(and is therefore not affected by readonly /etc and such).
Its format is the same as /etc/mtab, and I actually have here /etc/mtab
symlinked to /proc/mounts. It doesn't keep all the information that
/etc/mtab has, though, which might or might not be important to you
(things like who mounted cdrom/floppy, what loop device was used by
-o loop, etc.).

The other is more problematic: How to get a real status of nfs mounts,
in a non-blocking way. I personally don't have a magic answer for that.
I simply run df /mountpoint in the background, and if it does not give
me an answer after few seconds, I kill it -9, and it usually dies after
some time. I think mount -o intr should have caused it to die
immediately, but it doesn't. It does die eventually, though, and then
you can umount (and mount again, of you want) it.

Another thing you can try is to mount the same server:/export on a
different mount point, and see if it succeeds (and then umount it,
of course). Not always a success in this means the original is ok,
but it's non-blocking, and a good approximation, I think better than
things like rpcinfo/rpcping etc.
-- 
Didi


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to