Data is organized on the disk by dividing the tracks into segments called sectors. When the disk is prepared to receive data (a process called formatting), each sector is tested by writing and reading sample data. If an error occurs, the operating system marks the sector as unusable (virtually any hard disk will have at least a few such bad sectors). The set of vertical corresponding tracks on the stack of platters that make up the drive is called a cylinder. Since the drive heads are connected vertically, if a head is currently reading or writing for example sector 89 on one platter, it is positioned over that same sector on all the others. Therefore, the operating system normally stores files by filling the full cylinder before going to a new sector number.
Another way to improve data flow is to use sector interleaving. Because many disk drives can read data faster than the operating system can read it from the disk’s memory buffer, data is often stored by skipping over adjacent sectors. Thus, instead of storing a file on sectors 1, 2, and 3, it might be stored on sectors 1, 3, and 5 (this is called a 2:1 interleave). Moving the head from sector 1 to sector 3 gives the system enough time to process the data. (Otherwise, by the time the system was ready to read sector 2, the disk would have rotated past it and the system would have to wait through a complete rotation of the disk.) Newer CPUs are often fast enough to keep up with contiguous sectors, avoiding the need for interleaving. Data throughput tends to decrease as a hard drive is used. This is due to fragmentation. The operating system runs out of sufficient contiguous space to store new files and has to write new files to many sectors widely scattered on the disk. This means the head has to be moved more often, slowing data access. Using an operating system (or Parts of a typical hard disk drive. Many hard drives have multiple heads and platters to allow for storage of larger amounts of data. Users can periodically reorganize their hard drive so that files are again stored in contiguous sectors. Files can also be reorganized to optimize space rather than access time. If an operating system has a minimum cluster size c4K, a single file with only 32 bytes of data will still consume 4,096 bytes. However, if all the files are written together as one huge file (with an index that specifies where each file begins) that waste of space would be avoided. This is the principle of disk compression. Disk compression does slow access somewhat (due to the need to look up and position to the actual data location for a file) and the system becomes more fragile (since garbling the giant file would prevent access to the data in perhaps thousands of originally separate files). The low cost of high capacity drives today has made compression less necessary.