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

Lets say we have a default formatted ext3 filesystem, I run under the assumption that folders take 4K of space on the disk.

But, what does it mean when a folder is bigger than 4K?

Here is a pic of one such folder:
The only file was an .htaccess file that was a couple of bytes. I created a new directory, moved the .htaccess file into the new folder and delete the other weird folder and everything is fine again...but I just find it weird.

Can anyone explain this?

share|improve this question
up vote 6 down vote accepted

A directory starts off at 4K, but grows as it needs to store more file names. I'm pretty sure that it never shrinks again as those files are deleted. Something called "cache" might very well contain a lot of files, either now or at some time in the past.

As Stephen pointed out in the comments, once your cache directory grows large enough to hold, say, 10 000 files, then if those files are deleted it still has room to store 10 000 files, so if a new 10 000 files are created, the directory isn't going to grow again.

share|improve this answer
If this was true then all my folder sizes should increase but they don't. Do you know how to recreate this behavior? – Nathan Adams Jan 4 '10 at 2:37
The storage allocated for a directory is only returned to the filesystem when the directory is deleted, but that allocated storage is re-used by that directory if entries are deleted. To show this, create an empty test directory; it'll show up as 4K in size. Create 10000 files or so; the size of the directory will increase. Delete them all; the size won't decrease. Recreate the files; the size won't increase further. The size of a directory is related to the maximum number of names it has ever contained. – Stephen Veiss Jan 4 '10 at 3:02
Ok I was able to recreate this behavior, and it makes sense now. Does NTFS do the same thing? – Nathan Adams Jan 4 '10 at 3:18

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.