[Chapter 17] 17.25 Keeping find From Searching Networked Filesystems
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:38:46Z

#

| Chapter 17 Finding Files with find |

## 17.25 Keeping find From Searching Networked Filesystems

The most painful aspect of a large NFS (1.33) environment is avoiding the access of files on NFS servers that are down. find is particularly sensitive to this, because it is very easy to access dozens of machines with a single command. If find tries to explore a file server that happens to be down, it will time out. It is important to understand how to prevent find from going too far.

To do this, use -prune with -fstype or -xdev. [Unfortunately, not all finds have all of these. -JP ] fstype tests for filesystem types, and expects an argument like nfs or 4.2. The latter refers to the "fast filesystem" introduced in the 4.2 release of the Berkeley Software Distribution. To limit find to files only on a local disk or disks, use the clause -fstype 4.2 -prune or -o -fstype nfs -prune.

To limit the search to one particular disk partition, use -xdev. For example, if you need to clear out a congested disk partition, you could look for all files greater than 40 blocks on the current disk partition with this command:

>     % find . -size +40 -xdev -print

- BB

17.24 Skipping Some Parts of a Tree in find (A More Selective -prune) |  | 18. Linking, Renaming, and Copying Files