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.
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.
Infos
- smartmontools: http://sourceforge.net/apps/trac/smartmontools/wiki
- ddrescue: http://www.gnu.org/software/ddrescue/
- gdisk: http://sourceforge.net/projects/gptfdisk/
- "Data Rescue with TestDisk" by Klaus Knopper, Linux Pro Magazine, issue 134, January 2012, pg. 14, http://www.linuxpromagazine.com/Issues/2013/147/Top-10-Knoppix-Rescue-Tricks
- TestDisk: http://www.cgsecurity.org/wiki/TestDisk
- PhotoRec: http://www.cgsecurity.org/wiki/PhotoRec
« Previous 1 2 3 4
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more and more Linux systems are getting targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.