On using Badblocks with ReiserFS

Jurjen Bokma

July 2007


Table of Contents

Finding the bad area using badblocks

We have error messages on server iwi202 that look like shown in . The problem repeats twice in quick succession (8 seconds between occurrences) about every twelve minutes, but doesn't stick to fixed post-the-hour times, so we don't believe a cron job causes it. The machine does react more slowly than usual. I will move important processes off the machine, but some minor items may stay on it, and I want to see if I can get rid of the problem by making the ReiserFS stop using the single block that is causing errors.


The sector that causes errors -104206368- is located in /dev/sda9, which is mounted as /var. I could run badblocks on the entire disk if I put the machine in single-user mode and unmounted /var, but I'd rather be as unobtrusive as possible, as I'll see notifications of bad sectors turning up in the logs anyway. According to the badblocks manual, I can say: badblocks -c<blocks-at-a-time> <device> <end-block> <start-block> -i <former-badblocks-report> Badblock counts in blocks of 1024 bytes, whereas we know the location of the bad sector in 512-byte sectors. So we compute the location of the sector in blocks: echo -e "104206368\n2\n/\np"|dc , which yields

. Then we issue the command to check the partition: badblocks -c64 /dev/sda9 52103222 52103152 |tee ~/bad_blocks.dev.sda9 A few blocks after our culprit appear to be bad as well: