25.1.1. It is Not What You Write, it is How You Write It
Experienced computer users probably got this one on the first try. We need to format the drive. Formatting (usually known as "making a file system") writes information to the drive, creating order out of the empty space in an unformatted drive.
As Figure 25.2, “Disk Drive with a File System”, implies, the order imposed by a file system involves some trade-offs:
A small percentage of the drive's available space is used to store file system-related data and can be considered as overhead.
A file system splits the remaining space into small, consistently-sized segments. For Linux, these segments are known as blocks. [11]
Given that file systems make things like directories and files possible, these trade-offs are usually seen as a small price to pay.
It is also worth noting that there is no single, universal file system. As Figure 25.3, “Disk Drive with a Different File System”, shows, a disk drive may have one of many different file systems written on it. As you might guess, different file systems tend to be incompatible; that is, an operating system that supports one file system (or a handful of related file system types) may not support another. This last statement is not a hard-and-fast rule, however. For example, Red Hat Enterprise Linux supports a wide variety of file systems (including many commonly used by other operating systems), making data interchange between different file systems easy.
Of course, writing a file system to disk is only the beginning. The goal of this process is to actually store and retrieve data. Let us take a look at our drive after some files have been written to it.
As Figure 25.4, “Disk Drive with Data Written to It”, shows, some of the previously-empty blocks are now holding data. However, by just looking at this picture, we cannot determine exactly how many files reside on this drive. There may only be one file or many, as all files use at least one block and some files use multiple blocks. Another important point to note is that the used blocks do not have to form a contiguous region; used and unused blocks may be interspersed. This is known as fragmentation. Fragmentation can play a part when attempting to resize an existing partition.
As with most computer-related technologies, disk drives changed over time after their introduction. In particular, they got bigger. Not larger in physical size, but bigger in their capacity to store information. And, this additional capacity drove a fundamental change in the way disk drives were used.
[11] Blocks really are consistently sized, unlike our illustrations. Keep in mind, also, that an average disk drive contains thousands of blocks. But for the purposes of this discussion, please ignore these minor discrepancies.