Steps to recover files from a disk using Linux as the operating system

First, stop using the disk immediately to prevent further damage or overwriting of the files. If the disk is the system disk, boot your computer using a live Linux USB or CD.

  1. Identify the disk device name using the “fdisk” command. For example, if the disk is “/dev/sdb”, use the command:
fdisk -l /dev/sdb

2. Install the “testdisk” package using your package manager:

$ apt-get install testdisk

3. Run TestDisk with root permissions:

$ testdisk

4. Select the disk and partition you want to recover files from.

5. Choose the “Analyse” option to detect and list any existing or deleted partitions.

6. Select the partition containing the files you want to recover and choose the “Filesystem Utils” option.

7. Select “Copy” to copy the files to a safe location, such as an external drive or another disk.

8. Wait for the file copy process to complete. Depending on the size and number of files, this may take a while.

9. Once the file copy process is complete, verify that the files are intact and accessible.

Note: TestDisk is a powerful data recovery tool, but it requires some technical knowledge to use effectively. Be sure to read the documentation and follow the prompts carefully to avoid accidentally deleting or overwriting data. Additionally, there are other data recovery tools available on Linux, such as PhotoRec and Scalpel, that you can try if TestDisk doesn’t work for your specific scenario.