Stanford University School of Earth Science
 
Home
News
New Users
Policies
Email
Web Hosting
Get Help
Net Connections
Macintosh
Windows PC
Unix/Linux System
Pangea Server
   Use Policy
   Account Info
   Account Mgt
   Passwords
   Logging In
   Email Services
   Posting Events
   Web Hosting
   File Storage
   File Transfer
   Printing
   FAQ
School Resources
Using Unix

Never run the find command to search the root (/) directory

Last revision July 20, 2004

Here is the explanation of why you should never start a find command to look through the entire file system starting at root (/).

Such a find command will unnecessarily consume large amounts of computer time and generate a lot of network traffic. Pangea and many other computers in the School use network file programs like NFS or AFS to access the disks of other computers as if they were locally attached. The disks of remote computers are "mounted" on local directory names.

So a find command starting at root (/) will look not only at all files on the local disks, but also all files on the remote disks, generating large amounts of network traffic talking to or from those remote computers. On pangea this is especially bad, because the AFS world-wide distributed file system gives us access to files at over 100 other computer sites around the world. This is probably many thousands of gigabytes of data to look through.

When using find, you must specify particular local disk partitions and include the -mount option to restrict find to those specified partitions (excludes anything else mounted on directories within those partitions). For example, if you did

find / -mount -name ...

then it would only look in the actual root disk partition (about 250 Megabytes on pangea), not in anything, whether local or NFS or afs, mounted in root. That is, it would not look in /afs or /usr or /home. To check all the locally-mounted files systems on pangea, excluding NFS and AFS, you could use a command like this, which gets the names of the local partitions from the system configuration file /etc/fstab:

find `awk -F: '$6 == "ufs" { print $2 }' /etc/fstab` -mount -name ...

This is an advanced command. If you are looking for user files on pangea, then this is probably what you want. This command searches only the local disk areas where users can store files.

find /home /play /aufs /scr1 -mount -name ...

You should also look at the glocate command. This program checks a database of all files on local disk that is updated weekly, rather than searching through the file system itself. If the file you are looking for is at least a week old, you will find it much faster with glocate, for example,

glocate xxxx

will find any file listed in the database that has the string xxxx as part of its directory path or file name.

 


Comments?

Stanford University    |