David A. Harding on 22 May 2009 10:31:21 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Fixing smartd "Offline uncorrectable sectors" *

On Fri, May 22, 2009 at 10:31:53AM -0400, LeRoy wrote:
> You can mount a partition read only or unmount it.
> Then you can run e2fsck with the following:
> e2fsck -p -f -c -C 0

J.P., the OP, wanted to do a write test, but the -c e2fsck command only
does a read test. You need to specify the -c option twice to run a write
test. Running a write test on a mounted filesystem, especially the root
filesystem, is a very bad idea. The non-destructive badblocks write test
reads the current state of a sector, saves it in memory, overwrites the
sector with test data, restores the state, and goes to the next sector.

If the filesystem driver attempts to read from that sector at the same
time badblocks is testing it, it will get bad data. If the filesystem
driver detects the bad data, the read (or other) system call will fail,
which can cause problems. If the filesystem driver doesn't detect the
bad data, it will pass the bad data on to a running program or even the
kernel, which can cause serious problems.

The worst problem that can happen is a kernel panic or badblocks crash:
in either case, badblocks won't be able to restore an overwritten sector
from memory *and that data will be gone forever*.

If you like your data, don't run ever write to a mounted filesystem
except through the filesystem driver.

David A. Harding	    Website:  http://dtrt.org/
1 (609) 997-0765	      Email:  dave@dtrt.org
			Jabber/XMPP:  dharding@jabber.org
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug