Copy the good part of a damaged file?

Discussion in 'macOS' started by motulist, May 19, 2006.

  1. motulist macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #1
    I have a bad cd with a damaged file on it. When I try to copy it to my hard disk it gets half way, reports an error and then NONE of the file is on my hard disk. I want the portions that are readable on the cd copied over regardless. How do I do this?
     
  2. yippy macrumors 68020

    yippy

    Joined:
    Mar 14, 2004
    Location:
    Chicago, IL
    #2
    The only chance would be with some of the developer tools but I don't know anything about using them.

    That said. I have a question. Why? Half of a file is not going to do you any good, you can't open half of a text file and get text, nor can half of a movie file play half of a movie. Files are all or nothing and I highly doubt it is possible to extract any useful information from it.
     
  3. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #3
    I have par files to rebuild it. There must be some Unix command I can use from the terminal because clearly the OS is copying part of it just fine until it reaches the damage.
     
  4. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #4
    I may have found a unix command that'll do it, but for the life of me I can never understand unix command documentation. If anyone else is more unix literate maybe they could tell me if the following command would copy the undamaged portions and then tell me in english how I should do it.

    http://linux.about.com/library/cmd/blcmdl1_pax.htm

    EDIT: On further deciphering it turns out that that command will not do it. C'mon, someone out there must know a way to do this!

    EDIT: The unix command dd looked hopeful, but if I'm understanding the documentation correctly it now seems like that ain't it either.
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    You are on the correct track. I think dd might be able to help you.

    If we assume you CD is mounted at /Volumes/cd (you will have to work out what it is really mounted as but that should not be hard) and you want to get the file called myfile.txt from the CD then

    Code:
    dd if /Volumes/cd/myfile.txt of ~/Desktop/recovered.txt conv=noerror
    should copy the file to recovered.txt on your desktop ignoring errors.

    Note I have not tried this!
     
  6. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    I have on linux and Windows and under some conditions it'll take forever to detect that there was an error and move on. You may be better off trying "bs=1024 count=10240" and to guess the number of KB before the error (10 in the example above).

    B
     
  7. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #7
    Okay, I'm gonna give this a try, but before I do I need to know what I should be cautious about. Is there anyway that if I use this incorrectly it could mess something up? For instance, will it overwrite anything on the destination hard disk without a warning?
     
  8. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #8
    Depending on the size of the input it could fill your harddrive but the obly file it should touch is the one specified via "of".
     
  9. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #9
    Okay, cool, it's copying something right now as I write this. The if and of terms need equal signs, but other than that it was right. I'll let you know if it worked or not.
     
  10. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #10
    IT WORKED!!!!!! :D :D :D robbieduncan and balamw, you guys are the BEST! :D :) :D :) I copied the good part of the files and then used par2 files to rebuild the original files and now I have the originals back bit for bit! :D
     
  11. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  12. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #12
    Yeah, if I had any reservations in the back of my mind about whether the OS 9 to Unix OS X move was a good one, the last of those thoughts have just been laid to rest. :)
     
  13. CanadaRAM macrumors G5

    CanadaRAM

    Joined:
    Oct 11, 2004
    Location:
    On the Left Coast - Victoria BC Canada
    #13
    Actually, you can recover half a text file and even half a graphics file. It depends on the file format.

    Edit -- OK, success, good.

    Back in the days of yore, we did this with Norton Disk Editor and some tools by Central Point. Other workarounds depending on the file type are to index the file with a text search tool, then copy from the cached search index, or to Import the file into a database or another text handling program. You'll lose formatting but you may be able to recover text.
     
  14. yippy macrumors 68020

    yippy

    Joined:
    Mar 14, 2004
    Location:
    Chicago, IL
    #14
    Wow, you learn something every day. Didn't know you could use half broken files.

    I don't quite understand what these par files are or how they work but I will probably never even see them so it doesn't matter.
     
  15. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #15
    PAR = parity archive http://parchive.sourceforge.net/

    Essentially software based RAID5. If you have enough of your data remaining and the parity files you can recover the missing pieces regardless of what you lost.

    B
     
  16. motulist thread starter macrumors 68040

    motulist

    Joined:
    Dec 2, 2003
    #16
    You definitely can used damaged files. For instance, a damaged jpeg will display properly from the top of the picture downward until it reaches the missing or corrupted data and then it displays all kinds of warped weirdness, but it does still work where the data is intact from the beginning.

    Here's some additional info about Par2. Par files were originally created for sending binaries over usenet where random data loss is almost inevitable. With Par2 you can reconstruct the original file no matter where the data loss occurred, be it the beginning of the file, the middle or the end. However, par2 is so useful that its use has extended beyond usenet. People (like me) are starting to use it on any data they care about. For instance, the way I used it here was putting par2 files on a cd that I use in my mp3 cd player because the disk is going to see some serious abuse. Then when I want to transfer the mp3s off of the cd and back to my computer, no matter where the damage happens to occur on the cd I can reconstruct the original undamaged mp3 files as long as I have enough par2 data to fill in the gaps. Par2 files are awesome and I encourage everyone to use them on any data you'd care about losing.

    Make and use your own par2 files with MacPar Deluxe.
    http://www.versiontracker.com/dyn/moreinfo/macosx/14338
     

Share This Page