Index

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

From : Edward Anderson <nilbus@nilbus.[redacted]>

Date : Mon, 04 Oct 2010 13:18:07 -0400


I recently was experiencing random freezing when using Chrome on my laptop. Finally it occurred to me that I might be experiencing disk issues. Sure enough, my syslog revealed that there were I/O errors on my disk. In the end, I ran fsck to do a badblocks check, which marked the blocks bad, which I was able to see using dumpe2fs. Before I did that though, I wanted to see which files were being affected. I used the guide linked below to convert the sector on the disk to an inode number in the filesystem, which told me that the bad block was on my Chrome history file for September. Makes sense. Something that I really didn't get though was this:

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

Replies :