Disk Test & Health Monitoring


Table of Contents

cmd:badblocks 
Usage 
Memory allocation trials 
Running modes 
Memory requirement 
Interestion options 
Drives disappearing/reappearing 
Using smartctl 
Using smartctl 
How to solve daemon:smartd failed 
Summary 
Symptom 
Solution 
Conclusion 
Working History 
What is this ata exception 
Interpreting the output of ide-smart 
Monitoring Hard Disks with SMART 
Disk Attributes 
Examine the disk's Attributes 
Smartd daemon 
low level format under linux 
low level format under linux 
Low level hard disk programming 
PATCH using mtools/mformat to low-level format disks 
Benchmark Utilities 
Benchmark Tools 
Hardware Notes: Hard Drive Benchmarking With iozone 
Versatile benchmarking with iozone 
GNU/Linux Benchmarking - Practical Aspects 
The DOs and DON'Ts of GNU/Linux benchmarking 
A roundup of benchmarks for Linux 
Devising or writing a new Linux benchmark 
An application benchmark: Linux 2.0.0 kernel compilation with gcc 
Question on disk benchmark and fragmentation 
The Linux Benchmarking Toolkit (LBT) 
Disk Linux performance 
Portable OS-Based Benchmark 
What is POSBB ? 
Why "POSBB" ? 
Which tests does POSBB perform ? 
What platforms does POSBB run on ? 
Where is POSBB ? 

cmd:badblocks 

Usage 

non-destructive 

tdev=hda1
nice badblocks -p 99 -c 90000 -nv /dev/$tdev 2>&1 | tee -a /tmp/badblocks.$tdev.log &

destructive 

tdev=hda2
nice badblocks -p 99 -c 90000 -wv /dev/$tdev 2>&1 | tee -a /tmp/badblocks.$tdev.log &

Memory allocation trials 

$ jot - 900000 100000 -50000 | xargsi -t badblocks -c {} -nv /dev/hda
[...]
badblocks -c 150000 -nv /dev/hda
badblocks: Cannot allocate memory while allocating buffers
badblocks -c 100000 -nv /dev/hda
Initializing random test data
Checking for bad blocks in non-destructive read-write mode
[...]

Running modes 

By default only a non-destructive read-only test is done.

-n     Use  non-destructive  read-write  mode.
-w     Use write-mode test. With this option, badblocks scans  for  bad
       blocks  by  writing  some  patterns  (0xaa, 0x55, 0xff, 0x00) on
       every block of the device, reading every block and comparing the
       contents.   This  option may not be combined with the -n option,
       as they are mutually exclusive.

Memory requirement 

Badblocks needs memory proportional to the number of blocks tested at once, in read-only mode, proportional to twice that number in read-write mode (NB, might not be true. I noticed that the memory requirement is constant, as in e2fsprogs-1.27-9. Tong), and proportional to three times that number in non-destructive read-write mode.

If you set the number-of-blocks parameter (-c) to too high a value, badblocks will exit almost immediately with an out-of-memory error "while allocating buffers" in non-destructive read-write mode.

If you set it too low, however, for a non-destructive-write-mode test, then it's possble for questionable blocks on an unreliable hard drive to be hidden by the effects of the hard disk track buffer.

Interestion options 

-p num_passes
       Repeat  scanning  the disk until there are no new blocks discov-
       ered in num_passes consecutive scans of the disk.  Default is 0,
       meaning badblocks will exit after the first pass.
-v     Verbose mode.