2010-09-27

Badblocks: non-destructive read-write mode

With the -n flag ("non-destructive read-write mode"), badblocks does the following sequence in every iteration:
  1. read data
  2. write test pattern (test pattern is ~0 (0xffff in 32-bit int))
  3. read test pattern
  4. compare test pattern
  5. write data
It will try to write back the original data when terminated with the following signals:
  • SIGHUP
  • SIGINT
  • SIGPIPE
  • SIGTERM
  • SIGUSR1
  • SIGUSR2
Killing it with SIGKILL is dangerous because you have, at best, 3/4 chance of corrupting your disk (the only safe state to SIGKILL is when it does read data).

No comments: