🔥 New Launch of Fastest Growing AItrendytools Platform!

Submit Your AI Tool Today!

How to Use PhotoRec to Recover Deleted Files in Linux/Ubuntu

Learn how to use PhotoRec on Linux/Ubuntu to recover deleted files quickly. Step-by-step guide for restoring lost media files using this powerful tool.

How to Use PhotoRec to Recover Deleted Files in Linux/Ubuntu - Mohsin Dev

Accidentally deleted files on your Linux/Ubuntu system? Don’t worry, you can recover them using a powerful utility called PhotoRec. In this guide, we will walk you through the step-by-step process of recovering your lost files efficiently. PhotoRec is packaged with TestDisk, a popular tool from CGSecurity, and is specifically designed to recover deleted media files from SD cards, USB drives, and hard drives.

Quick Steps to Recover Deleted Files Using PhotoRec:

  1. Install PhotoRec:
  2. Run the command to install TestDisk, which includes PhotoRec:
bash

Copy code
sudo apt -y install testdisk
  1. Run PhotoRec:
  2. Launch PhotoRec from your terminal by running:
bash

Copy code
sudo photorec
  1. Select Drive & Partition:
  2. Choose the drive containing the deleted files, and select the correct partition.
  3. Choose File Types:
  4. Select the file types you want to recover (e.g., JPG for photos).
  5. Start Recovery:
  6. Pick a location for recovered files and let PhotoRec work its magic.
  7. Access Recovered Files:
  8. Files will be saved in a folder named recup_dir, where you can review and retrieve them.

Let’s explore each step in more detail.

Step 1: Installing PhotoRec on Linux/Ubuntu

PhotoRec is part of the TestDisk package, so you won’t find it as a standalone software in the repositories. Use the command below to install TestDisk, which includes PhotoRec.

bash

Copy code
sudo apt -y install testdisk

This command installs both TestDisk and PhotoRec. Once the installation is complete, you can run PhotoRec directly from your terminal.

Step 2: Running PhotoRec and Scanning for Deleted Files

To start PhotoRec, open your terminal and enter the following command:

bash

Copy code
sudo photorec

You’ll see a menu-driven interface. First, select the hard drive from which you want to recover files. Use the arrow keys to navigate and press the Enter key to proceed.

Step 3: Selecting the Partition

After selecting the drive, you’ll need to choose the partition. This is where the deleted files were stored. If unsure, select the most appropriate partition, often labeled with ext4 if you’re using a standard Linux filesystem.

Step 4: Filtering File Types

To speed up the recovery process, select the file types you want to recover. For example, if you’re looking for deleted photos, choose JPG or other image file formats. You can access this option from the File Options menu when selecting the partition.

Step 5: Choosing Free Space or Entire Disk

Next, decide if you want PhotoRec to search only the free sectors or scan the entire drive. Searching the free sectors is faster, but scanning the entire disk gives a more thorough result, recovering older files.

Step 6: Specify a Recovery Directory

You’ll be prompted to choose where PhotoRec should save the recovered files. It’s best to select a different drive or directory from the one you are scanning to avoid overwriting recoverable data. Once the location is set, press the letter C to begin the recovery process.

Step 7: Accessing Recovered Files

As PhotoRec works, it will save files into a folder named recup_dir. You can access this folder even while the recovery process is ongoing. Navigate through the recovered files to find the specific ones you were looking for.

FAQs on Using PhotoRec for File Recovery

Q1: Can I use PhotoRec to recover non-media files?

Yes, despite its name, PhotoRec can recover a variety of file types beyond photos, including documents, archives, and videos. It scans based on file signatures and can work on a wide range of file formats.

Q2: How long does the recovery process take?

The time required depends on the size of your drive and how many file types you select for recovery. Limiting file types to those you need (like only photos) can speed up the process.

Q3: What if PhotoRec doesn’t recover my files?

If PhotoRec fails to recover the files, try other recovery tools like Recuva or Disk Drill. You may also check the integrity of the drive using disk repair utilities before attempting recovery again.

Why PhotoRec Works for Data Recovery

When you delete a file, only the metadata (file information) is erased, but the actual data remains on your disk until it’s overwritten. PhotoRec searches for these lost data blocks and reconstructs the file. Since the tool operates at the data sector level, it doesn’t rely on the original file structure, making it incredibly effective even if the filesystem is damaged.

Conclusion

PhotoRec is a powerful and free tool that makes recovering deleted files on Linux/Ubuntu straightforward. While its text-based interface might seem daunting, the step-by-step process we covered ensures you can recover your files without any hassle. If you’re looking for other recovery options, tools like PhotoRescue Wizard or Recuva can also be valuable alternative

Read more: 3600 Seconds to Minutes: Quick Convert & Time Tips

MDMohsinDev

© 2024 - Made with a keyboard ⌨️