1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to revive a fried drive with dd_rescue

Discussion in 'TiVo Underground' started by PortlandPaw, Aug 16, 2004.

  1. Aug 16, 2004 #1 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    {Please see the update of this post here.}

    I had to do a considerable amount of searching and expermentation to get dd_rescue to work, so I thought it would be worth a "how-to" thread.

    dd_rescue has the ability to copy almost everything off a damaged hard drive relatively quickly. There is a helper utility (dd_rhelp) to assist in the process, but I haven't tried that yet. Hope I don't have to. dd_rescue requires a linux platform. Being a non-linux person (I know, I'm thinking of converting) I tried with a couple of the standard CD boot disks (Jenkins, Keegan) but they didn't possess the necessary libraries. So I decided to do it with a Knoppix boot.

    So here are the steps:
    1. Download the Knoppix ISO and burn a CD from it. Available from here.

    2. Download the .tar.gz file of dd_rescue from here and save it to a floppy in your A:\ drive.

    3. Leave the floppy in A:\ and set your computer to boot from the CD drive. Configure your hard drives appropriately. Be very careful to never boot into Windows with TiVo drives attached! Boot only into the Knoppix CD.

    4. When the welcome screen comes on, enter "knoppix 2 dma" at the bottom and hit enter. This bypasses all the graphics, enables access to the devices (which I couldn't do under the GUI), and enables DMA on all drives. Very important for speed.

    5. Enter "cd /mnt/floppy" and "tar =xwzf dd_rescue-0.2.tar.gz."

    6. Enter "cd dd_rescue"

    7. Enter "dd_rescue -A -v /dev/hd{old} /dev/hd{new}. For the truly uninitiated:
    /dev/hda is Primary Master drive
    /dev/hdb is Primary Slave drive
    /dev/hdc is Secondary Master drive
    /dev/hdd is Secondary Slave drive

    That's it. The copying should go very quickly until it hits a bad sector and then it will slow down to take smaller chunks of data. People have reported very good results with this technique. When I replaced a pair of Maxtor 120s with new Seagates (at $49 each after rebates at Best Buy -- my good luck for the week), dd_rescue got up to about 115 gig when it reported there was no more room on the target drive. Scared me, but apparently didn't hurt the process, as the TiVo booted up normally. {later edit -- turned out this was a problem -- the geometry of the drives should be identical (or at least the target drive larger) or TiVo is going to have trouble finding blocks of data} Of course, it re-booted after three minutes, just as it did before I replaced the drives, so I did all this for nothing. At least I learned how to mirror my drives.

    BlankMan has done quite a bit of research into the intricacies of dd_rescue and they may be found here. Information about dd_rhelp is also in this thread and here.

    Hope this helps people save their favorite Olympic moments!
     
  2. Aug 16, 2004 #2 of 109
    Robert S

    Robert S New Member

    9,725
    0
    Jul 8, 2002
    Cambridgeshi...
    Isn't dd_rescue already on the Knoppix CD?

    Knoppix is a very big download (although it's a very easy way to get some Linux experience - it doesn't involve modifying your PC by installing stuff on the hard drive, everything runs from the CD). There are a lot of 'live' Linux boot CD's, many of which are much smaller than Knoppix.

    I don't know which ones have dd_rescue, but I suspect at least some of the discs in the 'rescue' category will have it.

    A bit more research reveals it's definitely on RIP, which is a 25Mb download.
     
  3. Aug 17, 2004 #3 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    I looked for dd_rescue on my knoppix distro and if it's there, I couldn't find it. I played around last night with creating a floppy boot disk on which I could put dd_rescue, but the results were lacking. I'm sure improvements can be made to my method but, in my case, it was "get the job done!"

    Thank you, Robert S, I found RIP and will investigate how that works and report back here. I'd rather be ready the next time instead of thrashing about.
     
  4. Aug 17, 2004 #4 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    {This is an updated version of my first post to indicate a more efficient way to do this}

    I had to do a considerable amount of searching and expermentation to get dd_rescue to work, so I thought it would be worth a "how-to" thread.

    dd_rescue has the ability to copy almost everything off a damaged hard drive relatively quickly. There is a helper utility (dd_rhelp) to assist in the process, but I haven't tried that yet. Hope I don't have to. dd_rescue requires a linux platform. Being a non-linux person (I know, I'm thinking of converting) I tried with a couple of the standard CD boot disks (Jenkins, Keegan) but they didn't possess the necessary libraries. So on the advice of Robert S, I used the RIP (Rescue is Possible) CD.

    So here are the steps:
    1. Download the RIP ISO (currently named RIP-10.3.iso.bin) and burn a CD from it. Available from here. {EDIT (1/5/05) I'm told that this is now obsolete as most distributions of Knoppix have dd_rescue}

    2. Set your computer to boot from the CD drive. Configure your hard drives appropriately. Be very careful to never boot into Windows with TiVo drives attached! Boot only into the RIP CD.

    3. When the welcome screen comes on, select "Boot Linux rescue system [skip keymap prompt]" then login as "root."

    4. Enter "cd /usr/bin"

    5. Enter "dd_rescue -B 1b -b 2M -A -v -l /var/dd_rescue.log /dev/hd{old} /dev/hd{new} ." For the truly uninitiated:
    /dev/hda is Primary Master drive
    /dev/hdb is Primary Slave drive
    /dev/hdc is Secondary Master drive
    /dev/hdd is Secondary Slave drive

    6. The log file should be gzip'd and copied to a floppy before rebooting, as the /var directory will go away.

    That's it. The copying should go very quickly until it hits a bad sector and then it will slow down to take smaller chunks of data. People have reported very good results with this technique. When I used it dd_rescue got up to about 115 gig when it reported there was no more room on the target drive. Scared me, but apparently didn't hurt the process, as the TiVo booted up normally. {later edit -- turned out this was a problem -- the geometry of the drives should be identical (or at least the target drive larger) or TiVo is going to have trouble finding blocks of data}

    BlankMan has done quite a bit of research into the intricacies of dd_rescue and they may be found here. Information about dd_rhelp is also in this thread and here.
     
  5. Aug 17, 2004 #5 of 109
    BlankMan

    BlankMan I'm the Kettle

    2,142
    0
    Mar 30, 2002
    WI
    You've excluded the use of one of the very important features of dd_rescue which allows it to copy data faster and that is the use of the -b and -B parameters.

    Although -B has a default of 512 which is what you want so leaving it out is ok (I'm not one that relies on default values and always includes them in the command line because a new release can change them while you're thinking they remain the same, hate surprises like that), but -b defaults to 16384 which is too small. Setting it to 2M utilizes the cache on most hard disk thus improving performance. Setting it higher then 2M, say 4M, caused problems in some instances so 2M is a pretty safe bet.

    BTW Good job.

    <Added>

    P.S. I like log files too and you left that parameter out. ;)
     
  6. Aug 18, 2004 #6 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    Thank you for the info especially on the -b parameter. Remember that I'm booting from a CD in a Windows box with an NTFS drive (I probably didn't mention that) -- how could I write to a log file under those conditions?
     
  7. Aug 18, 2004 #7 of 109
    BlankMan

    BlankMan I'm the Kettle

    2,142
    0
    Mar 30, 2002
    WI
    To /var or someplace that has room then gzip it and put it on a floppy before you reboot and its gone.

    <Added>

    I should mention, even though you are booted from a CD and maybe think you cannot write because a CD is read only, you are not running off the CD like you do when you normally boot off a disk in Windoze or Linux. You are actually running off a pseudo disk (for lack of a better term) that is actually a memory disk and acts, for all practical purposes like a real disk, except for the fact, Poof! Gone! when you reboot. If you knew this, excuse me.
     
  8. Aug 19, 2004 #8 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    No, I didn't know that. Actually, I should have, because I've noticed the creation of a ramdisk during bootup and I've been able to create mount points in /mnt, which obviously would have been impossible otherwise. Thanks, I'm always learning. That's what makes this fun.
     
  9. Aug 22, 2004 #9 of 109
    BlankMan

    BlankMan I'm the Kettle

    2,142
    0
    Mar 30, 2002
    WI
    If the intent of this is to be a HowTo you might want to add the -B and -b parameters to the OP. If you don't use the -b you are not getting the full advantage of using dd_rescue.
     
  10. Aug 23, 2004 #10 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    Right you are. I'll edit the earlier post.
     
  11. Aug 23, 2004 #11 of 109
    BlankMan

    BlankMan I'm the Kettle

    2,142
    0
    Mar 30, 2002
    WI
    I noticed you put 4M in the example, did you use 4M and did it work? I mentioned that 2M was a safer bet, I had some segmentation fault problems with dd_rescue when attempting to use 4M.

    Also, if the drive only has a 2M cache and you request a 4M read you're going to be waiting on the disk.

    So all in all 2M is a better recommendation for general usage, power users that understand UNIX/Linux, dd_rescue, and know the size of the cache on the source and destination drives can adjust it as they see fit.

    And I noticed you updated it in the 4th post and not the first, I know you reference the 4th post in the 1st but chances are people in a hurry may miss the difference(s).
     
  12. Aug 23, 2004 #12 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    My mistake on the 4M -- I meant 2M. I left the first post the way it was for the sake of documenting Knoppix with the hope that someone with this problem would have the persistence to read the referenced post as well. Thanks for the catch.
     
  13. Aug 24, 2004 #13 of 109
    BlankMan

    BlankMan I'm the Kettle

    2,142
    0
    Mar 30, 2002
    WI
    Betcha didn't think HowTo's would be so much fun eh? ;)
     
  14. Sep 2, 2004 #14 of 109
    patyous

    patyous New Member

    2
    0
    Apr 25, 2002
    How long is this process suppossed to take? Mine has been going for 2 days so far on a 120 gig hd?
     
  15. Sep 2, 2004 #15 of 109
    PortlandPaw

    PortlandPaw Woodstock-era Hacker

    1,057
    0
    Jan 11, 2004
    Chebeague...
    I'd say your patience exceeds your success.
     
  16. Sep 2, 2004 #16 of 109
    drdarren

    drdarren New Member

    60
    0
    May 15, 2004
    Boca Raton, FL
    i tried following the commands listed but when i reach the end of the line, instead of going to the next line, it begins to overright the original line. as i am new to linux, what should i be doing to go to the next line.
     
  17. Sep 15, 2004 #17 of 109
    SparkleMotion

    SparkleMotion New Member

    20,816
    0
    Feb 2, 2004
    Alive at...
    How vital are the log files? I don't have a working floppy drive in my box...can I save to a FAT32-formatted thumb drive?
     
  18. Sep 15, 2004 #18 of 109
    Robert S

    Robert S New Member

    9,725
    0
    Jul 8, 2002
    Cambridgeshi...
    drdarren: It sounds like your console isn't set up quite right. It's just an aesthetic problem, though - the command is being accepted correct. (You can try pressing Ctrl-L to clear the screen).

    SM: The log files aren't a vital part of the copy process, they just tell you what happened. The only real test is when the copied drive goes into the TiVo.

    Knoppix has pretty good USB support, so you may well be able to access a USB drive. I've no idea which device node you'd mount, though.

    If you write the log file to somewhere in one of the RAM drives (/tmp or /var/tmp), you can review the log with more or vi before you switch off the machine.
     
  19. Oct 6, 2004 #19 of 109
    tivoupgrade

    tivoupgrade Sponsor

    2,494
    0
    Sep 27, 2000
    Chicago, IL...
    Folks,

    At the suggestion of Robert S, I've looked into, and made an attempt, to incorporate dd_rescue and dd_rhelp. Not as trivial as it initially seemed, there were a bunch of libraries that appeared to be missing.

    In any case, I think I've identified and located the missing libraries, and dd_* binaries and incorporated them into a test version of the CD discussed here but before I release it to the general public, those who play with these tools, please give things a test and let me know what is broken, and hopefully what needs to be done to fix it.

    Thanks!

    Lou

    PTVupgrade LBA48 3.01 (beta) here
     
  20. Oct 7, 2004 #20 of 109
    lawnmowerdeth

    lawnmowerdeth Drunk

    99
    0
    Jan 11, 2003
    MO
    Hi,
    At the request of tivoupgrade, I'm posting this here.
    I'm trying to rescue an HDVR2 drive with the beta CD of PTVupgrade, and I'm having some problems with dd_rescue.
    I can't use the -B switch or the -A switch (unknown command error), and -b 2M gives a segmentation fault. Basically I am only able to use:
    dd_rescue -v /dev/hda /dev/hdb.
    I'm trying it with dd_rescue -v -b 2048 /dev/hda /dev/hdb, hopefully that will increase the speed a bit. (Is that the same as -b 2M?)

    Anyway, fingers crossed that this will save the drive. Hopefully tomorrow afternoon sometime I'll be able to post results.

    Sean
     

Share This Page