Step-by-step guide on how to do Linux deleted partition recovery using bash commands:
- Determine the device name The first step is to determine the name of the device that contained the deleted partition. You can use the “lsblk” command to list all available block devices on your system. The output will show the device name, size, and any partitions that are currently available.
- Create an image of the affected device Before attempting to recover the deleted partition, it’s a good idea to create an image of the affected device. This will ensure that you have a backup in case anything goes wrong during the recovery process. You can use the “dd” command to create an image of the device, like this:
sudo dd if=/dev/device-name of=image-file bs=512
Replace “device-name” with the name of the device you want to image, and “image-file” with the name of the file where you want to save the image.
- Install testdisk TestDisk is a popular data recovery tool that can help you recover deleted partitions on Linux. You can install it using your package manager, like this:
sudo apt-get install testdisk
- Run TestDisk Once TestDisk is installed, you can run it using the following command:
This will launch the TestDisk utility. Follow the on-screen prompts to select the device you want to recover the partition from and choose the “Analyse” option.
- Search for lost partitions TestDisk will scan the device and attempt to locate any lost or deleted partitions. Once the scan is complete, select the partition you want to recover and choose the “Write” option to write the partition table to disk.
- Mount the partition If the partition was successfully recovered, you can try to mount it and access the data. First, create a mount point using the “mkdir” command:
sudo mkdir /mnt/recovered-partition
Then, mount the partition using the “mount” command:
sudo mount /dev/device-name /mnt/recovered-partition
Replace “device-name” with the name of the recovered partition.
Linux Deleted partition recovery using bash commands can be a complicated process, but by following the steps outlined above and using tools like TestDisk, you can increase your chances of successfully recovering your lost data. Remember to always create an image of the affected device before attempting any recovery operations, and be patient as the process can take some time.