strange badblocks problem

marnixk lfs at
Tue Jan 13 09:12:57 PST 2004

Bill's LFS Login wrote:

> From your post, I believe you really have the answer already, but just
> didn't recognize it. Search the LFS archives (you'll have to try
> different keywords, I can't recall is the thread was under bad blocks or
> something else) and you'll see what I mean about having the answer
> already.

I have found the thread ("errors using dd for backups") and indeed I see
what you mean about having the error already...

> IIRC, it has to do with partitioning tool (partitions in sectors, blocks,
> tracks or cyls) and block sizes. When the partition end contains the
> *start* of a block that encompasses *multiple* sectors and one or more
> of the remaining sectors would be beyond the end of the partition, you
> get these failures.

Strange thing is that I have never seen this problem before and I have never
before minded the block sizes with respect to the sector size when
partitioning systems. But then again I have not used dd and badblocks that
often either. 
However, on one of my other Gentoo systems I have a partition with a block
size of 4K and tune2fs shows a block count of 2682847. The blocking factor
being 8 (am I right?) I get a total of 21462776 sector occupied by the
filesystem. However, using sfdisk -l -uS on that disk shows a sector size
of 512 bytes and 21462777 sectors on the partition. So this partition is
one sector bigger than the filesystem. On this drive I have no problems
using badblocks or dd. So why does it work correctly on one machine and not
on the other? Or am I missing something?

On a side node, are only programs like dd and badblocks (that access the
disk directly) affected by this problem, or could I loose data because some
app is trying to write on one of those sectors outside the fs? If not than
I am less concerned about all this...

> From that "skimming", I would guess you had a 2K block size (4 sectors)
> and the partition does not end on a multiple of 4 sectors.

Instead I have a 4K block size in the specific partition (8 sectors), but
the idea is the same I guess.

> If you can repartition so that the number of sectors is evenly divisible
> by the sectors per block, your problem should go away.

I am going to try this:
Repartition the drive and make sure the size of each partition (in sectors)
is evenly divisible by 8. (this would mean that blocksizes in the
filesystems of 1K, 2K and 4K would work ok, would it not?)

Although I still am concerned that there is more to it than this, since the
other machine does not show this behaviour and the number of sectors in
that partition is also not evenly divisible by 8. And if there indeed is
more to it, then what will go wrong next... Well, maybe I am just being

Many thanks to you for your reply and the forementioned thread!


More information about the lfs-support mailing list