1831323 Members
2960 Online
110023 Solutions
New Discussion

Re: Find command hangs.

 
Scott Sprague_1
New Member

Find command hangs.

I have a weird problem on an HP9000/989 server. Whenever anyone runs a find command in the /opt directory, it hangs, and can't be killed without a reboot. Here's the syntax of the latest one I've tried:

find / -name .netrc print

It doesn't seem to matter what name you search for. Also, any finds done outside the /opt directory work just fine. Any suggestions?
8 REPLIES 8
Rita C Workman
Honored Contributor

Re: Find command hangs.

Well your syntax is slightly off here...dropping - before print:

To do find from root

find / -name .netrc -print

To do find from a different directory

find /opt -name .netrc -print

/rcw
Alan Riggs
Honored Contributor

Re: Find command hangs.

Do you perhaps have any nfs mountpoints underneath /opt ?

Rita already pointed out your syntax error, but assuming that was just a typo you may have something else going on. NFS mounts can cause find to work *very* slowly, which may be perceived as a hang.

On the same note, find is incredibly resource intensive, especially when run from /. While the functionality of find is sometimes required, you can often use alternative, less impactive, commands to yield the same information. For simple name searches, for instance, du -a | grep works far more quickly and with less system load. When you do need to use find, try to restrict the search as much as possible either with the -xdev flag or by starting your search in as small a subdirectory as will suffice for your purpose.
Scott Sprague_1
New Member

Re: Find command hangs.


Sorry, I left out the - in front of print in my original post. It was in the command when I issued it, though, and it's hanging. The only sub-directory this hangs on is /opt. All other directories are fine.
James R. Ferguson
Acclaimed Contributor

Re: Find command hangs.

Hi Scott:

The syntax you show would start at the root (/) directory and search. If there are any CDROMs or NFS mountpoints then this could take quite a while.

...JRF...
Scott Sprague_1
New Member

Re: Find command hangs.

And no, there are no NFS mountpoints on this system.
Scott Sprague_1
New Member

Re: Find command hangs.

And no CD-ROMS. :)

Didn't think I'd get this many replies this quick.
Steffi Jones_1
Esteemed Contributor

Re: Find command hangs.

Hi Scott,
another problem could be a hw issue on the disk which "hosts" the /opt directory.
Check if you see some errors in syslog.log and/or dmesg output at the time you run the find command.
You can too run a dd command on the lvol of /opt and see if it gives you any grief.

Steffi Jones
Rita C Workman
Honored Contributor

Re: Find command hangs.

Did a SEARCH for and I came up with a couple interesting threads. You didn't mention o/s version or other info so I'm including a couple of what I found...maybe one of them will help:
Find hangs w/mult lan cards..
http://us-support2.external.hp.com/cki/bin/doc.pl/sid=cea5bab10d5195075e/screen=ckiDisplayDocument?docId=200000009942125
System hangs on Find (obvious answer here..):
http://us-support2.external.hp.com/cki/bin/doc.pl/sid=b1bab77e0e1be84ebb/screen=ckiDisplayDocument?docId=200000024599068

You may want to do the SEARCH and check out some more.

regards
/rcw