Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am copying 25,000 folders containing hundreds of files each from one hard drive to another on the same Linux server. The destination folder already contains 25,000 different folders full of their own files. I am using the following command:

cp -v -r /folder_to_copy_from/* /folder_to_copy_to/

The process completed about 20%, then all of a sudden, every time it tried to copy a folder it gave the message "too many links" and skipped all the files in that folder, moving on to the next folder. That folder was never created. CP printed this message for all the remaining folders.

I estimate there were ~30,000 folders in the folder_to_copy_to when it stopped working. I am using a EXT3 formatted drive with plenty of space to hold the files on Linux CentOS.

If there is a max number of subdirectories allowed in a directory, is there a way to increase it? Should I investigate different formatting standards? Any other thoughts on what is going on?

share|improve this question
up vote 5 down vote accepted

There's a limit of about 32,000 links per inode. (smells like an unsigned short) Each folder makes a link to its parent folder, so you were going to try to make some 50k links to a single inode, which wasn't going to fly.

Perhaps you should reconsider your directory structure.

share|improve this answer
Yup ... looks like EXT3 is limited to 32,000 subdirectories and EXT4 to 64,000. – T. Brian Jones Feb 16 '12 at 20:09

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.