Why are the sizes of 2 directories different if the data within the directories is identical? They are identical ext4 partitions and disks

listed in answer

Why are the sizes of 2 directories different if the data within the directories is identical? They are identical ext4 partitions and disks
0 votes, 0.00 avg. rating (0% score)

ANSWER:

The size reported by ls -l for a directory has no relationship with the cumulated size of files stored in it.

It is just, for most common file systems, the size in bytes that has been required to store the directory entries. This size grows by block size (eg: 4096, 8192, …). How many entries can be stored in a block is file system dependent and vary also with entries filenames length.

When directory entries are removed, the directory size is unaffected to reduce fragmentation.

In your example, the external3 directory has 18 * 4096 blocks allocated while the external4 has 17 * 4096 blocks.

That just means the former stored once more files (or files with longer names) even while the directory contents are currently identical. No big deal.

by jlliagre from http://superuser.com/questions/420844