Skip to contentSkip to conversation

Drive failure

linux-lvm Ewen McNeill 3 participants 4 messages May 15, 2003 – May 18, 2003 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 9 lines · B. J. Zolp
Quoted 4 lines · Ewen McNeill

- make sure you do the dd with an option to replace unreadable sectors with blank sectors (otherwise nothing will be written out for the unreadable sectors, causing everything to be "out of alignment" after the first bad block)

I plan on using the noerror switch for dd, what else would I need to use to make sure it replaces with blank sectors. I could not find anything in info dd or man dd.

The option I was thinking of is conv=noerror,sync

The "noerror" is "continue reading after read errors", and the "sync" is "pad each input block with zero bytes to block size". Possibly GNU dd is better behaved, but my recollection is that at least some "dd"s will happily skip over blocks they can't read given "conv=noerror" (by assuming they just read 0 bytes that time), but result in effectively fewer blocks written out than read in, effectively shuffling everything after the blocks with errors down a bit. This is, suffice to say, a bad thing to have happen to your file system.

You might want to practice a little with copying from the disk into some temporary location (eg outputting to /dev/null will do for this purpose), and watch the "input blocks" and "output blocks" counts that are reported -- if they're not the same, you're going to have a problem.

Ewen

#2 lore raw
Quoted 22 lines · Ewen McNeill
Quoted 9 lines · B. J. Zolp
Quoted 4 lines · Ewen McNeill

- make sure you do the dd with an option to replace unreadable sectors with blank sectors (otherwise nothing will be written out for the unreadable sectors, causing everything to be "out of alignment" after the first bad block)

I plan on using the noerror switch for dd, what else would I need to use to make sure it replaces with blank sectors. I could not find anything in info dd or man dd.

The option I was thinking of is conv=noerror,sync

The "noerror" is "continue reading after read errors", and the "sync" is "pad each input block with zero bytes to block size". Possibly GNU dd is better behaved, but my recollection is that at least some "dd"s will happily skip over blocks they can't read given "conv=noerror" (by assuming they just read 0 bytes that time), but result in effectively fewer blocks written out than read in, effectively shuffling everything after the blocks with errors down a bit. This is, suffice to say, a bad thing to have happen to your file system.

Quoted 4 lines

You might want to practice a little with copying from the disk into some temporary location (eg outputting to /dev/null will do for this purpose), and watch the "input blocks" and "output blocks" counts that are reported -- if they're not the same, you're going to have a problem.

I'm doing a
dd bs=512 conv=noerror,sync if=/dev/hdf of=/dev/null
right now. It has been going for a few hours, but does not seem to be taking up any cpu cycles (it looks hung up). I will let it go over night and see how it is tomorrow. What would you suggest I do if the I can only get the data on the HD up until the bad sector (or where ever it is hung up). This is the last drive in the logical volume, so there was not too much data on it, but how would I go about added the new replacement drive to the logical volume without messing up my entire filesystem?

Thanks again.

bjz

Quoted 8 lines

Ewen

_______________________________________________
linux-lvm mailing list
[email protected]
http://lists.sistina.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#4 lore raw
In reply to a message not in the archive
Quoted 4 lines · B. J. Zolp

I'm doing a
dd bs=512 conv=noerror,sync if=/dev/hdf of=/dev/null
right now. It has been going for a few hours, but does not seem to be taking up any cpu cycles (it looks hung up).

I suspect that it will "hang" several times during the process, especially if you have IDE disks, each time it encounters a bad block (IDE is somewhat more prone to this as the IDE code seems to retry the read more times, and to not get quite the same degree of error reporting as the SCSI code does -- eg, to distinguish how fatal the problem is).

Watching the kernel log output (eg, dmesg) will probably give you some insight into what is going on.

Also with bs=512 it will be a very slow copy at the best of times.

Quoted 2 lines

What would you suggest I do if the I can only get the data on the HD up until the bad sector (or where ever it is hung up).

With some care you can skip over the bad sectors another way; look at the "skip=" argument. I've recovered data from bad floppies in the past by DDing each of the readable chunks out, making up padding blocks of the right size, and joining it all together.

Again you've got to be careful that the blocks you read off go back onto the new disk in the same position as they came off the old disk.

Quoted 3 lines

This is the last drive in the logical volume, so there was not too much data on it, but how would I go about added the new replacement drive to the logical volume without messing up my entire filesystem?

Pass. This is almost certainly file system specific, and even then I don't know how well any common Linux file system would cope with loosing whole chunks of the file system. (I also don't know the right LVM magic to substitute in another -- blank or mostly blank -- disk in place of the broken one.)

Ewen

#3 lore raw
In reply to B. J. Zolp
Quoted 9 lines · B. J. Zolp

I'm doing a
dd bs=512 conv=noerror,sync if=/dev/hdf of=/dev/null
right now. It has been going for a few hours, but does not seem to be taking up any cpu cycles (it looks hung up). I will let it go over night and see how it is tomorrow. What would you suggest I do if the I can only get the data on the HD up until the bad sector (or where ever it is hung up). This is the last drive in the logical volume, so there was not too much data on it, but how would I go about added the new replacement drive to the logical volume without messing up my entire filesystem?

You could also try dd_rescue(1), which was written, AFAIR, by Kurt Garloff. You should find it using Google.

urs