On Thu, Apr 12, 2018 at 02:53:19PM -0700, Andres Freund wrote: > > > > > > Isn't beautiful to script, but it's also not absolutely terrible. > > ext4 seems to have something roughly like that > (/sys/fs/ext4/$dev/errors_count), and by my reading it already seems to > be incremented from the necessary places. This is only for file system inconsistencies noticed by the kernel. We don't bump that count for data block I/O errors. The same idea could be used on a block device level. It would be pretty simple to maintain a counter for I/O errors, and when the last error was detected on a particular device. You could evne break out and track read errors and write errors eparately if that would be useful. If you don't care what block was bad, but just that _some_ I/O error had happened, a counter is definitely the simplest approach, and less hair to implemnet and use than something like a netlink channel or scraping dmesg.... - Ted