3

I'm testing using btrfs on my embedded Linux system. It uses a uSD card for the rfs. This system is remotely deployed so there's no human sysadmin to take care of it. My question is what happens when the checkum fails for reading a file? Is there any way of automatically detecting this and sending a message back to my central server?

5

Btrfs uses crc32c checksums to check the integrity of blocks. If the checksum doesn't match the block when it's read then an alternative block is read. This is assuming there is an alternative (RAID1). If that block also fails or if there is no alternative an EIO (error input/output) is returned.

I do not know of any way to automatically detecting errors, but all errors are logged to syslog. Try dmesg | grep btrfs. You should be looking for something like this:

[ 2993.114213] btrfs: sda2 checksum verify failed on 272228352 wanted 1A0FCFD3 found 119281BE level 0
[ 2993.114527] btrfs: sda2 checksum verify failed on 272228352 wanted 1A0FCFD3 found 119281BE level 0
[ 2993.114795] btrfs: sda2 checksum verify failed on 272228352 wanted 1A0FCFD3 found 119281BE level 0
[ 2993.115097] btrfs: sda2 checksum verify failed on 272228352 wanted 1A0FCFD3 found 119281BE level 0

You could probably make a script or a that looks through the logs and notifies you of errors at regular intervals. Or you could filter these log entries and trigger an rsyslog action.

  • Thanks for the answer. I am not using RAID as my systems only have 1 SD card. – fred basset Jun 2 '14 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.