References:
Harley hahns: Guide to Unix and Linux, chap 24
-- The first key concept: the amount of "disk space" used by a file is not the same as the amount of data in the file.
-- "Second, understand that there are two smallest space units in file system and disk (or other storage medium):" Block "in file system and" Allocation unit "in disk ";
The minimum space unit relationship: the size of "Allocation unit" depends on the filesystem and the storage device. For example, in the reference author's computer, the smallest block occupied by filesystem is 1 K bytes, and disk allocation units is 8 K bytes. Therefore, if a file contains data of 1 B, 1 block (1 K) is occupied in the filesystem, and 8 K disk space is occupied in the disk.
**************************************** **************************************
So the following question: how to detemine size of block? How to determine size of allocation unit?
-- Size of allocation units:
* Create a small file first
* Use the LS-l file to check the actual data contained in the file (in bytes), which is displayed before the time.
* Use Du-H file to view how much "disk space" the file takes up
The disk space found here is the minimum unit occupied by your disk. on my computer, it is 4 kb.
-- Size of block in filesystem:
The idea is to use the dumpe2fs command under the Administrator permission to view the nature of a block in filesystem: superblock and check its block size to determine the size of a block in filesystem.
* Use the DF command to find out the name of the special file that represents the filesystem, such as/dev/hda1.
* Use Su to obtain superuser Permissions
* When Using dumpe2fs for superuser permissions, use the grep command to collect "block size" information: dumpe2fs/dev/hda1 | grep "block size"
The block size is the minimum space occupied by a block in your file system. On my computer, it is 1024.