Amiga Unix — 68040 · 68060

Manual pages › System administration commands (1M)

hdefix(1M)

report or change bad block mapping on a hard disk device

From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.

NAME

hdefix - report or change bad block mapping on a hard disk device

SYNOPSIS

/sbin/hdefix -p [ -D major minor ]

/sbin/hdefix -a [ -D major minor [ -b blockno ...  ] ]

/sbin/hdefix -a [ -D major minor [ -B cyl trk sec ...  ] ]

DESCRIPTION

The hdefix command is part of the bad block handling utility. This command maps bad blocks to surrogate images in an area not accessible by the user.

Before attempting to execute hdefix, the system must be brought to the single-user state using the command init s. Only super-user can use hdefix to print a list of blocks currently mapped to surrogate images on the equipped hard disk devices or to change the mapping of these blocks.

When the mapping to surrogate images is changed, block initialization is performed. If the original block can be read, its data is written to the new surrogate image to prevent data loss. If the original block is unreadable, zeros are written to the new surrogate image. This will usually result in some data loss.

If the block is associated with a file system, the file system may be damaged as a result of the mapping change. To handle this situation, the file system is marked dirty, which means the fsck command must be run before the file system can be used, and a system reboot is forced after all other bad block processing is complete. If the block is a data block of a file, that file will be corrupted, even after this recovery has finished.

The following options may be used with hdefix:

-p prints a report that shows both the functional blocks and currently mapped bad blocks. If a specific hard disk device is specified (by giving its major and minor device numbers), only the report for that hard disk device is printed. If no particular hard disk device is specified, a report is given for each equipped disk.

-D used to specify the major device number and minor device number of a hard disk device.

-a used to map new bad blocks. If no arguments follow the -a option, all equipped hard disk devices are processed, using the HDE Log on each hard disk device to determine which blocks to map. If a specific hard disk device is specified, only that disk device is processed. If one or more block numbers are specified, those blocks are mapped, instead of using the block numbers listed in HDE Log. This is the only way to map an unreadable block containing the HDE Log.

-b blockno

specifies the physical hard disk block number. Physical hard disk block numbering starts with zero, meaning block (sector) 0 of track 0 of cylinder 0. The blockno value ranges from block number 0 through the maximum number of blocks on a particular hard disk drive minus 1.

-B cyl trk sec

specifies the physical disk block number in terms of its physical cylinder number (cyl), track number within cylinder (trk), and sector (block) number within track (sec). This alternate form is available for reporting bad block data obtained without using the normal system capabilities (e.g., off-line diagnostics provided by the manufacturer). This option is not supported on SCSI disks.

FILES

/dev/hdelog

SEE ALSO

fsck(1M), init(1M), hdeadd(1M), hdelogger(1M), hdelog(7).
Bad Block Handling in the System Administrator's Guide.

RETURN CODES

The hdefix command exits with one of three values:

0 means NORMAL (or TRUE)

1 means bad command usage or execution errors

2 means BAD BLOCKS (or FALSE) (but command executed successfully)