[clue-tech] fsck and badblocks

Kevin Fenzi kevin at scrye.com
Thu Feb 10 12:04:53 MST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Jed" == Jed S Baer <thag at frii.com> writes:

Jed> On Thu, 10 Feb 2005 11:28:03 -0500
Jed> Angelo Bertolli wrote:

>> I was reading the man page for badblocks and it says to use it by
>> using the -c option with fsck.  Does this mean that fsck doesn't
>> check for bad blocks automatically?  How would you do a reboot/fsck
>> with the -c option?

Jed> 1st question is what sort of disks you're using. Modern IDE
Jed> drives manage bad blocks internally. There's no utility at all,
Jed> AFAIK, to having the OS try to do so.

Well, it's worth noting that most modern IDE drives have a "pool" of
extra blocks/sectors. So, if the drive sees that one sector/block is
failing to read or write, it will remap that block transparently
behind the scenes. The OS never knows about that kind of block
remapping except when the data on it is lost. 

smartctl -a /dev/hd? 

will get you some more information on a modern SMART capable drive as
to how many sectors it has remapped and how many are left. 
For example, my laptop drive shows a "Reallocated_Sector_Ct"
(thankfully 0). 

However, when the "pool" of spare blocks the drive has is gone, the OS
will start seeing the bad blocks, since the drive can't do anything
more about them. You can still use badblocks to detect bad sectors
that the drive has remapped and tell linux not to use them. So, what
you want to do is run badblocks and get a list of blocks it finds as
bad, then when you make a new filesystem on the drive you tell mkfs to
not use those blocks.

ie: 

badblocks -w /dev/hda -o /dev/fd0/badblockslist

then

mke2fs -l badblocklist

With all that noted, 2 more observations: 

- - Drives are cheap. If you start seeing bad blocks at the OS level,
get a new one. 

- - If you start seeing bad blocks at the OS level, odds are very good
the drive is heading down a steep cliff, and even if you don't use the
bad blocks you find today, there will likely be many more in days to
come. 

kevin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFCC7BY3imCezTjY0ERAivbAJ9S+52Luh9BJCEK1+mX7oa2A4buoQCaAuK+
nmds9AEW+SGCy2LNXLjdHBg=
=Kr9r
-----END PGP SIGNATURE-----



More information about the clue-tech mailing list