For a given file, data is stored in blocks. The inode holds (directly and possibly indirectly) a list of every block in the file. When you want to retrieve a byte, the filesystem code determines in which block it is stored, gets the block, and reads the byte from it. For instance, if we assume that the block size is 1KB, a file whose length is 3897 bytes holds 4 blocks, the first three holding 1024 bytes, and the last one holding 199 bytes. The file looks like this:
block# bytes ------ -----  0 to 1023  1024 to 2047  2048 to 3071  3072 to 3896
A file can contain holes, i.e., some missing blocks. In this case the apparent size of the file is much bigger than the product of the number of blocks it really holds and the block size. A file with holes may look like this:
block# ------  data  missing block  data  missing block  missing block  data  data  data
A missing block is considered as a block filled with zeros, but does not waste space on the disk. In the above example, the size of the file is 8096 bytes, while the real space used on the disk is only 5120 bytes.
Go to the first, previous, next, last section, table of contents.