0

System: Debian Squeeze

What's it for: A System where any new disk is DoD Wiped.

I'm looking for a method to fire a command on a disk error that the kernel throws, sometimes we get bad disks and it just needs to be scraped.

Common lines in the logs are

Jan 15 10:34:33 drivekiller9k kernel: [339274.100020] usb 2-3: reset high speed USB device using ehci_hcd and address 51
Jan 15 10:34:33 drivekiller9k kernel: [339274.233729] sd 176:0:0:1: [sdl] Unhandled error code
Jan 15 10:34:33 drivekiller9k kernel: [339274.233733] sd 176:0:0:1: [sdl] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK
Jan 15 10:34:33 drivekiller9k kernel: [339274.233737] sd 176:0:0:1: [sdl] CDB: Write(10): 2a 00 00 34 b8 70 00 00 f0 00
Jan 15 10:34:33 drivekiller9k kernel: [339274.233781] __ratelimit: 20 callbacks suppressed
Jan 15 10:34:33 drivekiller9k kernel: [339274.233815] lost page write due to I/O error on sdl

I would like a method where I could just run a shell script to kill the wiping process and write to a log, what would be the proper method to do this?

slhck
  • 235,242

2 Answers2

0

You can use smartmontools to monitor your disk health, using the provided smartd demon. Some examples.

Atropo
  • 1,643
0

you could use the Shell execute ACTION of rsyslog to trigger actions (e.g. your recovery script) on certain log message entries. See man rsyslog.conf for details.

sparkie
  • 2,268