Reiserfs – Dealing with Bad Blocks

Now, for some odd reason, in reiserfs you have to do the scan for bad blocks manually, instead of just letting fsck take care of it for you with the -c switch. I don’t know why this is the case but here is what I had to do.

Find out your partitions block size. This is 4096 by default in reiserfs but you can use the debugreiserfs command to find out what it is. It’s important for the badblocks command next.

debugreiserfs device | grep -i ‚blocksize‘

Run badblocks to scan the drive and store the list of found bad blocks in a file. I’m assuming the blocksize is the default here, if it isn’t replace 4096 with the number given by debugreiserfs.

badblocks -n -b 4096 -o badblocksfile device

Then run reiserfsck to fix the areas where the bad blocks are and mark them to not be used again.

reiserfsck –fix-fixable –badblocks badblocksfile device

Supposedly you can use reiserfstune to just update the bad blocks list without having to run a check and a fix but in may case the bad blocks were already in use in the tree. Reiserfstune made it clear I had to use reiserfsck in the error message.

So, right now I have partimage trying to image the drive. Hopefully with the blocks marked bad it won’t trip up anymore.