detecting NFS mount

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

how can I verify if a certain directory is an NFS mount?

Background: I have a directory, which should be an NFS mount so I can
perform some backup operations on a remote server by simply putting
files in it. But the netfs-initscript might fail during startup so I
would make backups to the local harddisk if there is no NFS mount.


Re: detecting NFS mount

Marten Lehmann wrote:

Quoted text here. Click to load it

So this is on topic for the Perl news group, can you offer up a portion
of the relevant code in question?  It shouldn't be too difficult to
ensure the NFS partition is mounted somewhere in the script before it
begins its backup routine.  Also, what is the platform?  This could be
relevant to the different methods you can use to ensure it's mounted.
Tim Greer, CEO/Founder/CTO,, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!

Re: detecting NFS mount

Quoted text here. Click to load it

There may be other ways, but I would do it exactly the same way as in
any other programming language by checking the mount table.


Re: detecting NFS mount

Marten Lehmann wrote:
Quoted text here. Click to load it

Back in the days of SunOS-4.1.1 and Solaris-2.5.1, it was quite easy.

   my @stat = stat $file;
   if ($stat[0] && 0x8000) {
     print "NFS mount detected for $file\n";

You can test if your particular system returns something similar, but
beware that such a solution is not portable.


Site Timeline