# Copying drives with errors, dd_rescue



## Niel (May 5, 2006)

I've recently been through the excercise of copying a failing Tivo drive to a replacement hard drive using dd_rescue. MFS tools and dd don't do well with a drive that has errors. dd_rescue was written for just this task (copying through the errors). dd_rescue runs under Linux.

I was successful, and the new drive works fine and all my recordings are still there. A couple recordings have a few dropouts, but the vast majority are perfect.

It took a lot of reading to get the procedure, and I'd like to pass on what I did.

There's a big thread on dd_rescue on this forum here:
http://www.tivocommunity.com/tivo-vb/showthread.php?postid=2165825#post2165825

and more on dd_rescue here:
http://archive2.tivocommunity.com/tivo-vb/showthread.php?threadid=149534

I'd like to add and update to these and pass on what I did. This works when you are copying to a drive that is the same size or larger. In the case of copying to a larger drive, there are ways to "bless" the new drive so Tivo will recognize the additional space, but I'll leave advice on this to others on this site.

Step 1. Download Knoppix. Knoppix is a flavor of Linux. It's a big iso file (700 MB) You can get it at the www.knoppix.net site. The file I downloaded was KNOPPIX_V4.0.2CD-2005-09-23-EN.iso

Step 2. Burn a CD from the ISO image you downloaded. Even though it looks too big to fit on a CD, it will fit on a 700 MB CD. There are some instructions on how to burn an ISO image on the Knoppix site at http://www.knoppix.net/wiki/Downloa...SO.3F_How_is_the_ISO_supposed_to_be_burned.3F

Step 3. Disconnect your Windows hard drives from your PC, and connect up the flaky Tivo drive as the primary master, and the replacement drive as primary slave. Set the jumpers accordingly. The reason to disconnect your Windows drives is to prevent any accidental writing to them, and also to make sure that Windows doesn't boot when the Tivo drives are connected (which can damage the Tivo drives).

Step 4. Insert the Knoppix CD in the drive and boot from the CD. You might have to set your bios to boot from CDROM.

Step 5. When you get to the boot prompt, type "knoppix 2 dma"<enter>. This will start Knoppix in command line mode and enable DMA on the drives, which will speed up the copying.

Step 6. As Knoppix is booting, verify that it found your old Tivo drive and is calling it hda, and that it found your new replacement drive and is calling it hdb. This is extremely important, because if you have it backwards, you could copy a blank drive over your Tivo drive, and you'd be sunk (you'd end up with two blank drives).

Step 7. At the command prompt, type cd /bin<enter>. That's cd space /bin and press the enter key. This is similar to the DOS change directory command.

Step 8 (optional). Type dd_rescue -h<enter>. This will display the usage of dd_rescue and explain the options.

Step 9. Again, make very sure that your old Tivo drive is showing up as hda and your new drive is showing up as hdb. Type 
dd_rescue -B 1b -b 2M -A -v /dev/hda /dev/hdb<enter>. That's dd_rescue space -B space 1b space -b space 2M space -A space -v space /dev/hda space /dev/hdb and press enter. Case (upper and lower case) matters here. The program will start copying the hda to hdb, at a very fast speed in the beginning, until it hits a bad spot on the drive, and it will slow to a crawl through the bad spots. The screen will blank after a few minutes, and to turn the screen back on, just hit the ALT key.

In my case, after it got past the bad spots, it got up to 4 MB/sec, but never got back the 30 MB/sec speed that it started at. It took about 12 hours to do the copy of the 120 GB with the 8000 errors encountered. Fortunately the errors were all in the recordings, and the errors just show up as random squares or dropouts in the picture or sound on a couple of programs.

I hope that this is useful to anyone with a failing Tivo drive.


----------



## Scott Stevens (Apr 12, 2000)

Thanks very much! I'm about to try doing a similar thing this weekend with my Series 1 DTiVo that failed, and this will be a big help.


----------



## tortio (Jan 31, 2002)

Yes, thanks, this is exactly what I needed. I am about to do my 250GB drives tonight. I did figure it would take arodun 24 hours and it looks based on what you said, that seems about right. 

Thanks again for the excellent write-up!


----------



## Pula (May 5, 2006)

Hello All

Im in the same situation...

My t800 recently failed(the drive..green screen)..And I was curious about this process discussed above...

The damaged drive is 80 gb(about 3/4 full) and Im considering purchasing a 250gb drive...to replace it...

If I use the above threads procedure to copy the bad drive...is that all that must be done..and I can just pop it back in the tivo and its good to go...from there...

or are there more steps before popping it back in to the tivo...

Also whats the deal about "blessing" the new drive..if I follow the above steps will I not get the maximized space on the new 250gb drive...

Thanks


----------



## tortio (Jan 31, 2002)

Yeah, you don't want to dd_rescue if you are going to a new larger drive. It may come down to that if your original drive is too far gone. 

If you are going from smaller to a larger drive, check out the stickies above from Weaknees regarding the mfsbackup | mfsrestore tutorials. That will probably be easier for you.


----------



## ronsch (Sep 7, 2001)

Pula said:


> Hello All
> 
> Im in the same situation...
> 
> ...


If this is the original stock 80gb drive that came with the TiVo and you've done no size updates you can use dd_rescue to copy to a 250gb drive and then use mfsadd to expand into the extra space. This is described in the standard Hinsdale Instructions. They speak about using dd but you should go ahead and use dd_rescue. The followup steps are the same. After you have your new 250gb drive completed, be sure to use the instructions to create a backup image.

The only drawback is not having the larger swap partition but odds are you won't need it.


----------



## Roadblock (Apr 5, 2006)

Thanks Niel, I just used this method to replace a failing 40GB drive with a new 120GB.

It cruised through 22GB of the dd_rescue at about 19MB/sec. Then it clicked and ground to a halt while it went through 500K of errors for about 15 minutes. After it got through that, though, it sped up again to 19MB/sec and finished the copy. The whole thing took about an hour. I expanded the partition to 120GB with mfsadd from the mfstools and it seems to be working fine. I don't know what was in that 500K. Maybe one of the recorded shows has a second of black screen now or something?

Anyway, it's working well so far. I checked a few recordings and they seem to be intact. Hopefully it will last! 

Edit: Also a minor correction to the original post for those who blindly follow, it's "knoppix 2 dma" with a lower-case k.


----------



## tortio (Jan 31, 2002)

I just wanted to report back that this worked perfectly. It took around 30 hours for my 250GB Seagate drives. Thanks for the write up. You saved me a ton of research trail and error.

Just a couple of things, on my Knoppix CD I had to use 'knoppix' in lower case to boot into command line mode and by hitting "Pause/Break" on the keyboard caused dd_rescue to terminate with signal 3. The screen blanked out and I just hit a key without knowing it would send a signal. After that, I would just hit an arrow key to wake the screen back up.

Thanks again!


----------



## Niel (May 5, 2006)

I went back and fixed the "Knoppix 2 dma" to say "knoppix 2 dma" in step 5 of the original post. Sorry about the error. I'm glad that the post was useful to everyone.


----------



## tortio (Jan 31, 2002)

No need to be sorry! If you were local to me I'd buy you a malty bevarage of your choice as a token of my appreciation. 

Thanks!


----------



## jshorr (Mar 29, 2005)

I am running it now and I see a lot of warning I/O errors flashing but, I take it that's normal?


----------



## tortio (Jan 31, 2002)

jshorr said:


> I am running it now and I see a lot of warning I/O errors flashing but, I take it that's normal?


Yes. That's dd reporting errors. You should also notice the KB transferred per second go down, too.

It's working, don't worry!


----------



## JohnTivo (Dec 2, 2002)

Nice write up on dd_rescue. I had a drive that was chirping and whoorling every 20 minutes or so for about a week. The unit finally froze up one afternoon. A reboot allowed the TIVO OS to return to "normal" operations, but it was only a matter of time before the drive fully failed.

I was able to dd rescue this drive and save all my recordings. Thanks!


----------



## jerrymc (Sep 17, 2001)

The may help those of you encountering a drive with *lots* of errors, especially ones that get worse as the drive heats up.

I recently had a drive fail in my HR10-250 right after the Season Finales week. This wasn't your average run of the mill freeze, or reboot loop. It was the "clunk...whirr...clunk..." sound of a seriously failing drive. I've had experience with dd_rescue many times before and I wasn't very optimistic this time. I pulled the drive, grabbed a spare good drive and popped them both in my RedHat 9 PC and fired up dd_rescue.

For the first hour or so, it went well with few errors, but as the drive heated up, the error rate increased drastically. I left it overnight and the next morning it looked (and sounded) pretty dismal. I killed the process and let it set for an hour to cool the drive, then restarted dd_rescue with different log file name. Same results the next morning.

I compared the log files and discovered that the second attempt got farther before encountering massive errors than the first! This suggested that the errors weren't on the disk surface itself, but rather in the controller circuitry. Checking the options with "*dd_rescue --help*" I found that you can specify the starting position of the copy both for source and destination drives. My solution was to start the copy and let it go until the error rate started to really climb, kill it, let it cool for an hour, and restart it at the position before the error increase. It worked like a charm and I was able to recover my drive and all my shows. A few had artifacts in the picture occasionally, but no major problems.

Here's what I did:

Step 1: Run dd_rescue as normal 

```
dd_rescue -B 1b -b 4M -A -v -l logfile1 /dev/hda /dev/hdd
```
Step 2: Check logfile1 to find the *ipos* field value before the errors start greatly increasing and add it as the start position in the next run. This is somewhat subjective and you shouldn't expect to exclude all errors. Here's an excerpt from my log file. The value in bold is used in the next dd_rescue command.


```
dd_rescue: (info): ipos:  12588821.0k, opos:  12588821.0k, xferd:  12588821.0k 
                *  errs:      2, errxfer:         1.0k, succxfer:  12588820.0k 
             +curr.rate:        1kB/s, avg.rate:    10004kB/s, avg.load: 33.3% 
dd_rescue: (warning): /dev/hda (12588821.0k): Input/output error! 
dd_rescue: (info): [B]ipos: 201662464.0k[/B], opos: 201662464.0k, xferd: 201662464.0k 
                   errs:      3, errxfer:         1.5k, succxfer: 201662462.5k 
             +curr.rate:     6356kB/s, avg.rate:    10512kB/s, avg.load: -9.0% 
dd_rescue: (info): ipos: 201662528.0k, opos: 201662528.0k, xferd: 201662528.0k 
                *  errs:      3, errxfer:         1.5k, succxfer: 201662526.5k 
             +curr.rate:        9kB/s, avg.rate:    10508kB/s, avg.load: -9.0% 
dd_rescue: (warning): /dev/hda (201662528.0k): Input/output error! 
dd_rescue: (info): ipos: 201662528.5k, opos: 201662528.5k, xferd: 201662528.5k 
                *  errs:      4, errxfer:         2.0k, succxfer: 201662526.5k 
             +curr.rate:        0kB/s, avg.rate:    10504kB/s, avg.load: -8.9% 
dd_rescue: (warning): /dev/hda (201662528.5k): Input/output error!
```
Step 3: Run dd_rescue with the new starting position 

```
dd_rescue [B]-s 201662464k[/B] -B 1b -b 4M -A -v -l logfile1 /dev/hdb /dev/hdc
```
(You can specify the output file position as well, but it's safer to let it default to the same as the input file position.)

Step 4: Repeat steps 2 and three until done

*IMPORTANT: This works with dd_rescue version 1.11 which I installed on my RedHat 9 Linux PC. The version of dd_rescue on the PTVUpgrade CD is v0.6 and the options are different. If you want or need to use the PTVUpgrade CD and its version 0.6 dd_rescue, you need to change the commands above to the following: 
* 

```
dd_rescue -b 4M -A -v /dev/hda /dev/hdd 
and 
dd_rescue [B]-i 201662464k[/B] -b 4M -A -v /dev/hda /dev/hdd
```
Note that this version has no -B option or logging option. You'll either have to check the screen to estimate the new ipos value for the next run, or use UNIX commands to redirect (or tee) the output to a file.

Remember to substitute your own drive locations for the ones in my examples. And if all else fails, check *dd_rescue --help* to get a description of the options available.

Regards, 
Jerry


----------



## kdmorse (Jan 29, 2001)

I had a very similar problem once - just thought I'd toss in my solution. I was having very poor luck copying the drive bits at a time, so in order to keep it happy - I put it in the fridge. 

And by that, I mean I put the computer, drive and all, in the bottom of the fridge to keep it cool. (Removed the lettuce trays). I tried to put just the drive in the fridge, but the IDE cable wasn't long enough, so in went the whole thing. (There's even photo's floating around somewhere).

And wouldn't you know it - it copied first try, full speed, with zero errors. And in case anyone is wondering - heat output of standard computer > cooling capacity of standard fridge. In the end I had a perfectly copied drive, and warm soda...

-Ken


----------



## rocketman74 (Dec 7, 2006)

Not even sure if this thread is still being checked... but...

I would like to send a BIG THANK YOU out to Niel and the others who have posted in this thread as well as the other threads mentioned above. While I didn't have a failing drive, I had an itch to replace the stock drive in my HR10-250 with something larger since I've been recording so much HD recently. I found a 400GB drive on sale recently for a price I couldn't refuse.

I have scoured this and other sites for hours on end searching for a good way to copy my current drive (including recordings) to my new drive. I started by using a simple dd to copy (took too long and there was no status) and also tried the MFSBackup tool. My other attempt was to download another backup tool, but due to DMA driver issues with my motherboard, the copy was apparently going to take 43 hours to do, and I don't have that kind of time to be down without my DVR.

With that said, I downloaded Knoppix as mentioned above, ran dd_rescue with the specified parameters, and voila! My drive copied in about 2 hours and 5 minutes, and I'm in business with the new drive. I've literally spent days on this copy trying to get it going with the other tools.

Many, many thanks to Niel and everyone else. Your work is much appreciated. If you ever get to the Dallas, TX area, let me know, and I will gladly purchase you a few beverages of your choice!

Rocketman74


----------



## coldtoes (May 29, 2002)

kdmorse said:


> I had a very similar problem once - just thought I'd toss in my solution. I was having very poor luck copying the drive bits at a time, so in order to keep it happy - I put it in the fridge.
> 
> And by that, I mean I put the computer, drive and all, in the bottom of the fridge to keep it cool. (Removed the lettuce trays). I tried to put just the drive in the fridge, but the IDE cable wasn't long enough, so in went the whole thing. (There's even photo's floating around somewhere).


This is a great suggestion! I have a dual-drive S2 that developed the click of death. Since I don't know which drive is bad, I've got them both in the freezer. But I know how slow dd_rescue is, so it would be great to keep the drive cool during the whole procedure - that might give me a better chance of recovery. I can't afford to devote my refrigerator to hard drive cooling, but I'm thinking maybe I can rig up some kind of external cooler with ice packs. Hmmm...


----------



## coldtoes (May 29, 2002)

OK, my husband has come up with the perfect solution - put the computer on the window sill, stick the drive out the window, close the window most of the way but not so much as to crimp the IDE cable, and plug the holes with a towel. Just have to remember to check the forecast for snow first!

Aah, I knew the climate causing those cold toes would come in handy one day!


----------



## BlankMan (Mar 30, 2002)

Niel, nice job documenting the procedure. I never was one for writing documentation. To this day when ever someone asks me where the documentation is for something I've coded I tell them it's executing.


----------



## Shaun P. (Feb 3, 2007)

Niel, and everyone else who's posted helpful info in this thread, I just have to say THANK YOU! My DirecTivo's original drive started going about 4 months ago, and until I found your thread and ran DD rescue, exactly like you described, nothing I did got it back. My wife is so happy that we don't have to deal with DirecTV's R15 piece of garbage any more, and that she doesn't have to worry about whether "Men in Trees" recorded or not.

Thanks again!


----------



## amathack (Sep 23, 2005)

I used the *dd* and *dd_rescue* to copy a 40gig tivo drive to a 160gig drive. I used ptvlba48-4.04.iso.

It took 5+ hours using *dd* without any output letting me know what was happening. Everything seem to be fine and mfsadd the extra space. Once back into the tivo, I got the Grey Screen of Death. It did not seem to copy correctly

I used *dd_rescue* the second time since I can see the progress. It was slow as well so I did a little research on the net for a way to speed this up.

I found *hdparm* and it "greatly" increased the time for copying.

I enable dma and 32-bit w/ sync *(hdparm -c3 -d1 /dev/hda)* and transfer time when from kilobytes per second to megabytes per second.


----------



## tivoboy (Jan 14, 2002)

I think this is the route I am going to have to go, does anyone know how to do it with a POOR A drive, AND a functioning B drive? I'd like to ulitmatly, use DD_rescue to get the info off the A drive and also get the recordings off the B drive, having just ONE larger drive as the final output.


----------



## ciper (Nov 4, 2004)

Combining an A+B drive into a single larger drive while preserving recordings is not currently possibly but I think Spike from MFSLive is working on something?

Also have you considered using DDRHelp instead of pure DD_Rescue?


----------



## tivoboy (Jan 14, 2002)

no, where is ddrhelp? IS that on the knopix cd?


----------



## tivoboy (Jan 14, 2002)

Would this process allow me to upgrade the A drive, to a larger drive and still have the B drive married to the A "copy". What about expanding the capacity of the A drive if I move it up to say a 120gb drive from the 40GB stock drive. How does one increase the visible space to tivo? Is that the mfsadd?

Thanks for the help, I need to get the A repaired and back up and running again.


----------



## tivoboy (Jan 14, 2002)

Should there be any initial feedback with the dd_rescue program. I typed everything in correctly, it just immediatly goes to a 

dd_rescue: (info) about to transfer 0.0 bytes from /dev/hda to /dev/hdb
blah blah
starting position: in 0.0k, out 0.0k

ect.

doesn't look like it is running anything, there is no direct feedback?

Is it running?
both drives showed up fine


okay, wait a minute, some errors are popping up? Does one need to attend this process? Click continue in any way?
thanks for any prompt feedback, patient is ON THE TABLE


----------



## tivoboy (Jan 14, 2002)

wow, no sooner does the one drive seem to fail from the SD DTIVO, but now over the past two days using my HDTIVO, it has rebooted now four times. I don't think it has done that in months.

Can power OUTAGES just take out the devices so easily? I mean, this was on a UPS and SURGE, and granted the UPS ended up running out of power but it shouldn't just KILL TWO UNITS


on a SIDE note the COPY using dd_rescue seems to be taking a LONG time. I am now on hour five, for a 40GB to 120GB transfer, and we are at error 600, and 4867851K but then it just jumped to 122222464K

does that mean I am 4GB in, or 40GB in?


----------



## tivoboy (Jan 14, 2002)

Well, the deed is done. I have I THINK sucessfully copied the 40GB A drive to a new 120GB A drive. It took about 15 hours, which sounds like a HECK of a lot for this type of transfer. 660 errors found, 41xxxK copied.

So, I have hooked it up, as the A drive with my previous functioning B drive in there, put the A on the end of the IDE cable and put the pins as MASTER. Put the B on the middle of the IDE cable and set as SLAVE with MASTER present.

And, the system now goes to Powering up, Powering up, REBOOT, Powering up, Powering up, REBOOT.

Continues to be in this reboot loop. Any thoughts, previously with the BAD A drive, it was just stuck at powering up. now, it is in a REBOOT loop.

Any thoughts or help would be appreciated.

Otherwise, what? Get a disk image to start with a new drive? Just go back to ground zero? I guess I could go that route.


----------

