ls -l coomand output - question
Hello!
Can you explain me please column 5 (1024) drwxr-sr-x 2 root root 1024 Apr 30 11:05 test -rw-r--r-- 1 root root 100697 Feb 03 13:55 test.log Why the directory "size" is always 512 or 1024 or 2048? What does it mean? Thank you! |
it's the size of an inode on the filesystem the directory exists. A directory still needs to exist on the drive in some form, and entry on the filesystem - files, links, directories etc. use up at least one inode to exist. That's my understanding and i think i do recall seeing different "sizes" of directory within the same filesystem, which I'm not too sure of the reasons for.
|
Hmm. My listing doesn't show regular block sizes. I get much more precise numbers.
Here's a selection from my home directory: Code:
drwxrwx--- 2 david david 520 2009-02-06 20:24 Desktop |
Hi,
The size of a directory starts as the blocksize, on modern systems with larger disk this will, most often, be 2048/4096. This directory file contains all info about itself and all the files/dirs inside it. So far I'm just repeating acid_kewpie...... The size of this directory file can grow over time (lots of files/dirs added inside that dir). The funny part is that this info is not released/removed after you delete a file/dir in that dir! Here's a real life example. My /data/Pan/Pictures directory, used to place files before I sort them out and move/delete them. There can be hundreds of files or none at all (which is true for this example): Code:
$ ls -ld Pictures* I don't know why it is implemented this way, there must be a reason for not removing the information form the directoryfile. Maybe this is done to be able to restore deleted files, but that is just a guess! |
All times are GMT -5. The time now is 07:44 AM. |