How to recover deleted files in Ubuntu

Sometimes users are faced with the loss or accidental deletion of necessary files. When this situation occurs there is nothing left to do but to try to restore everything with the help of specialized tools. They are scanning the hard disk partitions, corrupted, or find the previously deleted objects and try to return them. Not always such an operation is successful because of fragmentation or total loss of information, but to try definitely.

Restoring deleted files in Ubuntu

Today we’d like to talk about the available solutions for the operating system Ubuntu, which is based on the Linux kernel. That is, the methods are suitable for all distributions based on Ubuntu or Debian. Each utility operates differently, so if the first did not bring any effect, be sure to try the second, and we, in turn, will present the most detailed guide on the subject.

Method 1: TestDisk

TestDisk, as the following utility is a console tool, but not the whole process will be carried out by issuing commands, something which the implementation of the graphical interface is still there. Let’s start with the installation:

  • Go to menu and launch “Terminal”. To do this also by holding down the hotkey Ctrl + Alt + T.
  • Mount command sudo apt install testdisk to start the installation.
  • Next, you should confirm your account by entering your password. Please note that the characters you type do not appear.
  • Wait for completion of downloading and unpacking the packages.
  • After the emergence of the new field itself, you can run the utility from the superuser, and this is done using the command sudo testdisk.
  • Now you get into some kind of simple implementation of the GUI console. Controls are arrows and pressing Enter. Start by creating a new log file, so be aware of what action was performed at some point.
  • When showing all available drives, choose one, which will be recovering lost files.
  • Select the current partition table. If you can’t decide, check out tips from the developer.
  • You find yourself in the action menu, the return of objects occurs through the section “Advanced”.
  • Left only with the arrow keys Up and Down to determine a specific section, and using the Right and Left to specify the desired operation, in our case it is “List”.
  • After a short scan you will see a list of files stored on the partition. Marked in red lines mean that an object has been damaged or removed. You will only need to move the selection bar on the desired file and click on Withto copy it into the desired folder.
  • The functionality of the considered utility simply amazing, because it can recover not only files, but entire partitions, but also great to interact with the file systems NTFS, FAT, and with all versions of Ext. In addition, the tool just returns the data, but provides bug fixes, which avoids further problems with the performance of the drive.

    Method 2: Scalpel

    For the novice user to deal with the utility Scalpel is a bit more tricky, because here every action is activated by entering the corresponding command, but do not worry, because we will thoroughly describe every step. As for the functionality of this program, it is not tied to any file systems and works equally well on all types and supports all popular data formats.

  • Downloading all the necessary libraries happens with the official repository using sudo apt-get install scalpel.
  • You will then be prompted to enter the password from your account.
  • Then wait for the finish adding new packages to the appearance of the input string.
  • Now you should configure the configuration file by opening it via a text editor. Used to do this line: sudo gedit /etc/scalpel/scalpel.conf.
  • The fact that by default, the utility does not work with file formats — they must be connected by raskomentiruyte lines. To do this, just next to a clean grid format, and when the configuration is complete save the changes. After performing these steps, a Scalpel will be fine to restore these types. This should be done in order for the scan would take less time.
  • You only have to define the hard disk partition where will be analyzed. To do this, open a new “Terminal” and type the command lsblk. In the list find the required designation of the drive.
  • Run a repair using command sudo scalpel /dev/sda0 -o /home/user/Folder/output/, where sda0 — the number of desired section, the user — name the user folder, and Folder is the name of a new folder which will be placed all the recovered data.
  • Upon completion, go to file Manager (sudo nautilus) and check with found objects.
  • As you can see, to sort out a Scalpel will not be easy, but after getting acquainted with the control activation of the action commands is no longer seem so complicated. Of course, none of these tools does not guarantee complete recovery of all lost data, but at least some of them each utility must return.


    (Visited 72 times, 1 visits today)