Software & AppsOperating SystemLinux

Recovering Lost Data on Ext4: A Guide to Software Options

Ubuntu 18

Data loss can be a distressing situation, especially when the lost data is of high importance. However, with the right tools and knowledge, you can recover lost data from an ext4 file system. This article will guide you through the software options available for data recovery on ext4.

Quick Answer

Recovering lost data on ext4 file system is possible with software options such as TestDisk/PhotoRec and Extundelete. These tools can help recover deleted files and restore lost partitions on Linux systems. However, it is important to avoid using the disk immediately after data loss to prevent overwriting the deleted data.

Understanding Ext4 File System

The ext4 or extended file system version 4 is a journaling file system for Linux. It is the default file system for many Linux distributions. Ext4 file system is robust and has a mechanism to prevent data loss in case of a power failure or system crash. However, data loss can still occur due to accidental deletion, hardware failure, or file system corruption.

Precautions Before Data Recovery

Before attempting to recover data, it’s crucial to avoid using the disk. This is because when data is deleted, it’s not immediately removed from the hard drive. Instead, the space it occupied is marked as available for reuse. If the system writes new data in this space, it can overwrite the deleted data, making recovery impossible.

Software Options for Data Recovery


TestDisk is a powerful open-source data recovery tool. It’s designed to recover lost partitions and make non-booting disks bootable again. PhotoRec, included with TestDisk, specializes in recovering lost files from various storage devices.

Installing TestDisk/PhotoRec

You can install TestDisk/PhotoRec by opening a terminal (CTRL + ALT + t) and running the following command:

sudo apt-get install testdisk

This command uses sudo to run the operation with root privileges, apt-get is the package handling utility in Ubuntu, and install is the command to install new software.

Using PhotoRec

Launch PhotoRec with root privileges by running the following command:

sudo photorec

PhotoRec will display a text-based interface where you can select the disk and specify the types of files to recover. It will then scan the disk and recover the files to the specified location.


Another option for data recovery on ext4 is Extundelete. It’s a command-line tool that can recover files deleted from an ext3 or ext4 partition.

Installing Extundelete

You can download and install Extundelete from its SourceForge page. After downloading, extract the tarball and compile the program.

Using Extundelete

To use Extundelete, you need to unmount the partition and run the tool with the following command:

extundelete /dev/sda1 --restore-all

This command tells Extundelete to recover all deleted files from the partition located at /dev/sda1.


Data recovery on ext4 is possible with tools like TestDisk/PhotoRec and Extundelete. However, it’s important to stop using the disk immediately after data loss to prevent overwriting the deleted data. Always remember to back up important data regularly to avoid data loss.

For more information and resources on data recovery, you can refer to the Ubuntu Community Data Recovery guide at

Is data recovery on ext4 file system guaranteed to be successful?

No, data recovery success depends on various factors such as the extent of data loss, file system corruption, and the actions taken after data loss. It’s always recommended to stop using the disk immediately and consult professional data recovery services for critical data.

Can I recover data from a formatted ext4 partition?

Yes, it’s possible to recover data from a formatted ext4 partition using data recovery software like TestDisk/PhotoRec or Extundelete. However, the chances of successful recovery may depend on the extent of formatting and overwriting of data.

Can I recover specific types of files using TestDisk/PhotoRec?

Yes, TestDisk/PhotoRec allows you to specify the types of files you want to recover. By default, it attempts to recover a wide range of file types, including documents, images, videos, and archives.

Does TestDisk/PhotoRec modify the original disk during the recovery process?

No, TestDisk/PhotoRec operates in a read-only mode, meaning it does not modify the original disk during the recovery process. This ensures that the recovery attempts do not inadvertently cause further data loss.

Can I recover files from an ext3 partition using Extundelete?

Yes, Extundelete can recover files from both ext3 and ext4 partitions. It is designed to work with both file systems and can be used to recover deleted files from either.

Are there any graphical user interface (GUI) options available for ext4 data recovery?

Yes, there are GUI-based data recovery tools available for ext4 data recovery, such as Scalpel, Foremost, and R-Linux. These tools provide a user-friendly interface for recovering lost data on ext4 file systems.

Leave a Comment

Your email address will not be published. Required fields are marked *