scsibadblk(ADM) scsibadblk(ADM) Name scsibadblk - scan hard disk for defective blocks and attempt to reallocate them Syntax /etc/scsibadblk [ -f devicename ] [ -e ] [ -b [ -n ] bad block list ] [-s [ -d ] [ -q ] [ -r ] [ -a ] start block end block ] Description scsibadblk scans selected areas of a hard disk, recording the numbers of any flawed or ``bad'' blocks. These blocks can then be re-allocated onto good areas reserved automatically by the target disk for this purpose. Any future accesses to re-allocated bad blocks are transparently referred to their aliased areas by the disk. Blocks are 512 bytes long, and are specified from the start of physical disk. Options -f devicename Invokes scsibadblk on the entire physical disk. This is /dev/rhd00 for the first disk, /dev/rhd10 for the second, and so on. The default is /dev/rhd00. -e Enables Automatic Write/Read Remapping (AWRE/ARRE), if these are supported features of the target disk. If enabled, these features should dynamically manage the re-allocation of bad disk blocks as they develop over the disk's lifetime. If this option is used in conjunction with the scan option, -s, scsibadblk attempts to enable AWRE/ARRE before beginning the scan. If this attempt is success- ful, the scsibadblk utility is redundant, and will therefore exit immediately. -b [ -n ] bad block list Causes the list of block numbers to be re-allocated. Each block number must fall within the boundaries of the physical drive. Data recovery from bad blocks is attempted by default; the -n option switches this off. -s [ -d ] [ -q ] [ -r ] [ -a ] start block end block Causes an area of disk to be scanned. The scan area may be the entire physical drive, as specified with the -a option, or a region bounded by start and end block num- bers. Any bad blocks detected are listed at the end of the scan. The -r option causes bad blocks to be silently re-allocated after the scan is completed. The default mode is for non-destructive, thorough scan- ning. Non-destructive scanning leaves the contents of the disk area being scanned untouched. Thorough disk scans employ two cycles of read/write operations to check the integrity of a specified area of disk. Use the -d option to specify a destructive scan. Use the -q option to specify a quick scan, which employs only one read/write operation per disk block. Usage When scsibadblk first runs, it attempts to establish whether the target disk supports Automatic Write/Read Remapping. If it does, and these fea- tures are user-configurable, a fifth menu option, ``Modify target parame- ters,'' is offered. If this option is selected, the current state of the Automatic Write/Read Remapping features is displayed, and the user is given the opportunity to enable or disable them. These features should be enabled if possible, to allow bad block re-allocation to be managed dynamically by the target disk. When used interactively, three scan options are offered. In addition, if the hard disk supports Automatic Write/Read Remapping, an option to enable or disable these features is given. Alternatively, direct re- allocation of bad blocks may be selected, if the sector numbers of the bad blocks have already been identified. The three scan options allow scanning of the entire physical disk, a range of blocks, or a specified division within the active partition. If the first option is selected, the entire physical disk is scanned, including boot and system table areas. The second option allows a given range of blocks anywhere within the phy- sical disk to be scanned. The start and end block numbers of the disk are displayed, to indicate the maximum scanning range permitted. (These num- bers are 512 byte offsets from the start of physical disk.) The user is prompted for a range of block numbers between which to scan. The third scan option allows the user to specify a division for the scan. This division may be a filesystem or swap area. A table is displayed showing the start and end block numbers of the divisions that comprise the active partition. The user is prompted for the number of the division to be scanned. Before a scan begins, the scan mode must be selected. Scans may be non- destructive or destructive, and either quick or thorough. Thorough scan- ning employs an extra cycle of read/write operations, so takes approxi- mately twice as long as a quick scan to cover a given area of disk. If bad blocks are detected during scanning, warning messages, signifying read or write errors, may be displayed. These warning messages include a block number, which corresponds to the number of the block being scanned. An example warning message is given below. NOTICE: Sdsk: Unrecoverable error reading SCSI disk 1 dev 1/111 (ha=0 id=5 lun=0) block=445 If these messages are seen during day-to-day system activity, the printed block number may not necessarily correspond to the physical offset from the start of the disk. Under these circumstances the disk should be scanned to establish the absolute block number. Scanning may be interrupted at any time by pressing the Del key. Inter- rupting a non-destructive scan should not cause any loss of disk data. Any bad blocks found at the end of, or after interrupting, a scan are listed and may then be re-allocated. Bad block re-allocation is done at the end of a scan if bad blocks are found, or by selecting the block re-allocation option directly. If the -b option is used to do this, the block numbers used must be absolute block numbers relative to the start of physical disk. Before re-allocation takes place, the user is offered the option of attempting data retrieval from those blocks marked bad. If this option is selected, an attempt is made to read data from the bad block, and copy it into its alias area on disk. Re-allocation takes place regardless of whether data retrieval succeeds or fails. Notes Some SCSI hard disks may not support bad block re-allocation. The scsibadblk utility uses the SCSIUSERCMD ioctl interface to pass mode sense, mode select, and block re-allocation requests to the target disk. Files /etc/scsibadblk Value added scsibadblk is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.