Rescuing and restoring data

Smile Please

If files are still missing, as in the case of the memory card with the photos, the PhotoRec tool [6] can help. PhotoRec tries to recover deleted files by searching the entire disk for signs of life or for typical identifying characteristics of files. As the name suggests, it was originally invented for recovering deleted photos, but it can also bring many other files back to life. PhotoRec is usually found in the testdisk package. If you have not yet installed it, use the package manager to do so. Then, simply pass the name of the image file to the tool:

photorec copy.img

PhotoRec shows the image name in the upper part of the screen; now, you can press Enter to confirm and see a choice of all the partitions found by the tool (Figure 8). In the Partition list, PhotoRec shows all the file types that it can restore; click File Opt to mark the file types you want PhotoRec to recover.

Figure 8: As with TestDisk, you use the arrow keys to control PhotoRec; pressing Enter selects the highlighted item at the bottom of the window.

To select the partition you want PhotoRec to search, use the arrow keys and press Enter. Next, select the filesystem used on the partition. If you are unsure, you can use the commands introduced previously: fdisk and gdisk. The memory card with photos is FAT16, which isn't listed, so the Other item is the right choice. In the next step, check Whole to tell PhotoRec to check the entire partition, not just the empty space.

Finally, you must choose a directory on your rescue computer to which PhotoRec will store any files it finds. Because the tool might restore individual files multiple times, you need to make sure the selected directory has enough free space available. Once you have found a suitable location, press C, and PhotoRec immediately sets about its work. Depending on the size of the partition to be examined, this could take some time to complete. Once the summary appears, press Quit until PhotoRec terminates. Now it's time for a little extra manual work: PhotoRec distributes all the files it finds over several subdirectories with fairly cryptic names. You will need to fish the missing documents out of these directories yourself.

Conclusions

In the example of the missing holiday photos, PhotoRec saved the day. The small tool was able to retrieve all the missing shots. However, none of the programs presented here is a panacea: If an application has overwritten your missing thesis with garbage, not even PhotoRec can get it back. Thus, you should recognize this simple rule of thumb: Files without a backup do not exist.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Top 10 Knoppix Rescue Tricks

    The Knoppix Live Linux distro is packed with powerful tools for fixing broken systems. We ask Knoppix creator Klaus Knopper for his favorite Knoppix rescue tricks.

  • Data Reconstruction

    One false click can quickly delete important data, or even an entire partition. If a backup tool is missing, only a rescue specialist can help.

  • SystemRescueCd

    The SystemRescueCd live system contains numerous tools that you can use to recover deleted files or a defective system.

  • Parted Magic

    It's really annoying when a disk suddenly dies on you or a typo in a command deletes important data. The free Parted Magic Live distro offers help.

  • SystemRescueCd

    If you accidentally delete data or format a disk, good advice can be expensive. Or maybe not: You can undo many data losses with SystemRescueCd.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News