Very slow "ls" on some directories

General support questions including new installations

Very slow "ls" on some directories

Postby mjames_joules » 2012/01/20 12:34:22

Hi,

I've noticed this on a few directories now, ls taking ages to complete but the files seem to be fine, just installed joomla which is working fine but a ls on the root joomla directory takes minutes?! (CentOS 5.5, Kernel 2.6, ext3 filesystem)

time ls
...
real 4m8.028s
user 0m0.001s
sys 0m0.007s

I've been digging into this for a while but can't find the cause, any suggestions would be much appreciated (before the hard drive fails!)

Thanks in advance,

Regards,

Mark
mjames_joules
 
Posts: 5
Joined: 2012/01/20 11:14:44

Re: Very slow "ls" on some directories

Postby TrevorH » 2012/01/20 12:47:40

How many files in the directory?
User avatar
TrevorH
Forum Moderator
 
Posts: 9144
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Very slow "ls" on some directories

Postby pschaff » 2012/01/20 21:19:24

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

Anything in the directory, such as symbolic links, that might trigger an attempt to automount something that is not available, causing ls to wait until the mount request times out?

OT: Don't use obsolete/unsupported releases - 5.7 is the current release. See the CentOS 5.7 Release Notes for details. By not updating you are implicitly accepting that you will live with numerous bugs and security issues (and associated known exploits) that have subsequently been fixed.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: Very slow "ls" on some directories

Postby mjames_joules » 2012/01/21 09:14:16

Hi,

Thanks for the replys. There are <100 files and no symlinks. One point I forgot in OP - the drive is all one partition (I didn't install it!) and it's a remote pc, have to manage it via ssh.

Cheers,

Mark

PS. it's only a few directories, always the same ones and sub-dirs of joomla are fine (as are it's files) it's a weird one.
mjames_joules
 
Posts: 5
Joined: 2012/01/20 11:14:44

Re: Very slow "ls" on some directories

Postby TrevorH » 2012/01/21 11:38:13

Is the system set up to use some form of remote authentication? Perhaps the user/groups that own the files in the directory are defined in some remote directory that's inaccessible - e.g. ldap?
User avatar
TrevorH
Forum Moderator
 
Posts: 9144
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Very slow "ls" on some directories

Postby mjames_joules » 2012/01/23 08:51:48

Hi,

No remote auth, or anything unusual about that directory. I'd like to run fsck but can't on a mounted filesystem, and as there's only one partition... If anyone could suggest an alternative that'd be much appreciated.

Cheers,

Mark
mjames_joules
 
Posts: 5
Joined: 2012/01/20 11:14:44

Re: Very slow "ls" on some directories

Postby TrevorH » 2012/01/23 09:38:52

There are no nastygrams in /var/log/messages about I/O errors on the drive that correspond to attempts to list the directories in question? You can get fsck to run on reboot by running, as root

Code: Select all
touch /.autofsck
shutdown -r now
User avatar
TrevorH
Forum Moderator
 
Posts: 9144
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Very slow "ls" on some directories

Postby mjames_joules » 2012/01/25 08:38:51

Hi,

The fsck on reboot didn't report anything but I seem to have sorted the issue - turned off selinux. Not sure why it would be causing such behaviour but i can live without it.

Cheers,

Mark
mjames_joules
 
Posts: 5
Joined: 2012/01/20 11:14:44

Re: Very slow "ls" on some directories

Postby pschaff » 2012/01/25 14:35:54

That is not a solution. Disabling a major security feature may give a cracker access to your system. The right way to approach it is to temporarily put SELinux in permissive mode, determine a correction, and fix the underlying issue. If you have any problems doing that please provided details of your issue.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America


Return to CentOS 5 - General Support

Who is online

Users browsing this forum: No registered users and 2 guests