Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
root@phoenix:~# ls -ld /backups/external?/var/subsonic/thumbs/110
drwxr-xr-x 2 root root 73728 Mar  4 15:35 /backups/external3/var/subsonic/thumbs/110
drwxr-xr-x 2 root root 69632 Mar  4 15:35 /backups/external4/var/subsonic/thumbs/110

The contents of the above directories is identical. The disks and filesystem configurations are identical. Yet the sizes of the directories themselves are different.

Yes the contents of the directory in question are identical, i've checked with diff -r, rsync -avx as well as beyond compare. Here's diff -r output:

root@phoenix:~# diff -r /backups/external{3,4}/var/subsonic/thumbs/110

du -bs output:

root@phoenix:~# du -bs /backups/external?/var/subsonic/thumbs/110
4116125 /backups/external3/var/subsonic/thumbs/110
4112029 /backups/external4/var/subsonic/thumbs/110

du -b --total output counting just the files within each directory:

root@phoenix:~# du -b --total /backups/external3/var/subsonic/thumbs/110/* | tail -1 
4042397 total
root@phoenix:~# du -b --total /backups/external4/var/subsonic/thumbs/110/* | tail -1 
4042397 total

So, for the external3:

4042397 + 73728 = 4116125

and for external4:

4042397 + 69632 = 4112029

The size of the files added to the size of the directory itself matches the output from du -bs.

share|improve this question
This is where we ask how certain you are that the contents are the same. –  Ignacio Vazquez-Abrams May 5 '12 at 5:21
Please see the edited question, yes, triple checked with various methods that the contents are the same. –  cb303 May 5 '12 at 5:28
Did you try du -s? –  Ignacio Vazquez-Abrams May 5 '12 at 5:29
yes, see above. thanks –  cb303 May 5 '12 at 5:57
-b implies --apparent-size, which changes things. –  Ignacio Vazquez-Abrams May 5 '12 at 6:02

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
Thanks, this is exactly what i suspected and hoped to be confirmed. –  cb303 May 5 '12 at 6:13

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.