[CentOS] OT - Offline uncorrectable sectors

Mon Aug 25 11:24:24 UTC 2008
William L. Maltby <CentOS4Bill at triad.rr.com>

On Mon, 2008-08-25 at 06:36 -0400, Stephen Harris wrote:
> On Mon, Aug 25, 2008 at 10:43:01AM +0200, Lorenzo Quatrini wrote:
> > So again my question is:
> > can I use dd to "test" the disk? what about
> > 
> > dd if=/dev/sda of=/dev/sda bs=512
> > 
> > Is this safe on a full running system? Has to be done at runlevel 1 or with a
> > live cd?
> Do not do this on a mounted filesystem; you risk corruption.  I'd be leary
> of this command, though.

Whoo-hoo! The question un-asked ...

I didn't even think of mentioning this to him in my other reply. I'm
glad you jumped on that.

> A better way is use the "badblocks" command; if you want to keep data
> then "badblocks -n"; if you don't care about data then "badblocks -w".
> Again, you can't do this on a mounted filesystem.

This is *far* superior to the OP's thoughts of dd.

And I'll remind here, mentioned in my other post, about "hard" and
"soft" errors. "Soft" errors are not seen by the OS.

"Badblocks" (which really should be invoked via mke2fs or e2fsck rather
than manually) has useful, but limited, utility in ensuring reliability.
And it does require some small storage space in the file system. And it
does *not* assign alternate blocks (that is, it does not take advantage
of the hardware alternate block capability). And it is not "predictive",
thereby being useful only for keeping an FS usable *after* data has been
(potentially) lost on an existing file system. It's best utility is at
FS creation and check time. It also has use if you can un-mount the FS
(ignoring the "force" capability provided) but cannot take the system
down to run manufacturer-specific diagnostic and repair software.