You can mark a block (LBA) as bad either manually or you can set the drive up to automatically mark blocks as bad if there is either a read or a write error when accessing the block.
Viewing the Bad Block list
As a quick review, there are two types of bad blocks:
( P)rimary bad blocks (or defects) are blocks that the manufacturer marked as bad during manufacturing of the drive. The Primary defect list can be displayed but can never be changed.
(G)rown defects are bad blocks that have been marked bad once the drive has been in use.
Here is a picture showing information about the (P)rimary defect list of a SAS drive:
Note that you are shown the total number of primary defects, plus you can see the location of these defects.
Here is the same drive, this time looking at the (G)rown defect information:
Since the (P)rimary defect list is generated by the manufacturer and connot be changed it is not very important or helpful information.
On the other hand the (G)rown defect information is very important! In the real world it is rare for a drive to accumulate Grown defects. Any drive that has Grown defects should be thoroughly tested and excersiced.
An additional piece of information that is displayed by the STB Suite is a head map of the defects – here is the defect-per-head map for our sample drive:
Manually adding a defect
Manually marking a block as “bad” is a simple matter of selecting your drive, then going to the
Disk->Commands->Defect (bad block) Functions->Reassign Block command.
Enter the LBA of the block you want to mark as bad –
Now when we look at the (G)rown defect list we see another defect has been added:
Automatically adding defects
SAS, SCSI, and Fibre Channel disk drives have the ability to automatically map defects or mark blocks as bad upon either read or write errors. These settings are found in the drives MODE PAGES, specifically in the ERROR RECOVERY page, the AWRE (Automatic Write Reallocation Enable) and the ARRE bits (Automatic Read Reallocation Enable) bits.
Simply put, if these bits are set (1) then if the drive fails a READ or a WRITE operation the block will be marked as bad and that LBA will be reassinged. So theorignal physical block for LBA 100 is marked bad on the drive, but it is also remapped to a different physical block on the drive. Now when the system goes to operate on LBA 100 instead of going to the physical block that was oringally LBA 100 it will now transparently go to the new reassigned physical location on the drive. Neat! The only downside to this reallocation is that there will probably be a preformance hit due to the drive having to go to what is now probably not an adjacent block on the drive.
But at least the data is preserved.
Which brings up the other aspect of automatic reallocation – the drive will try its best to recover the data from the bad block and move it over to the new reassinged block.
All of this is set up by using the STB Suite Mode Page Editor. Simply select the disk drive, right-click and choose the Edit Mode Pages quick command. Choose the Error Recovery Page and set the drive to behave the way you want.
BTW- why might you not want the drive to automatically reallocate blocks on error?
Because the reallocation process takes a finite amount of time to accomplish. If absolute highest data throughput is your applications most important factor then you may very well decide to trade the data integrity afforded by automatic reallocation for the speed of not having allocation turned on.
Throw out the Grown and start fresh
You can discard the (G)rown defect list by simply issuing a FORMAT CDB to the drive. The default FORMAT command will discard the G list and will also run a verify pass. Any defects found in the verify pass will be added to the new G list.