dcheck

Check a disk for bad blocks (QNX Neutrino)

Syntax:

dcheck [options] drive

Runs on:

QNX Neutrino

Options:

-B max_blks
The maximum number of blocks to read at a time; max_blks can be up to 32 (the default).
-b blk_cnt
The maximum number of blocks to check.
-F
Loop as for the -l option, but without prompting for input at the end of each iteration.
-f first_blk
The first block to check.
-L loops
Loop as for the -l option, but for a specified number of iterations.
-l
(“el”) Loop, switching between serial and random, pausing for input after each iteration.
-p
Prompt before starting.
-q
Be quiet; don't display progress information.
-r
Use a random head-movement algorithm.
-V
Verify write after read.
-v
Be verbose; display every bad block on the disk.
-w
Write after read (nondestructive) check.
drive
The name of the disk (e.g., /dev/hd0t77) or the root of the filesystem.

Description:

The dcheck utility verifies that a disk has been correctly formatted, by attempting to read every block on the drive. The block numbers of any blocks that can't be read are displayed (in hex) to standard output. A summary of the total number of bad blocks is also displayed. You can use dcheck to check any formatted disk, including disks that contain files. The files aren't damaged.

If you don't specify the number of blocks to verify, dcheck obtains this information from the filesystem and checks all the blocks on the specified drive.

Some blocks may be marginal, so if you run dcheck multiple times (see the -F, -l, and -L options), you can increase the chance of recognizing these blocks.

To help you find any marginal blocks, dcheck has a number of options to provide additional checking of a disk. For example, the -r option checks the blocks in a random order; each check consists of a random number of blocks between 1 and 32 (or less, depending on the value specified in the -B option). The dcheck utility keeps track of the checked blocks and checks each one only once. This option allows you to find blocks that are bad due to a slight lag time in head movement.

The -l option makes dcheck continuously check the disk until you stop it. For this option, -r is implicitly used and is toggled for each invocation. That is, for the first loop, random checking is set on; for the second loop, it is off, etc. At the end of each complete check, you're prompted to stop the loop. If you don't stop it within 15 seconds, dcheck is started again, etc. The -L option is identical to -l with an upper limit to the number of loops. The -F doesn't prompt you at the end of each check.

The -w option makes dcheck rewrite each block on the device after reading it. This is a nondestructive check that tests the write portion of the hardware. Note that, although this is a more thorough test, it takes more time, depending on the hardware.

The -V option is similar to the -w option, in that dcheck rewrites each block after reading it, but in this case dcheck also rereads each block after the rewrite check and compares this second read with the first. Like the -w option, this test is nondestructive. Note, however, that this is a more thorough test that takes longer.

Note: The dcheck utility normally opens the disk in read-only mode. However, if you specify the -w or -V option, the disk is opened in read/write mode. For read/write access, there must be no open files on the disk, or else dcheck fails with a “Device or resource busy” message. While dcheck is working in read/write mode, no other utilities or programs is allowed to access the disk.

Examples:

Check all blocks on the hard disk:

dcheck /dev/hd0t77

Exit status:

0
No bad blocks were found.
>0
An error occurred, or bad blocks were found.