How do I spare blocks from the kernel's error list

Al Longyear (longyear@netcom.com)
Tue, 30 Sep 1997 22:29:11 -3100 (PDT)


I have a customer who has a nice 5G IDE (Western Digital) drive. The
problem is that this drive does not do automatic sparing of defective
blocks.

I have looked most everywhere for instructions on sparing bad blocks
with the Ext2 file system under Linux. Is there a document which describes
how to translate sectors from the kernel to blocks in ext2fs?

The e2fsck program will spare them. However, the program wants a block
number which I can not deduce.

The initial 'quick-read' check of mke2fs did not find the bad spots. The
more extensive 'badblocks' program did not find them. Yet, the kernel is
reporting them as missing address marks, un-recoverable errors, etc.

The kernel lists a LBA and a sector number along with the partition
information (i.e. device 03:08 == /dev/hda8.)

When I tried to give these numbers to the e2fsck program (in a file)
the program complained that they were invalid block numbers.

Is the relative sector number divided by 2 == block number for e2fsck? It
would seem so. Also, if you look at the output from ext2dump, it shows
that the starting block is '1', not '0'. Does this change the equation to

| |
| (LBA from kernel error - base_sector) |
block to be spared = | ------------------------------------- | + 1
|__ 2 __|

?

I am assuming that blocks are 1K (the default size) and the sector is still
512 bytes, so two sectors are needed per block.

I assume that the 'base_sector' value is the value obtained from the
'start' column when you use fdisk and ask it to print the partition table
with the 'expert' mode (option xp).

Many thanks.

-- 
Al Longyear           longyear@netcom.com         Finger for PGP key
Design is about changing your mind until you get it correct.