• No results found

Bad Sector Mapping and Defect Lists

The need for bad sector mapping and the sector flag arises because of micro-defects that are found to exist on the magnetic surface of the disk at the time of manufacture. Seagate (1995a) states that there should be less than one defect per formatted megabyte and that the disk should be defect-free for the first two cylinders. The defects are of two types: hard, which usually relate to a surface problem, and soft, which is normally some kind of magnetic anomaly. Although hard defects can be discovered relatively easily with low-level formatting software, soft defects can only be found after much testing with very sophisticated test equipment. The manufac- turer used to perform such tests over a period of several hours and from these tests would determine amanufacturer’s defect listof all the bad sectors. Such lists were often marked on the casing of the drive as adefect labelin a form similar to that shown in Table 5.5.

With modern Zoned Bit Recording disks (see later section), defect labels are no longer used and bad sector mapping strategies, as described in this section, are completely hidden by the internal controller. The issues, however, are still relevant and are described here for two reasons: firstly, because it is important to understand that although hidden, bad sector mapping strategies continue to be required, with

bad sector

bad track – no alternative assigned bad track – ID points to alternative alternative track

reserved 7 6 5 4 3 2 1 0

Fig. 5.7 Sector flag details.

Cyl Hd BFI

72 0 5314

73 0 5315

74 0 5316

161 2 1816

more comprehensive ones now being used to give the appearance of a fault-free disk; and, secondly, because it is possible for forensic computing analysts to come across older disks which still visibly exhibit these characteristics.

In the old style of defect list, each bad sector is specified by its cylinder and head number, which defines the track, and the bytes from index (BFI)18 value. This specifies the number of bytes from the start of track index mark to where the bad area exists. This index mark, which is usually generated by a Hall sensor embedded in the spindle motor or encoded onto the servo tracks, is considered the absolute point of reference for the BFI value. During the low-level formatting process, the controller performs bad sector mapping to remove the effects of these defects. This used to be achieved by a number of strategies.

If the controller identified a defect that only affected a single sector of the track it would attempt to shift the sector formatting slightly so that the defect occurred in one of the sector or track gaps, where it would have no effect. This is known assector slipping. If this was not possible, the controller would mark the sector concerned as badby setting bit 0 of the sector flag to 1 (see Fig. 5.7). The controller would not then permit any accesses to this bad sector. Some controllers were also able to format an additional spare sector on the track to replace this bad sector, thus ensuring that there would be no loss of formatted disk capacity.

Where there was more than one defective sector in a track, the controller could apply one of two strategies. In the first strategy, it could mark the entire track as bad by setting bit 1 of the sector flag to 1 in all the sectors of the track. The controller would not then permit any access to any of the sectors in that track. The effect of this was to reduce the formatted disk capacity and create a “hole” in the disk address space where the bad track resided.

A better strategy was to mark the complete track as bad by setting bit 2 of the sector flag to 1 in all the sectors of that track and assigning an alternative track starting from the highest numbered cylinder. The CHS address values of the ID fields in all these bad sectors were then set to point to their replacement counterparts in the alternative track. So, when a seek to a sector in a bad track was made, the controller simply looked up the alternative sector address in the ID field of the sector in the bad track and then performed a seek to that alternative sector instead. Any track that had been assigned in this way as an alternative track had bit 3 of the sector flag set to 1 in all of its sectors. This strategy could still result in a loss of formatted disk capacity, in that the alternative track would no longer be available for use in its own address position. However, it does have the benefit of ensuring that there would then be no “hole” in the disk address space, since the addresses of the bad track would all appear to work correctly using the alternative track sectors. In any case, most disks were designed to have some spare capacity, outside of the user address space, which was specifically set aside for this defective sector or defective track reallocation purpose. For example, the Seagate ST-225 had a nominal capacity of 20 Mbyte and an actual capacity of 21.4 Mbyte, making up to 1.4 Mbyte available for reallocation to defective sectors and tracks. Substantial spare capacity is normally built in to all modern hard

disk drives, but this is only accessible to the drive controller and is not part of the user address space.

Finally, it should be noted that there are four reserved bits in the sector flag shown at Fig. 5.7. We will return to these bits when we examine the ATA (AT Attachment) interface and LBA (Logical Block Addressing) in a later section.