badtrk(ADM) 19 June 1992 badtrk(ADM) Name badtrk - scan fixed disk for flaws and creates bad track table Syntax /etc/badtrk [ -e [ -m max ] ] [ -s qtdn ] [ -v ] [ -f device ] Description Used chiefly during system installation, badtrk scans the media surface for flaws, creates a new bad track table, prints the current table, and adds and deletes entries in the table. Bad tracks listed in the table are ``aliased'' to good tracks, such that when a process tries to read or write a track listed in the bad track table, one of the replacement tracks is used instead. These replacement tracks are allocated when badtrk is run during installation. Changing the number of replacement tracks allocated may require re-installation of the operating system, so the number of replacement tracks allocated should be fairly large. Options -f device Opens the partition device and reads the bad track table associated with that partition. device must be a UNIX partition of a fixed disk: /dev/rhd0a for the first drive, /dev/rhd1a for the second, and so on. The default is /dev/rhd0a. -e Used by the installation procedure, the -e flag causes badtrk to change the size of the bad track table. WARNING: The -e flag should not be invoked by the user. Use of the -e may restructure the hard disk, rendering much of the information stored on it unusable. -m max Used only in non-interactive mode in conjunction with -e, -m sets the maximum number of bad tracks to max. -s arguments Invokes badtrk non-interactively, causing it to scan the disk for bad tracks and enter any errors found in the bad track table. The arguments specify either quick or thorough, and either destructive or non- destructive scan: [q]uick [t]horough [d]estructive [n]on-destructive The user should specify either q or t, and either d or n. -v Used only in non-interactive mode in conjunction with -e, -v displays progress messages indicating how much of the disk has been scanned. Usage When badtrk is executed interactively, the program first displays the main menu: 1. Print Current Bad Track Table 2. Scan Disk (You can choose Read-Only or Destructive later) 3. Add Entries to Current Bad Track Table by Cylinder/Head Number 4. Add Entries to Current Bad Track Table by Sector Number 5. Delete Entries Individually From Current Bad Track Table 6. Delete All Entries From Bad Track Table Enter your choice or q to quit: You are prompted for option numbers, and, depending upon the option, more information may be queried for later. A bad track table (option 1) might look like this: Defective Tracks Cylinder Head Sector Number(s) --------------------------------------------------------- 1. 190 3 12971-12987 Option 2 scans the disk for flaws. If changes have been made to your bad track table since you last updated the table on disk (or since you entered badtrk), you will be asked if you want to update the disk with the new table before scanning. You should answer ``y'' to save your changes, ``n'' if you don't want to save changes made up to this point. Next you are prompted to specify the kind of scan you wish to perform: either quick or thorough, and either destructive or non-destructive. Choosing a destructive scan will cause all data in the scanned region to be lost. After you respond to these prompts, badtrk begins its scan. You can interrupt a scan by typing ``q'' at any time. You are then prompted to continue the scan or return to the main menu. As the program finds flawed tracks, the location of each bad track is displayed. An example error message might be: wd: ERROR : on fixed disk ctlr=0 dev=0/47 block=31434 cmd=00000020 status=00005180, sector = 62899, cylinder/head = 483/4 (You may see this kind of message if there is a read or write error dur- ing the scanning procedure.) When the scan is complete, the main menu reappears. The program automat- ically enters any detected flaws in the bad track table. If your disk is furnished with a flaw map, you should enter these flaws into the bad track table. Select either option 3 or 4, depending upon the format of the flaw map furnished with your disk. Enter the defective tracks, one per line. (This should only be done on non-remapped drives; see cautions under ``Notes''.) When you are satisfied that badtrk contains a table of the desired flaws, quit the badtrk program by entering ``q'' at the main menu. If badtrk was invoked with the -e flag (which should only occur when called by mkdev hd during the installation procedure), and the disk con- tains a valid division table, the following message is displayed prior to the badtrk menu: This device contains a valid division table. Additional (non-root) filesystems can be preserved across this reinstallation. If you wish to be able to preserve these file systems later, you must not change the current limit of the bad track table, which is n bad tracks. Do you wish to leave it unchanged? <y/n>: If you respond ``y'', you will not be prompted later to enter a new limit for the size of your bad track table. You can add or delete entries, but you will not be allowed to increase the maximum number of bad tracks allocated. If you respond ``n'' and the size of your bad track table is changed, your disk division table will be destroyed. If you do not have a valid disk table or you selected ``n'' when prompted, you are prompted for the number of replacement tracks to allo- cate. There will be a recommended number of replacement tracks to allo- cate based on the number of known bad tracks plus an allowance for tracks that may go bad in the future. You should choose to allocate at least the recommended number of replacement tracks. Make your choice carefully, because if you want to change this amount later, you will have to rein- stall. Before exiting, badtrk will ask whether you wish to update the device with the new bad track table. If you wish to save you changes, answer ``y''. If you wish to leave the bad track table as it was before running badtrk, answer ``n''. Notes This utility only applies to standard disk controllers and not SCSI host adapters or IDA controllers. badtrk can only be used in single-user mode. If a bad spot develops in the boot blocks or system tables at the very beginning of the partition, reinstallation is required. Some disk controllers support alternate modes known as "translation", "mapping" or "63-sector" modes, that change the apparent shape of the drive. This is often used to make a drive that has more than 1024 cylinders appear to have less cylinders in order to make it compatible with MS-DOS. If your drive has been formatted using one of these options, do not use options 3 and 4 to manually add entries to the bad track. File /etc/badtrk Value added badtrk is an extension of AT&T System V provided by The Santa Cruz Opera- tion, Inc.