Partition tables organize your disk by dividing it into distinct sections, each formatted with a specific filesystem like ext4 or NTFS. When a partition is deleted, the data isn’t immediately erased; only its entry in the partition table is removed. The filesystem remains intact but inaccessible. Recovering these partitions involves scanning the disk for existing filesystems and reconstructing the partition table.

On Linux, the open-source tool TestDisk can efficiently recover lost or deleted partitions. It scans for filesystems and restores the partition table based on the found data. To minimize the risk of data loss, ensure the affected disk is not mounted during the recovery process.

To recover partitions, use a live Linux distribution, like Ubuntu, which allows you to operate on the disk without altering its current state. This setup is crucial for safely scanning and recovering your partitions.

Steps to recover lost or deleted partition for free using Linux:

  1. Boot your computer using a live Linux distribution, such as Ubuntu.
  2. Enter Live CD mode when available if booting from installer disk.

    For Ubuntu installer, click on the Try Ubuntu button.

  3. Open the terminal.

    If no Live CD mode available, press <ctrl> + <alt> + <f2> keys to get to the terminal.

  4. Identify the disk containing the lost or deleted partition.
    $ lsblk
    NAME  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    loop0   7:0    0  1.9G  1 loop /rofs
    loop1   7:1    0 89.3M  1 loop /snap/core/6673
    loop2   7:2    0 53.7M  1 loop /snap/core18/941
    loop3   7:3    0  151M  1 loop /snap/gnome-3-28-1804/31
    loop4   7:4    0    4M  1 loop /snap/gnome-calculator/406
    loop5   7:5    0 14.8M  1 loop /snap/gnome-characters/254
    loop6   7:6    0 1008K  1 loop /snap/gnome-logs/61
    loop7   7:7    0  3.7M  1 loop /snap/gnome-system-monitor/77
    loop8   7:8    0 35.3M  1 loop /snap/gtk-common-themes/1198
    sda     8:0    0   20G  0 disk
    sr0    11:0    1    2G  0 rom  /cdrom

    Look for the disk size or label to identify the correct disk.

  5. Enable additional repositories if necessary.
    $ sudo add-apt-repository universe
    'universe' distribution component enabled for all sources.
    ##### snipped
  6. Install TestDisk if it is not already installed.
    $ sudo apt install --assume-yes testdisk
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
      testdisk
    0 upgraded, 1 newly installed, 0 to remove and 316 not upgraded.
    Need to get 345 kB of archives.
    ##### snipped
  7. Launch TestDisk from the terminal.
    $ sudo testdisk
  8. Select No Log with the arrow keys and press [ENTER].
  9. Select the disk with the lost or deleted partition and press [ENTER] to proceed.
  10. Select the disk's partition table type and press [ENTER].

    Intel is the most common partition type with EFI GPT starting to gain popularity.

  11. Press [ENTER] to start analysing the disk.
  12. Press [ENTER] again to search for potential partitions on the chosen disk.
  13. Select the found partition and press [ENTER] to continue.
  14. Choose Write and press [ENTER] to update the partition table.
  15. Press Y to confirm the partition table update.
  16. Press [ENTER] on Ok to continue.
  17. Select Quit and press [ENTER] to return to disk selection menu.
  18. Select Quit and press [ENTER] to exit TestDisk.
  19. Verify that the partition has been recovered.
  20. Restart your computer to apply the changes.
    $ sudo reboot
Discuss the article:

Comment anonymously. Login not required.