Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Both machines are running Ubuntu 12.04

Remote NFSv4 Client

$ ls /mnt/storage/aaaaaaa_aaa/bbbb/cccc_ccccc gives this error:
ls: reading directory .: Too many levels of symbolic links

How can I fix this?

When error occurs ls start listing the files, however PHP brakes.

On the NFSv4 Server

In /etc/fstab:

/mnt/storage    /srv/storage    none    bind    0 0

In /etc/exports



root@ds:root@ds:/mnt/storage/foreign_dbs/imdb/imdb_htmls# ls -l | head
ls: reading directory .: Too many levels of symbolic links
total 10302840
-rw-r--r-- 1 root root  10484 Jul  5 13:56 0019038.gz
-rw-r--r-- 1 root root  16264 Mar 30 00:31 0259701.gz
-rw-r--r-- 1 root root  13784 Mar 30 14:20 1000000.gz
-rw-r--r-- 1 root root  12741 Mar 30 13:04 1000003.gz
-rw-r--r-- 1 root root  12794 Mar 30 12:40 1000004.gz
-rw-r--r-- 1 root root  13123 Mar 30 12:07 1000005.gz
-rw-r--r-- 1 root root  13183 Mar 30 12:04 1000006.gz
-rw-r--r-- 1 root root  13443 Jul  4 01:16 1000007.gz
-rw-r--r-- 1 root root  12968 Mar 30 11:05 1000008.gz

I came across it in PHP. scandir would return 1612577.gz & 1612579.gz, but skips 1612578.gz and yet the file types and properties are identical on them

and this only happens on the nfs client, works 100% on the server

share|improve this question
What's ls -l /mnt/storage/aaaaaaa_aaa/bbbb/? –  Jay Jul 6 '12 at 22:51
Works fine. There are few folders there. cccc_ccccc has many files under it. Also same command works on the NFS server itself fine. –  user1434058 Jul 6 '12 at 22:57
What's the output? cccc_ccccc is probably a relative symlink that is causing a loop. –  Jay Jul 6 '12 at 23:16
800k sequentially numbered files, example: -rw-r--r-- 1 root root 13459 Mar 30 06:26 9061.gz –  user1434058 Jul 6 '12 at 23:29
Ah, then how about file /mnt/storage/aaaaaaa_aaa/cccc_ccccc? –  Jay Jul 6 '12 at 23:38

1 Answer 1

Somewhere you have a symbolic link that points back to its parent. Use this to find it:

find /mnt/storage -type l -exec ls -l {} \;

Once you do, then perhaps you can figure out how to correct it.

share|improve this answer
No links found. –  user1434058 Jul 6 '12 at 23:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.