From: Linus Benedict Torvalds (torvalds@klaava.Helsinki.FI)
Date: 07/16/92


From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Subject: Re: FAQ addition: (was Re: Badblocks revisited (**sigh**))
Date: 16 Jul 1992 22:03:18 GMT

In article <uR5ZNB6w165w@ssg.com> unixsys@ssg.com (Rick Emerson) writes:
>u31b3hs@cip-s02.informatik.rwth-aachen.de (Michael Haardt) writes:
>>
>> Linux does not mark bad blocks, so you have to do that. It's not really
>> difficult, it is just that you need MINIX to do the job. Don't yell at
>> me ...

That was true of linux versions 0.10 and below: I think 0.11 already had
a mkfs that did the mapping out of bad blocks (this can be confusing to
minix users: in minix, you use a special program for it, under linux you
just use "mkfs -c" (or "mkfs -l" if you know the bad blocks)).

Linux maps out bad blocks by putting them in a ".badblocks" file in the
root directory (although you can naturally rename this later) that has
inode nr 2. Minix used several small files, as the minix badblocks
program was too stupid to understand about indirection in an inode, so
it created a inode for every 7 bad blocks (minix inodes have 7 direct
pointers in them).

So if you have a .badblocks file, you should be careful not to try to
back it up if you are doing a full system backup: it will result in no
end of read errors (not too surprisingly).

Also note that linux doesn't do bad-block mapping at a device level:
It's done by the filesystem. Mapping bad blocks on a lower level is
complicated, and often not worth it (as most new controllers do it in
hardware).

> You
> must
> be
> joking!

No, this was standard practice with the early versions of linux. I
hadn't written a mkfs or a fsck, so you actually needed minix to set
things up. Happily, this is no longer true, and hasn't been for about 8
months or so.

>Install another OS to fix this one? (Yes, yes, yes, I know Linux is
>descended from Minix)

Actually, "descended" is too strong a word: I just used minix as the
platform I wrote it on, and that has made its mark mostly on the
original filesystem layout. Minix and linux are worlds apart
internally: totally different principles in all things from interrupt
handling to process control and memory management.

                Linus