mini HOWTO: ReiserFS recovery suggestions (bad bread)
ReiserFS is a general-purpose, journaled computer file system that usually only shows up on *nix systems. A journaling file system basically records what it’s about to do in a journal before doing it, such that if power is lost during the operation, after it’s restored, the file system can recover itself. It’s suppose to be “fault tolerant”, but after a recent wind storm and the accompanying power outage, I found that one of the partitions on my hard drive would not mount. The root partition was kinda sorta flaky too, sometimes mounting, sometimes not.
Searching teh intarwebs, I came across the this great little post. Using that and a tool called dd_rescue, I was able to get most of my data back. Because I think I can add a bit better explanation, I’ve decided to write up the steps.
Got the same problem I had? Here’s how to check.
1. Boot using a copy of Knoppix live CD.
2. Be root.
3. With the drive unmounted, run reiserfsck –check partition
# reiserfsck --check /dev/hda3
If you get something back like:
bread: Cannot read the block (8210): (Input/output error).
Well, then you have what I had. I’d advise you to write off the entire drive as a loss. I would be afraid of trusting it any longer. Of course, you likely want to pull the data off first, unless you have been smart about backups.
So I went and got a new drive. Although my motherboard supports SATA drives, Knoppix out of the box does not. I ended up going back to the store for a second drive that takes EIDE (also PATA, or parallel ATA) The message I linked to seems to imply you can use any type of storage system you can write to, but I created a new ReiserFS partition.
Standard industry practice is to put CD and DVD burners on one EIDE cable, and any hard drives on another. This is so data transfer is sped up during CD burning. In my case is was a mistake. With both drives on the same EIDE cable, I had to write a block of data to RAM, and stop, and send that same data back down the cable to the second drive. It would have been much faster if I had the CD-ROM and the new drive on one cable and the dead drive on another. That way data could stream up one cable and down another.
It seems that Knoppix does not enable DMA acceleration (misspelled as “acelleration” on the menu) by default. You probably want to enable this, although there seems to be a few bad mothers out there that can’t handle it. I did not, and recovery took 3 fracking days. Enable this by K Menu::KNOPPIX::Utilities::Harddisk/CD/DVD/ DMA acelleration
Step by step, on how I did it (or, knowing now how I should have done things.)
1. Get a new hard drive that’s at least as big as the trashed partition you are trying to recover. Install on a different EIDE cable as the bad drive if at all possible.
2. Boot Knoppix (I used 5.1.1 EN)
3. Assign yourself a root password using K Menu::KNOPPIX::Set password for root
4. Using K Menu::System::GNOME partition editor create a partition on your new drive at least as large as the one you are trying to recover. Just to be sure, I made mine a few MB larger.
5. Enable DMA acceleration.
6. Open a Konsole, be root.
7. With both source and recovery partitions unmounted, type:
# dd_rescue -A /dev/hda3 /dev/hdb2
Where “#” is the root prompt (that you don’t type), the -A option inserts zeros when the source could not read a block. Replace /dev/hda3 with your bad partition and /dev/hdb2 with your new partition.
8. You could use nice or renice to speed things up a bit if you want. If you are not familiar with how they work read the man pages.
9. After dd_rescue makes an exact bit-for-bit copy of whatever it can read, you need to fsck the new copy. the frontend fsck told me to run reiserfsck --rebuild-tree.
# reiserfsck --rebuild-tree /dev/hdb2
10. Mount the recovered file system and make a backup of the critical content.
Thank you rvalles. Thank you Kurt Garloff
Standard Mischief Says :
Should add here that Knoppix does support these drives, but it is not autodetected on my hardware. Ubuntu found and configured the drive just fine, although I was having a hard time repeating the operation this morning. It’s likely a “my hardware” issue.
2007-04-27 09:55 Permalink