Fix or recover a partition

TestDisk Partition Recovery

Recovering a partition for booting into a Windows using a Linux based Operating System

What you will need:

  • A spare computer.
  • Linux installed on the hard drive of the spare system or a USB Thumb Drive with your choice of an OS with the Linux kernel to boot from.
    • For this tutorial I am using Kali Linux. Any Debian based OS should be fine, you could even use a OS based on Ubuntu or Fedora
    • Don’t have Linux installed or on a USB Drive? Click on: How to load a Linux OS!
  • An internet Connection
  • A device to connect a spare hard drive to your Linux device. Either using internal computer components or a USB to (SATA, SCSI, PCIe, NVME, or Maybe IDE?)
  • The hard drive you want to repair.

— If you are not comfortable with Linux, I understand. Review Brads Linux How-To pages to learn more about Linux Kernel based OS’s!

Let’s get started.

– Prepare the hard drive for your repair, connect it to the base motherboard of the PC or a USB to <connector of choice>.

– Prepare your Linux OS Computer for being awesome. If you are using a Laptop with Linux, make sure you plug in the laptop to a power outlet using the correct power supply unit or have a battery suitable for operations.

– Press the power button on your Linux system and get to the login screen to prepare yourself to be in command.

— If you are using a USB thumb drive with Linux, please make sure to insert the USB Drive to your Computer before pressing the power button.

– Login to the Linux OS using your credentials.

–  Open Terminal: An easy way to do this is by pressing the windows key or Open Apple key on the keyboard and typing in: Terminal

— You will see terminal and it should be selected for you,press enter, this should give you a Terminal window.

– You should see a prompt:  -$

– Type into terminal: sudo fdisk -l    (SUDO FDISK -L in lower case letters) <then press enter on the keyboard>

— You may need to type in your Linux password for sudo

— You should see a list of Disks, something like below I used as an example and you may have multiple in the list if you have multiple drives connected.

Disk /dev/sda: 00.00 GiB, 00000000000 bytes, 000000000 sectors

Disk model: BradsDemo

Units: sectors of 1 * 1 = 1 bytes

Sector size (logical/physical): 1 bytes / 1 bytes

I/O size (minimum/optimal): 1 bytes / 1 bytes

Disklabel type: dos

Disk identifier: 0x0000000

Device     Boot     Start       End   Sectors   Size Id Type

/dev/sda1  *         0001   0000000   0000000    00G  7 HPFS/NTFS/exFAT

/dev/sda2         0000002 000000000 000000000   000G  7 HPFS/NTFS/exFAT

/dev/sda3       000000003 000000000   0000000    00G 27 Hidden NTFS WinRE

/dev/sda4       000000004 000000000 000000000   0.0G  f W95 Ext’d (LBA)

/dev/sda5       000000005 000000000 000000000   0.0G 83 Linux

/dev/sda6       000000006 000000000  00000000   0.0G 82 Linux swap / Solaris

 — The reason why you would want to use fdisk before we continue is to verify that your hard drive(s) you want to fix are connected and reading correctly to the Computer you are using.

– type in terminal: sudo apt install testdisk <then press enter on the keyboard>

 — let the program install

– type in terminal: sudo testdisk <then press enter on the keyboard>

– TestDisk should now be present with options and details informing you the program is open.

– use your arrow keys on the keyboard and select “[no log] don’t record anything”.  If you want to record the operations, make sure you have a spare hard drive capable of storing a lot of data, a recent recovery log saved for a customer rescuing a drive was over 60 Gigabytes and you read that correctly, Gigabytes, Not megabytes or Kilobytes.

– use your arrow keys and select the Disk you want to repair, We will use the example from above: Disk /dev/sda

— press enter key after you select the drive, this should be set to [Proceed]

— The program should automatically detect the partition table, however, use [Intel ] for MBR records and [EFI GPT ] For GPT records, you can use the other options if your file system requires it. For this Tutorial as a reminder, we are rescuing a Windows 10/11 Partition.

— press enter

— The following screen should give the options of below:

[Analyze] [Advanced] [Geometry] [Options] [MBR Code] [Delete ] [Quit    ]

— For our current request option, we will want to let the program [ Analyze ] – Press enter when you have selected [ Analyze ]

— The program should search for partitions but may reveal an error such as bad GPT partition, This Error is acceptable

— There should be an option for [ Quick Search ] at the bottom of the screen – Select it using your arrow keys and press enter on the keyboard

— Let the program scan the hard drive, you should now see a list of partitions found by the program, make it easy on yourself and press enter once the scan is COMPLETE, do not press enter if you see a [STOP] option, unless you want to stop the scan.

– You will now see the partitions listed on the drive testdisk found, select the partition with [Local Disk] and press enter 

— However, I am going to note, this is a great time for you to Add, Change or Modify partitions, you can make one a primary partition as well.

– Once you enter There should be a list of partitions, at the bottom of the screen there should be a menu with the following [Quit] [return] [Deeper Search] [write] – Select [write] and press enter

— Now that the program has finished, quit the program and get back to the terminal prompt

– type in terminal: shutdown -r now <then press enter>

— This will restart the computer the moment the command is sent. Thus “now”

— remove any USB devices connected to the PC before the system gets to the BIOS Boot Screen

— Your system should now be able to detect the partitions properly and if you have an Operating system loaded on the hard drive, the system should boot from the drive.

Did this article help you or did you find an error? Call, Text or email me and let me know.

If you want to repay me, share this article on your website or social media account and go clean up some trash.