Saturday, January 28, 2012

decio: il blog: How to recover files from a damaged CD/DVD

decio: il blog: How to recover files from a damaged CD/DVD

How to recover files from a damaged CD/DVD



If you, just like me, have had enough of I/O errors reading your optical media, this post is for you.
This method allows for recovering files from damaged CD/DVD by copying them byte to byte, using the Unix command dd.

WARNING: dd is a very powerful program, and if misused, can literally erase everything on your hard drives. And worst, dd is a no-warning, no-second-think, advanced-users only, Unix-style mean and lean program. See dd entry on Wikipedia for details.

This is the command you should run:
dd if=/Volumes/MY_DYD/File_to_retrieve.ext of=/Users/myuser/myfolder/File_retrieved.ext bs=512 conv=noerror, sync

dd: the command
if: input file
of: output file
bs: bytes size [512 bytes]
conv: conversion options [noerror, don't halt on errors; sync, pad with blanks the block containing the error]

If you specify a bs so small (512), in case of a large bad chunk on the medium you will obtain a lot of error logs. Let it go until you have the prompt again.

This method is expecially useful to recover damaged movies, because unless you have the file 50% corrupted (not very likely even in worst cases), you probably will strip a couple of frames from the movie, and the result will be perfect.
Of course if you are recovering file working as a whole, as a compressed archive or a RDBMS datafile, maybe padding the error with spaces may render useless the resulting file. As usual, YMMV.

dd is available under OSX and Linux (any). If you are running Windows, well, probably you are not an advanced user anyway, so why bother (and no, neither Robocopy nor NtBackup have the same functions of dd). Just in case, you can run dd under Windows viaCygwin. And if you don't know Cygwin, aka Unix shell for Windows, you better read the tutorial on Lifehacker.

dd MAN Page

No comments: