Skip to contentSkip to conversation

How to work around bad blocks?

DISCUSSION Dirk Leber 6 participants 17 messages Mar 10, 2003 – May 15, 2003

lore
Share & tools
lore

Dirk Leber

author
#0 lore raw

Hello List,
I am the unhappy owner of a "corrupt" ReiserFS. All the other partitions on the same disk work fine, just this one seems to have some bad blocks. HEre are some outputs:

Quoted 1 line

mount /dev/hda4 /mnt/data2/

mount: wrong fs type, bad option, bad superblock on /dev/hda4,
or too many mounted file systems

Quoted 1 line

reiserfsck --check

[no problem]

Quoted 1 line

reiserfsck --fix-fixable /dev/hda4

reiserfsck 3.6.2 (2002)
Will check consistency of the filesystem on /dev/hda4 Will fix what can be fixed w/o --rebuild-tree Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes):Yes
###########
reiserfsck --fix-fixable started at Mon Mar 10 20:50:03 2003
###########

bread: Cannot read a block # 7503872.

Quoted 1 line

badblocks -b 4096

[detects bad blocks 7503858 - 7503871]

Obviously the build-tree option also fails. The "How Reiser handles Bad blocks-FAQ" can only be considered a bad joke, since you need a degree in computer science AND a mountable filesystem for fooling the FS in that way.

What I would like to do is, detecting the bad blocks, freeing them (accepting there content) rebuilding the tree (or not) and than mounting it while accepting that some files will be corrupt.

What can I do?

Dirk

#1 lore raw
Quoted 4 lines

Hello List,
I am the unhappy owner of a "corrupt" ReiserFS. All the other partitions on the same disk work fine, just this one seems to have some bad blocks. HEre are some outputs:

<snip>

Quoted 6 lines
Quoted 1 line

badblocks -b 4096

[detects bad blocks 7503858 - 7503871]

Obviously the build-tree option also fails. The "How Reiser handles Bad blocks-FAQ" can only be considered a bad joke, since you need a degree in computer science AND a mountable filesystem for fooling the FS in that way.

Agreed that handling of bad blocks in most FS in Linux is quite annoying and far from optimal.

Quoted 5 lines

What I would like to do is, detecting the bad blocks, freeing them (accepting there content) rebuilding the tree (or not) and than mounting it while accepting that some files will be corrupt.

What can I do?

Right now the easiest way it to get a new drive and use dd_rescue to move the data. dd_rescue can copy the contents from your bad drive to a file and run fsck on the file and "mount -o loop".

//Anders

--------
PGP public key: https://tnonline.net/secure/pgp_key.txt

#2 lore raw

power loss -> corruption

In reply to Dirk Leber

I've had this problem for a while. Every time the system gets a power loss, all files that was recently written to gets garbage in them. (It seems to me like the wrong content gets in the wrong files.)

I assume it's not supposed to be that way.

Is this something known?

It happens with 2.4.19 and 2.4.20 kernel versions. Is there anything I can do to track down this issue?

Since it's every time, or at least close to every time...

I don't power down by breaking that power that often, so it hasn't disturbed me that much, but I lost an important file today so I guess I'm extra aggravated.

/Mirar

#3 lore raw

Re: power loss -> corruption

Am Donnerstag, 8. Mai 2003 13:18 schrieb Mirar:

Quoted 7 lines

I've had this problem for a while. Every time the system gets a power loss, all files that was recently written to gets garbage in them. (It seems to me like the wrong content gets in the wrong files.)

I assume it's not supposed to be that way.

Is this something known?

Maybe, if you have some more details.

Quoted 2 lines

It happens with 2.4.19 and 2.4.20 kernel versions. Is there anything I can do to track down this issue?

data-logging patches and mount option "data=ordered" solved similar problems for me.

Regards,
Dieter

#4 lore raw

Re: power loss -> corruption

Quoted 1 line

Maybe, if you have some more details.

How do I get the necessary details?

Quoted 2 lines

data-logging patches and mount option "data=ordered" solved similar problems for me.

Which patches? I'll add "data=ordered" to see if it'll help.

/Mirar

#5 lore raw

Re: power loss -> corruption

Am Donnerstag, 8. Mai 2003 14:06 schrieb Mirar:

Quoted 3 lines
Quoted 1 line

Maybe, if you have some more details.

How do I get the necessary details?

Maybe you can preset some corrupted file snippets?

-Dieter

#6 lore raw

Re: power loss -> corruption

Quoted 1 line

Maybe you can preset some corrupted file snippets?

I'll see if I can dig up any good.

But I can give examples, for instance .zsh-history with 65536 bytes of illicit data inserted in the middle - 65536 bytes of which 63898 comes from a gtk-gnutella file (downloads, I think) and the remaining 1638 is NUL characters. Both files were corrupted after restart, but gtk-gnutella ate it's file so I can't check how it looked.

Lots of things like that. The numbers are so even so I would figure that the wrong blocks get in the wrong files somehow.

/Mirar

#7 lore raw

Re: power loss -> corruption

Am Donnerstag, 8. Mai 2003 15:19 schrieb Mirar:

Quoted 3 lines
Quoted 1 line

Maybe you can preset some corrupted file snippets?

I'll see if I can dig up any good.

OK, I think it is not needed ;-)

Quoted 7 lines

But I can give examples, for instance .zsh-history with 65536 bytes of illicit data inserted in the middle - 65536 bytes of which 63898 comes from a gtk-gnutella file (downloads, I think) and the remaining 1638 is NUL characters. Both files were corrupted after restart, but gtk-gnutella ate it's file so I can't check how it looked. Lots of things like that. The numbers are so even so I would figure that the wrong blocks get in the wrong files somehow.

This _is_ very well known for me.
Some KDE config files and my tcsh history file where broken without data-logging (data=journal/ordered).

ReiserFS 3.5/3.6 offer metadata journaling.
For data journaling you _need_ data-logging.

See Chris latest announcement "new data logging patches available". ftp.suse.com/pub/people/mason/patches/data-logging/2.4.21

Regards,
Dieter

#8 lore raw

Re: power loss -> corruption

Quoted 3 lines

This _is_ very well known for me.
Some KDE config files and my tcsh history file where broken without data-logging (data=journal/ordered).

My .zsh-history just got nuked with data=ordered.

The kernel couldn't agree with my HPT controller and stopped all (!) IDE activities when I did a 'hdparm -y /dev/hd?' (all sleep). (Note, the .zsh-history was not on that controller.)

Not in the same way as previously (just a block), though. It was completely filled with binary data.

No other active files seems to have been affected, though.

/Mirar

#9 lore raw

Re: power loss -> corruption

Am Donnerstag, 15. Mai 2003 10:40 schrieb Mirar:

Quoted 9 lines
Quoted 3 lines

This _is_ very well known for me.
Some KDE config files and my tcsh history file where broken without data-logging (data=journal/ordered).

My .zsh-history just got nuked with data=ordered.

The kernel couldn't agree with my HPT controller and stopped all (!) IDE activities when I did a 'hdparm -y /dev/hd?' (all sleep). (Note, the .zsh-history was not on that controller.)

In short, DON'T DO THAT without "suspend kernel patches". *nix is NOT designed for "disk power management" in the first place. But it evolves...;-)

HPT ("small" IDE/ATA "RAID") controllers are not that good (supported) as they seems. Apart that they are "cheap".

Quoted 2 lines

Not in the same way as previously (just a block), though. It was completely filled with binary data.

Sounds like another problem (hardware, see above).

Quoted 1 line

No other active files seems to have been affected, though.

Good.

-Dieter

#10 lore raw

Re: power loss -> corruption

Quoted 3 lines

In short, DON'T DO THAT without "suspend kernel patches". *nix is NOT designed for "disk power management" in the first place. But it evolves...;-)

Never had a trouble with it before. :)

I have them regularly spin down using hdparm -S, and never had a problem before... This time I was tracking down a noise, which turned out to be air in the waterpump.

Quoted 2 lines

HPT ("small" IDE/ATA "RAID") controllers are not that good (supported) as they seems. Apart that they are "cheap".

Nope. It's always been a headache. Never behaved *this* bad though. I only have my spare data disks (80+120Gb) on it though.

Quoted 4 lines
Quoted 2 lines

Not in the same way as previously (just a block), though. It was completely filled with binary data.

Sounds like another problem (hardware, see above).

Not the same controller. The root/home disk is on the main IDE controller (whatever's on VIA KT266). So it seems like a sync issue of some sort.

/Mirar

#11 lore raw

Re: power loss -> corruption

In reply to Mirar

You have run into the disadvantage of meta-data journaling, which is that files that you are writing to may be corrupted if you crash. This disadvantage exists for performance reasons: using traditional journaling approaches such as V3 uses, if you journal the data you must write it twice. V3 also offers you the option of performing ordered writes, in which, if I remember right, metadata is only updated after the data reaches disk.

V4 uses a completely different technology we call wandering logs, in which every filesystem operation is performed as a fully atomic transaction, and because of its new design, there is very little performance cost (in fact, reiser4 is higher performance than V3). We hope V4 will be ready for prime time sometime this summer.

Signature · 1 line
Hans
#12 lore raw

Re: power loss -> corruption

Quoted 2 lines · Hans Reiser

You have run into the disadvantage of meta-data journaling, which is that files that you are writing to may be corrupted if you crash.

Hmm, I guess the main problem here is the atomicity?
I haven't studied traditional journaling very much. I somehow find it odd that the wrong block can get in the wrong files... shouldn't at least that be in the metadata?

(The only thing I know with journaling is an experiment of a low-level database that I wrote, with atomic transactions and safe-tolerance.)

Quoted 5 lines

This disadvantage exists for performance reasons: using traditional journaling approaches such as V3 uses, if you journal the data you must write it twice. V3 also offers you the option of performing ordered writes, in which, if I remember right, metadata is only updated after the data reaches disk.

Any performance loss or data risk with using ordered?

Quoted 5 lines

V4 uses a completely different technology we call wandering logs, in which every filesystem operation is performed as a fully atomic transaction, and because of its new design, there is very little performance cost (in fact, reiser4 is higher performance than V3). We hope V4 will be ready for prime time sometime this summer.

I think V4 sounds excellent, and I hope it will be incorporated in Linux 2.6/3.0. I assume there isn't any kernal patch for 2.4.20 around so I can play with it? I'm sorry if it has been mentioned on the list, I'm not up to date.

/Mirar

#13 lore raw

Re: power loss -> corruption

Quoted 10 lines · Mirar

I think V4 sounds excellent, and I hope it will be incorporated in Linux 2.6/3.0. I assume there isn't any kernal patch for 2.4.20 around so I can play with it? I'm sorry if it has been mentioned on the list, I'm not up to date.

/Mirar

Please wait until July, when we hope to have a beta-release.

Signature · 1 line
Hans
#14 lore raw

Re: power loss -> corruption

In reply to Mirar
Quoted 4 lines · Mirar

Hans Reiser <[email protected]> writes:

Quoted 9 lines
Quoted 4 lines

You have run into the disadvantage of meta-data journaling, which is that files that you are writing to may be corrupted if you crash.

Hmm, I guess the main problem here is the atomicity? I haven't studied traditional journaling very much. I somehow find it odd that the wrong block can get in the wrong files... shouldn't at
least that be in the metadata?

Hmm, the right block got into the file, but the contents of that right block never reached disk because of the crash, does that make it easier to understand the problem?;-)

Signature · 1 line
Hans
#15 lore raw

Re: power loss -> corruption

Quoted 3 lines

Hmm, the right block got into the file, but the contents of that right block never reached disk because of the crash, does that make it easier to understand the problem?;-)

Ah yes, that makes sense. :)

I would suggest that checksums could be used to see if the right blocks hit the disk when recapping the journal, but since V4 is on the way anyway...

/Mirar

#16 lore raw

RE: power loss -> corruption

In reply to Mirar

I have seen this as well. Recently accessed or edited files become corrupt when the system kernel panics and halts as well. For instance, I will edit /etc/inittab, a kernel panic occurs and when the system attempts to reboot it fails because the inittab contains unreadable garbage.

Bill

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Mirar
Sent: Thursday, May 08, 2003 7:19 AM
To: [email protected]
Subject: power loss -> corruption

I've had this problem for a while. Every time the system gets a power loss, all files that was recently written to gets garbage in them. (It seems to me like the wrong content gets in the wrong files.)

I assume it's not supposed to be that way.

Is this something known?

It happens with 2.4.19 and 2.4.20 kernel versions. Is there anything I can do to track down this issue?

Since it's every time, or at least close to every time...

I don't power down by breaking that power that often, so it hasn't disturbed me that much, but I lost an important file today so I guess I'm extra aggravated.

/Mirar