Index

Subject : Re: LUG: Zeroing out bad blocks on ext filesystem to reallocate?

From : Ian Kilgore <imkilgor@ncsu.[redacted]>

Date : Mon, 04 Oct 2010 13:51:34 -0400

Parent


On Mon, Oct 4, 2010 at 1:18 PM, Edward Anderson <nilbus@nilbus.[redacted]> wrote:
> According to http://smartmontools.sourceforge.net/badblockhowto.html
>>
>> To force the disk to reallocate this bad block we'll write zeros to the
>> bad block, and sync the disk:
>>
>> root]# dd if=/dev/zero of=/dev/hda3 bs=4096 count=1 seek=2269012
>> root]# sync
>
> �Why would writing zeros directly to the block device cause the ext
> filesystem to reallocate that file? They don't explain that, but just say
> that it does.
>
> Edward
>

I think that's actually a function of the drive and is transparent to the OS and
the filesystem (which is why you're writing to the device with dd instead of
some tune2fs command). Any writable blocks that are allocated to a file will
be overwritten and that data (if any) destroyed. Blocks that cause I/O errors
(I believe) will be re-mapped by the hard drive until it runs out of scratch
space to do so.
--
ik