drwxr-xr-x 3 root root 73728 Dec 26 08:39 /usr/bin/ <=== This directory file on an ext4 filesystem is listed in long format (ls -ld). The value of the fifth field, 73728, reports the size of what?
- The exact size of the directory file, in bytes.
- The disk usage, in blocks, of the directory and all of its subdirectories.
- The size in bytes of the total blocks in use by the directory file. [ (bytes/block) * blocks ]
- The disk usage, in blocks, of the top level of the directory.
EXPLANATION
A directory file contains a list of names and corresponding inodes.A newly created directory file on an ext4 filesystem will have only 2 entries, dot "." and dot dot ".."
The size of the new directory file will be 4096 bytes. As additional entries are made to the directory, the reported size will remain at 4096 until additional bytes are required for the next directory entry. At that point, additional blocks will be allocated to the directory and the reported directory file size will increase.
As directory entries are removed, the blocks already allocated to the directory file do not decrease, but allocated blocks are freed for future use by new entries in the directory.
https://unix.stackexchange.com/questions/234065/why-size-reporting-for-directories-is-different-than-other-files#
https://superuser.com/questions/142893/why-is-the-size-of-a-directory-always-4096-bytes-in-unix/1428...
http://www.linfo.org/directory.html
Note that when the same "ls" command is used on a regular file, the size field will report the actual file size in bytes, which is stored in the inode. The " -s " option to "ls" will report allocated blocks, in addition to actual file size.
0 comments:
Post a Comment