Linux – ls returns nothing only in certain directories

fedoralinuxls

I have a raid drive mounted here:

/data/

And certain directories like this one:

/data/somedir/somesubdir/

when I run

ls

w/ or w/o any flags, terminal doesn't return anything. It does not return an empty directory listing. It simply goes to the next line and sits there blank with no prompt coming up. I cannot CTRL-C out of it. I have to close this terminal instance and start over.

At first I thought it was something to do with the ls command, but its pointing to /bin/ls and I can ls other directories just fine.

Also, running this

find /data/somedir/somesubdir

immediately finds all the files just as expected.

UPDATE:

dmesg doesn't appear to be spitting out any errors that I see. My raid is at /dev/sda5 so if I do

dmesg | grep sda

I get

sd 0:0:0:0: [sda] 1953083392 512-byte hardware sectors (999979 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
sd 0:0:0:0: [sda] 1953083392 512-byte hardware sectors (999979 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
 sda: sda1 sda2 sda3 sda4 <<7>libata version 2.21 loaded.
 sda5 >
sd 0:0:0:0: [sda] Attached SCSI disk
EXT3 FS on sda3, internal journal
EXT3 FS on sda5, internal journal
EXT3 FS on sda2, internal journal
EXT3 FS on sda1, internal journal

Nothing out of the ordinary.

Also, my 3ware raid controller shows all disks as OK status and doesn't show any reports of any issues with them.

There doesn't appear to be any server compromise.

Also:

ps auxww | grep somesubdir

returns only the grep process for that directory.

UPDATE #2:

I did try leaving the command for upwards of an hour and no result. I was at a loss for what to do next so I went ahead and restarted the server. The problem no longer persists although it does take 10 sec or so to get a directory listing in that subdirectory. I have no idea what the problem was before.

Best Answer

Apart from the suggestions above, I've also seen this problem when there is a very large number of files in the directory you're listing, which amy be causing the file system to run out of inodes. If this is a possibility, try just leaving the ls command to see if it completes after a while.

Related Topic