badblk -- locate bad blocks within files


/etc/badblk [ -hn ] -d device blkno ...
/etc/badblk [ -hn ] major minor blkno ...


badblk reports inodes that contain bad disk blocks specified by their logical block numbers (blkno). The device node is specified by the device argument to the -d option, or by its major and minor device numbers. (The kernel displays the major and minor device numbers when it reports a bad block.)

badblk takes the following additional options:

Report the filesystem name, the block offset from the start of the filesystem, and the partition number. badblk determines the offsets of the blocks relative to filesystems on the device. Use this option if device does not reference a filesystem directly. (For example, /dev/rhd10 refers to the entire second hard disk).

Report pathnames instead of inode numbers. (badblk runs ncheck(ADM) to do this.)
For filesystems that have a traditional structure with separate inodes and data blocks, badblk reports whether a block is a direct data block, or a single, double, or triple indirect block of an inode, or if it is not allocated. For the DTFS(TM) filesystem, badblk reports whether a block is a data block, or an interior node belonging to the filesystem's data structure.


The following kernel message is received:
   NOTICE: Sdsk: Unrecoverable error reading SCSI disk 2 dev 1/64 \
   	(ha=0 id=1 lun=0) block=219102
           Medium error: Unrecovered read error
The SCSI disk driver (Sdsk) has detected a hard error in a block on the second hard disk (/dev/hd10, major 1, minor 64). On scanning the disk using badtrk(ADM), the equivalent SCSI logical block address (LBA) is also established to be 219102. The equivalent filesystem logical block number is 109551; the SCSI logical block size for this disk is 512 bytes and the filesystem logical block size is 1KB.

badblk is used to discover if this block is a direct data block, or the single, double, or triple indirect block of an inode, or if it is not allocated:

badblk -h -d /dev/rhd10 109551

This reports a message such as:

   block 109551 in /dev/rdsk/1s0 is block 109083 in filesystem
   	/dev/u (partition 5, division 0)
   block 109083 in /dev/u (EAFS) is a direct data block of inode 1067
To discover which filenames are linked to this inode, enter:

badblk -hn -d /dev/rhd10 109551


badblk -n -d /dev/u 109083

badblk reports the additional information:

   finding pathname: /dev/u:
   1067	/u/foo/bar
   1067	/u/foo/inn
   1067	/u/local/foo/pub
Inode 1067 is shown as having three directory entries that reference it.


badblk is implemented for AFS, DTFS, EAFS, HTFS(TM), S51K, and XENIX® filesystems only.

See also the ``Limitations'' listed for mount(ADM).


badblk binary for each filesystem type

See also

badtrk(ADM), divvy(ADM), dparam(ADM), fdisk(ADM), fsdb(ADM), mount(ADM), ncheck(ADM)

Standards conformance

badblk is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003