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

IIRC my Operating Systems classes, the size of a directory in Linux is given by the number of files it contains([wikipedia link])1

So, why a directory with only 2 files occupies 32000 blocks?

# stat .
  File: «.»
  Size: 16855040        Blocks: 32968      IO Block: 4096   directorio
Device: 6805h/26629d    Inode: 3047425     Links: 2
Access: (0775/drwxrwxr-x)  Uid: (  501/   jboss)   Gid: (  501/   jboss)
Access: 2011-08-26 12:00:20.000000000 +0200
Modify: 2011-08-26 10:58:07.000000000 +0200
Change: 2011-08-26 10:58:07.000000000 +0200

The directory may have had lots of files(thousands) at some point of the past, but not now. What's happening here?

share|improve this question
up vote 2 down vote accepted

Your directory has probably seen lots of action and the OS hasn't reclaimed the space that has been used. You can fix this by shuffling things around, if your directory that is using up all the space was called bigdir then you could

mkdir newdir
mv bigdir/* newdir
rmdir bigdir
mv newdir bigdir

Make sure that whatever accesses bigdir isn't going to while you do the shuffle.

share|improve this answer

The filesystem doesn't necessarily reclaim blocks from directories once they're no longer in use.

share|improve this answer

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.