Score:0

Translate badblocks result from 1024 block size to 4096 block size?

us flag

I have a 4TB hard drive which I ran the badblocks utility without passing in the -b block-size parameter. So I'm pretty sure it defaulted it to 1024, and my 4TB drive/filesystem is most likely setup with a block size of 4096. Is there a way I can translate the results to match the 4096 block size? For example, if the bad block is #5 with block-size=1024, it would map to block #2 with block-size=4096. Is that a valid conversion from 1024 to 4096?

If so, then I can re-run badblocks and specify a start and end range which will save me a lot of time.

Score:1
in flag

You are correct that the default block size for badblocks is 1024. From the documentation:

-b block_size
   Specify the size of blocks in bytes. The default is 1024.

Your math is also correct. If you are using Ext4 with a default configuration, then your partitions are using 4KB blocks. So, if the 777th block had an error found, you can round down:

Floor((777 * 1024) / 4096) = 192

∴ Block 192

For the sake of completeness, you can probably round down further to 190 when specifying a range:

sudo badblocks -sb 4096 /dev/sdb1 200 190
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.