Testdisk: Recovery Linux Files by Testdisk
Testdisk: You may have deleted a File in Linux, but you need to restore it. In rare cases, you might get your hands on your new files, but forget to back them up. Fortunately, there is a way to restore your files.
Rm Command
One way to restore files is to use the rm Command. Still, with this Command, you have to stare at your computer screen for hours to restore the files, and this is incomplete.
In the File recovery process, the operating System will give you access to restore files that you can find by name in the margins of your files.
Still, sometimes you may accidentally delete some of the files you tried to fix. So it is better to avoid using this method.
Usually, when you delete your files accidentally, it will often happen to you at the worst possible time, using the upper code can take a long time and this is only when you have backed it up in advance, in case Make sure the deleted File is newly created when it is not given to the System or you to back up.
This is where the test disk module comes in handy, as it is very easy to work with and requires minimal technical knowledge.
Install Testdisk
To install the test disk on Ubuntu, enter the following Command in a terminal:
sudo apt-get install testdisk
In Fedora, you have to type the following Command:
sudo dnf install testdisk
In Manjaro you must use pacman:
sudo pacman -Sy testdisk
Instructions for using TestDisk
Although the basic conditions for using the test disk will start with a Command in the terminal and continue, the test disk module will have a completely separate user interface. You will be able to use the Enter key to navigate through the menu and options.. To work more efficiently, create a separate folder for the files you want to restore.
By executing the following Command in the terminal, a folder named ‘restored’ will be created in your System. You can also make the folder with the name you want:
mkdir restored
By entering the following code, we will go to a new folder and run the test disk module from there:
cd restored /
We also have to use test disk with sudo so that the Command code will look like this:
sudo test disk
The first question that the test disk module will ask you is about logging in. It does not matter in the data recovery process whether your user is logged in or not.
After seeing the user menu in front of you, the first option called Create a new log File will be displayed for you, as we said if you do not already have the Information you can create it during processing, click on the option After selecting, test disk will show you a list of all the hard disks in the operating System, and will ask you to choose the disk you want to restore.
Since all the hard disks in front of you are only capable of reading and viewing, access to delete or change is disabled, so you do not need to worry about accidentally deleting them.
If only one hard drive is connected to your System, on systems with newer SSDs or hard disk drives, your hard drive will be identifiable as an SSD, using the up and down keys on the Keyboard. Stop the Development process / sda and use the correct key on the Keyboard to click the Proceed option, then press Enter.
TestDisk also needs to recognize the partition model. The module will automatically display a menu of options, as it has selected your partition model. We suggest leaving it in this state, as the module has configured it.
Press Enter to proceed to the next page. In the following performance menu that appears, select the Advanced option, and press the Enter key. For example, the files we want to restore are located in the Linux Filesystem partition, but in the case of any System, you may be looking for a File on another partition.
Navigate to the partition you want to recover the File from, use the left arrow key, stop at List, and press Enter.
Use the up and down keys or the PgUp or PgDn keys to move between lists of files, press the correct key on the Keyboard to enter one of the paths, and use the left key as the exit and return.
In this section, look for the word home; the path of all files in all accounts is home. Here, you can search for the File you want and select it using the Enter key.
With the correct key, you can find all the Information. Look inside that account. The items shown to you in red are deleted files. Now, you can search among deleted cases, find the File you want, and hit the c key in lower case to Copy.
After selecting the File, the items displayed to you will change. On the next page, the test disk will ask you to choose a path to save your File. We have already created the Restored path and started the test disk terminal with it. This is the first entry. Click on it to restore the files and press C to move the deleted items to a new folder.