Command-line Based Data Recovery Utility for Ubuntu Linux – SafeCopy

Even if you use highest quality materials and storing methods there’s still no guarantee against data corruption because shi* just happens :/. Although having a quality optical storage media devices such as CD/DVD (or even Blu-ray in today’s standards) do help and by using them with a utility like DvdDisaster can add even more durability.

But tools like ‘DvdDisaster’ can do very little if your optical discs are already in a bad state and your only hope is to use some sort of a data recovery tool. If you use Ubuntu then you can try ‘SafeCopy’. It is based on the command but due to its simplicity, anyone can use it easily.


Main features …

*. Manually change “block sizes”, number of recover attempts, “force seek” and enable/disable driver buffer reading.

*. Three (3) built in “modes”. If your media is slightly damaged then you can use the mode 0 (zero) as it’s the fastest method because in that mode SafeCopy won’t use aggressive methods. If you have a really bad media (or few blocks badly damaged) then you can use the mode 1 (default option) or 2.

*. You can make it to exclude reading good blocks and only try to recover bad ones by first creating a log file. Then later you can use it to try to recover those sectors using aggressive methods.

*. Change read attempts (you can manually define how many times should “SafeCopy” try to read through bad sectors).

*. Use your own string to fill nonrecoverable sectors instead of filling them with zero bytes (default action).


*. Change the scanning sector size. This is another useful feature for thoroughly scanning the media (increases the error recovery chances).

*. Displays an output with nonrecoverable blocks, recovered bad blocks, copied bytes etc.

These are just a very little of its features to mention.

You can install SafeCopy in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by simply typing the below command in your Terminal window.

sudo apt-get install safecopy

And make sure to read its manual which is essential if you want to get the maximum out of it. For that please use the below command.

man safecopy


Or for a short lits of commands use the below one instead.

safecopy -h

An example …

As said before even if it’s a command-line based powerful utility still the default mode is optimized for most users. Let’s say that I wanted to recover data from a CD. Then without changing anything I’d just use the below command.

safecopy /dev/cdrom temp.iso

Just replace “/dev/cdrom” with your actual drive path (whether it’s a HDD, Tape drive etc) and “temp.iso” with your preferred file name.

If I want a bit additional control, say I wanted SafeCopy to try to read 5 times (default 3) before giving up on a bad sector (errrrr :D) then I’d use the “r” attribute (it’s all in the manual). For that I’ll use something like the below command.

safecopy -r 5 /dev/cdrom

If I wanted the same thing done but with a “debug” output for later analysis and need to use 512 bytes for the block size for increasing recovery rate, then I’ll use the below command.

safecopy -r 5 --debug -b 512 /dev/cdrom temp.iso

It also has few built in “debug” output settings  as shown below in the below screenshot.


Again these are all laid out in the manual so if you’re serious about using SafeCopy then please read it. For further study, pleases visit this SafeCopy home page and this article for creating analysis outputs for more. But please remember that no tool can guarantee complete success and if the media is badly damaged then you might never be able to recover data from it. Good luck.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.