Tracks and Sectors

A track is a single ring of data on one side of a disk. A disk track is too large to manage data effectively as a single storage unit. Many disk tracks can store 100,000 or more bytes of data, which would be very inefficient for storing small files. For that reason, tracks are divided into several numbered divisions known as sectors. These sectors represent arc-shaped pieces of the track.

Various types of disk drives split their disk tracks into different numbers of sectors, depending on the density of the tracks. For example, floppy disk formats use 8–36 sectors per track, although hard disks usually store data at a higher density and today can have 900 or more sectors per track physically.

The sectors created by the standard formatting procedure on a PC system have a capacity of 512 bytes, which has been one constant throughout the history of the PC.

One interesting phenomenon of the PC standard is that to be compatible with most older BIOS and drivers, drives usually perform an internal translation so that they pretend to have 63 sectors per track when addressed in CHS (cylinder, head, sector) mode.

The sectors on a track are numbered starting with 1, unlike the heads or cylinders that are numbered starting with 0. For example, a 1.44MB floppy disk contains 80 cylinders numbered 0–79 and two heads numbered 0 and 1, whereas each track on each cylinder has 18 sectors numbered 1–18.

When a disk is formatted, the formatting program creates ID areas before and after each sector's data that the disk controller uses for sector numbering and identifying the start and end of each sector. These areas precede and follow each sector's data area and consume some of the disk's total storage capacity.

This accounts for the difference between a disk's unformatted and formatted capacities. Note that most modern hard drives are sold preformatted and advertise only the formatted capacity. The unformatted capacity is usually not mentioned anymore.

Another interesting development is that many new drives use what is called No-ID sector formatting, which means the sectors are recorded without ID marks before and after each sector. Therefore, more of the disk can be used for actual data.

Each sector on a disk usually has a prefix portion, or header, that identifies the start of the sector and contains the sector number, as well as a suffix portion, or trailer, that contains a checksum (which helps ensure the integrity of the data contents).

Many newer drives omit this header and have what is called a No-ID recording, allowing more space for actual data. With a No-ID recording, the start and end of each sector are located via predetermined clock timing. Each sector contains 512 bytes of data.

The low-level formatting process typically fills the data bytes with some specific value, such as F6h (hex), or some other repeating test pattern used by the drive manufacturer.

Some patterns are more difficult for the electronics on the drive to encode/decode, so these patterns are used when the manufacturer is testing the drive during initial formatting. A special test pattern might cause errors to surface that a normal data pattern would not show.

This way, the manufacturer can more accurately identify marginal sectors during testing. The sector headers and trailers are independent of the operating system, file system, and files stored on the drive.

In addition to the headers and trailers, gaps exist within the sectors, between the sectors on each track, and between tracks, but none of these gaps contain usable data space.

The gaps are created during the low-level format process when the recording is turned off momentarily. They serve the same function as having gaps of no sound between the songs recorded on a cassette tape. The prefix, suffix, and gaps account for the lost space between the unformatted capacity of a disk and the formatted capacity.

For example, a 4MB (unformatted) floppy disk (3 1/2'') has a capacity of 2.88MB when it is formatted, a 2MB (unformatted) floppy has a formatted capacity of 1.44MB, and an older 38MB unformatted capacity (for instance, Seagate ST-4038) hard disk has a capacity of only 32MB when it is formatted.

Because the ATA/IDE and SCSI hard drives you purchase today are low-level formatted at the factory, the manufacturers now advertise only the formatted capacity. Even so, nearly all drives use some reserved space for managing the data that will be stored on the drive.

Thus, although I stated earlier that each disk sector is 512 bytes in size, this statement is technically untrue. Each sector does allow for the storage of 512 bytes of data, but the data area is only a portion of the sector. Each sector on a disk typically occupies up to 571 bytes of the disk, of which only 512 bytes are available for the storage of user data.

The actual number of additional bytes required for the sector header and trailer can vary from drive to drive. As mentioned earlier, though, many modern drives now use a No-ID recording scheme that virtually eliminates the storage overhead of the sector header information.

You might find it helpful to think of each disk sector as being a page in a book. In a book, each page contains text, but the entire page is not filled with text; rather, each page has top, bottom, left, and right margins. Information such as chapter titles (track and cylinder numbers) and page numbers (sector numbers) is placed in the margins.

The "margin" areas of a sector are created during the low-level formatting process. Formatting also fills the data area of each sector with dummy values.

After you perform a high-level format on the disk, the PC's file system can write to the data area of each sector, but the sector header and trailer information can't be altered during normal write operations unless the disk is low-level formatted again.

The POST INDEX GAP provides a head-switching recovery period, so when switching from one track to another, the heads can read sequential sectors without waiting for an additional revolution of the disk.

Because the disk is continuously spinning and the heads take some small amount of time to move radially from track to track, reading consecutive sectors on two different tracks, one right after the other, is not possible. By the time the head moves to the new track, the beginning of the second sector has already spun past it.

Leaving a gap between sectors provides the heads with time to move to another track. In some drives, this gap does not provide sufficient time for the heads to move. When this is the case, a drive can gain additional time by skewing the sectors on different tracks so the arrival of the first sector is delayed.

In other words, the low-level formatting process offsets the sector numbering, so instead of the same numbered sectors on each track being adjacent to each other, Sector 9 on one track might be next to Sector 8 of the next track, which is next to Sector 7 on the next, and so forth.

The optimum skew value is based on the rotational speed of the disk as compared to the lateral speed of the heads. The Sector ID data consists of the Cylinder, Head, and Sector Number fields, as well as a CRC field used to verify the ID data.

Most controllers use bit 7 of the Head Number field to mark a sector as bad during a low-level format or surface analysis. This convention is not absolute, however. Some controllers use other methods to mark a bad sector, but the mark usually involves one of the ID fields.

The WRITE TURN-ON GAP follows the ID field's CRC bytes and provides a pad to ensure a proper recording of the user data area that follows, as well as to enable full recovery of the ID CRC. The user DATA field consists of all 512 bytes of data stored in the sector. This field is followed by a CRC field to verify the data.

Although many controllers use two bytes of CRC here, the controller might implement a longer error correction code (ECC) that requires more than two CRC bytes to store. The ECC data stored here provides the possibility of correcting errors in the DATA field as well as detecting them.

The correction/detection capabilities depend on the ECC code the drive uses and its implementation by the controller. The WRITE TURN-OFF GAP is a pad that enables the ECC (CRC) bytes to be fully recovered. The INTER-RECORD GAP provides a means to accommodate variances in drive spindle speeds.

A track might have been formatted while the disk was running slightly more slowly than normal and then written to while the disk was running slightly more quickly than normal. In such cases, this gap prevents the accidental overwriting of any information in the next sector.

The actual size of this padding varies, depending on the speed of the DATA disk's rotation when the track was formatted and each time the DATA field is updated. The PRE-INDEX GAP enables speed tolerance over the entire track.

This gap varies in size, depending on the variances in disk rotation speed and write-frequency tolerance at the time of formatting. This sector prefix information is extremely important because it contains the numbering information that defines the cylinder, head, and sector. So this information, except the DATA field, DATA CRC bytes, and WRITE TURN-OFF GAP, is written only during a low-level format.