Scratched CD or DVD? Recovering Data from CDs and DVDs in Linux
Yes, it’s true. Sometimes CD/DVDs get scratched, and sometimes our optical drives can not read them for any apparent reason. When you insert a CD/DVD into your optical drive, it reads the table of contents (which file is where) and then when you want to read a file from there, it points the laser to the location defined in the table of contents. If everything goes well, you retrieve/open the file. If not, the optical drive reduces speed gradually until it comes down to 1x and then tries again to be successful. If it can not do that, it gives you an error and stops.
Usually, the error is due to the scratched disks, which causes the laser to be unable to read the file. However, there is still a possibility that you can recover your files from your CD/DVDs.
In this article, we will look at three programs: JFileRecovery, dares and gddrescue.
JFileRecovery (4 out of 5)
JFileRecovery may not be available from your distribution’s repository, or at least for Ubuntu. You can visit the project’s web site and download the program there. Do not think that it is a Windows-only program; it is written in Java and thus is cross-platform. The only dependency is to have Java Runtime Environment installed on your system.
After you download the program, you can double click on it and it fetches some files from the Internet and opens up its main interface. The interface is very simple, as you see from the screenshot at the top. You select the CD/DVD drive which you want to recover, and in the middle you select a file where the recovered files will be saved. Then you click on “Begin recovery” and wait for the program to finish its job.
One point to note is that the program is very successful on Cyclic Redundancy Check (CRC) errors. CRC is used to detect whether a file is altered or not. JFileRecovery checks if the file can be recovered despite the CRC failure.
If the program fails, it asks for your opinion to retry or skip file recovery.
Dares (DAta REScue) (4 out of 5)
Dares has a command line usage. However, if you prefer, you also have the option to install the QT graphical user interface; just select dares-qt when you are installing the program. Dares is probably available in your distribution’s package manager; I did not have any problems with installing it from Synaptic. Make sure that Universe repository is added to the sources.
Dares works as JFileRecovery does: you select the disk image/file to be recovered and then you select where you want the data to be saved. Dares provides another option, which is selecting the h2i file of the image. This is optional though; if you do not have any clue, you can leave it as it is.
After you set everything up for Dares, sit back and wait for the program to finish. Dares also works with disks that are so damaged that you can not even mount them.
GDDRescue (GNU Data Rescue) (5 out of 5)
GDDRescue is probably the mother of all CD/DVD recovery programs available for Linux. The program is probably available for your distribution; Ubuntu users can install it within Synaptic if they have enabled the Universe repository.
GDDRescue does not have a graphical user interface, meaning that you have to run it from the command line. The program accepts tons of arguments and options, so it is a good idea to read the manual page (man ddrescue.) However, for simple CD recovery, you can follow these directions (assuming your CD is in /media/my_cd and you want to recover it to /home/your_user_name/my_recovered_cd):
ddrescue /media/my_cd /home/your_user_name/my_recovered_cd
Exactly at this point GDDRescue comes into play: if you have multiple recovered files, for example you ran one with JFileRecovery and another with Dares and one with ddrescue, you can run ddrescue to merge all the available recovered files into one file. So, if JFileRecovery recovered files 1 to 15, Dares 1 to 13 and GDDRescue 2 to 16, then you can have one output file with files 1-16. If you want, you can run GDDRescue multiple times on the same output file from the same input file, so that if it can not recover one file in the first run but can recover in the second run, it will write the recovered data in place. No other program is capable of this.
As we can see, no program is as powerful as GDDRescue. However, it is a command line tool with many options (it can even recover data from hard disks and is present in the toolkit of many forensic investigators), so beginner level users approach it with hesitation. If you are intimidated by the command line (you should not be), you can start with JFileRecovery and Dares.