LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > error_401
User Name
Password

Notices



Rate this Entry

CD-ROM data recovery - ddrescue respectively gddrescue

Posted 12-12-2012 at 11:00 AM by error_401
Updated 08-07-2014 at 12:12 PM by error_401 (Updated information)

I have a lot of pictures stored on CD-ROM's which over time start to loose data.
I want to recover as much data as possible and store it on my NAS. I have assembled my experience in this blog sort of a tutorial and reference.

1. Install ddrescue (gddrescue)
2. How it works - Manuals
3. Figure out your devices and prepare ddrescue
4. Use it on a damaged CD-ROM (data loss due bad sectors)
5. Recover as much data from data CD-ROM as possible
6. Make it accessible
7. Check the data recovered, delete unusable files and backup to NAS.
8. Troubleshooting

I will now describe in a bit more detail the process I've come up with.

1. Install ddrescue (gddrescue)
================================================================================

In my case I opted for ddrescue from the GNU ddrescue. To install it in Debian Squeeze use

Code:
# apt-get install gddrescue
The GNU ddrescue is named gddrescue.

The actual version as of AUG 2014 is 1.16 in the repositories of DEBIAN's apt-get.
Unfortunately this version is just short of one important addition later versions such as 1.17 or 1.18 feature to recover CD-ROM's. So it might be necessary to install 1.17 or 1.18 directly from the website:

https://www.gnu.org/software/ddrescue/

Find the reason for that in 8. Troubleshooting.


2. How it works - Manuals
================================================================================

The manual can be found here:http://www.gnu.org/software/ddrescue...ue_manual.html

or use the built in help

Code:
ddrescue --help | more
The manual is exhaustive but for a normal user still not very useful as all the examples given do not properly address the specific problem to recover data from one single instance of a CD-ROM.

The capability of ddrescue to make multiple passes on the same medium and write all results into the same file may help recover as much as possible.

The difficulties are to figure the correct parameters for ddrescue to succeed which leads to the next point.

3. Figure out your devices and prepare ddrescue
================================================================================

ddrescue is a console tool and needs proper input for the device. The correct drive letter may be found by inserting the CD-ROM. In my case the read errors on the console came in handy as they showed the device right away. So now I know my device names being /dev/sr0 for the CD-ROM and /dev/sr1 for the CD-DVD-BURNER.

To find the devices have a look into the /dev eventually using
Code:
ls /dev -al | more
to figure the devices and links to them. Scroll through the list looking for your devices, like:
Code:
lrwxrwxrwx 1 root root     3 9. Dec 20:26 cdrom -> sr1
lrwxrwxrwx 1 root root     3 9. Dec 20:26 cdrom1 -> sr0
lrwxrwxrwx 1 root root     3 9. Dec 20:26 dvd -> sr1
Code:
# cat /var/log/dmesg | egrep '(CD|DVD)'
May output the device as well. There are other ways to figure that as well such as using System Info from your GUI's system menu.

This will help properly identify the drives and device names for the proper use.
Be aware that the drive may not even show up in GUI programs such as "Dolphin" file manager because the medium cannot be properly initialized. (It's broken - that's why we try ddrescue.)

CAUTION: The drive may not always be the same. It can change when rebooting your system so make sure it is correct before starting ddrescue.

4. Use it on a damaged CD-ROM
================================================================================

BTW the user needs to have administrator rights or run ddrescue under "su" else it will fail on read or writing the file. After successful recovery you may need to chmod the files you recovered to be accessible by normal users.

In my example the CD-ROM is inserted in /dev/sr0 so I'll run a first recovery attempt using:

Code:
ddrescue -n -b 2048 /dev/sr0 /recovery/recover.iso /recovery/recover.log
Note that I have used full pathnames to avoid the log file to be in a different place depending from where you started ddrescue.

The second run I used the option described in the manual starting at point 0. This option yields the best result up to now (About 10 CD-ROM's recovered to up to 95 %).

Code:
ddrescue -i0 /dev/sr0 /recovery/recover.iso /recovery/recover.log
On the third run I used the option -d (direct) read, kind of a direct access to the disk bypassing the kernel cache but this option again requires correct block size setting.

Code:
ddrescue -d -r3 -b2048 /dev/sr0 /recovery/recover.iso /recovery/recover.log
The retry option may yield more data as in my case I'm prepared to destroy the media. I have only this CD-ROM and the cluster in question cannot be read so destroying it with several attempts is worth it when I can retrieve even more data.
This is the last option I use for the aforementioned reason of eventually destroying the CD-ROM (or HDD).


4.1 Using a different version from 1.16
--------------------------------------------------------------------------------

When installing gddrescue via apt-get install it is installed into the OS. When downloading and installing later versions you may put them into a folder anywhere. I have them put into the users folder structure so I can use the version I need on the same CD-ROM. E.g. I have installed version 1.18 into /home/user1/ddrescue-1.18/

So you have to invoke it within that folder (or give the full path):
Code:
./ddrescue -d -r3 /dev/sr0 /recovery/recover.iso /recovery/recover.log
The console output during the run includes information about the recovery. A good description I have found in German is from: http://wiki.ubuntuusers.de/gddrescue

The most important is actually the "rescued: " entry which shows what could be rescued and how much. In addition the "errsize: " entry should decrease with every run.

I had to run ddrescue several times on the same CD-ROM with different settings. What also helped in one instance was to run it on another computer, hence a different physical drive. I got even a bit more data out. The increase of rescued data however was small compared to the hassle of copying the files around. (I wanted the .iso and .log locally on the computer with the reading drive to exclude network lag or a sleeping NAS to be inaccessible while recovering.)


6. Make it accessible
================================================================================

Now you have an .iso and .log file so what's the next step? In order to access single files backup these files (both) as you may want to retry recovering even more e.g. on another CD-ROM drive.

Use a decompression program which can access .iso files such as "Ark" on DEBIAN to simply entpack the content of the recovered CD-ROM to a file location. That's it.

7. Check the data recovered, delete unusable files and backup to NAS.
================================================================================

Now you can manipulate the data at will as the files are again on your hard drive. Make sure to use two media if backing up to CD-ROM again (someone should have told us that some 10 years ago...)

8. Troubleshooting
================================================================================

There seems to be a bug in version prior to 1.17 which cannot be properly addressed when recovering CD-ROM's. At times when interrupting ddrescue with "Ctrl + C" it can happen that afterwards when trying to invoke ddrescue again on the same CD-ROM with the same .iso and .log files it fails with the error:

Code:
ddrescue: Bad logfile; last block begins past end of input file.
The following blog addresses this bug:

http://blog.gmane.org/gmane.comp.sys...month=20120601

I have not come across the solution given in the afore-mentioned blog on "who to edit" the .log file. It goes beyond my capability as simple user to figure for myself how to modify the .log to be able to enlarge the scope of the rescue domain. So I installed version 1.18 instead which hast the following command to overcome this bug:

Code:
./ddrescue -i0 -C /dev/sr0 /recovery/recover.iso /recovery/recover.log
where -C addresses the fault of the last block begins past end of input file.
Posted in Uncategorized
Views 781 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration