When a partition table entry disappears, Linux can stop exposing a working filesystem even though the data blocks are still on the disk. Rebuilding the correct entry can make the volume visible again without dropping straight into slower file-by-file recovery or a full restore from backup.
TestDisk scans a whole disk such as /dev/sdb or /dev/nvme1n1 for filesystem signatures and old partition boundaries, then lets you review the partitions it finds before writing a new map. The goal is to restore the missing entry in the disk partition table, so the disk, partition size, start position, and directory listing all need to match the lost volume before anything is written.
Use a live Ubuntu session when the affected disk might otherwise stay mounted or in active use. If the missing volume actually lives inside LUKS, LVM, mdraid, or another storage layer, recover that layer instead of rewriting the disk partition table, and stop for separate hardware checks first if the disk is already returning read errors.
Related: How to check disk errors in Linux
Related: How to mount a disk or partition in Linux
Choose Try Ubuntu on the installer menu so the recovery runs from temporary media instead of the disk you are repairing.
If the graphical desktop is unavailable, switch to a text console such as <ctrl> + <alt> + <f2>.
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS NAME SIZE TYPE FSTYPE MOUNTPOINTS sda 476G disk ├─sda1 1G part vfat /boot/efi ├─sda2 2G part ext4 /boot └─sda3 473G part LVM2_member sdb 931G disk
Run TestDisk against the whole disk such as /dev/sdb, not a partition such as /dev/sdb1.
$ lsblk -o NAME,MOUNTPOINTS /dev/sdb NAME MOUNTPOINTS sdb `-sdb1 /mnt/data $ sudo umount /dev/sdb1
Do not mount or write to the affected partition during recovery because new metadata can overwrite the filesystem you are trying to restore.
$ sudo apt update $ sudo apt install testdisk
The current Ubuntu package name is testdisk. Connect the live session to a network first if the package is not already cached on the media.
$ sudo testdisk /dev/sdb
A saved log makes it easier to review what TestDisk detected before you write changes.

Intel is typical for MBR disks, while EFI GPT is typical on current UEFI systems. Choose another type only when you know the disk was created that way.


Continue only when the directory names and files match the lost volume you expect.
Deeper Search can take a long time on large disks, so prevent the live session from sleeping until it finishes.
Ordinary data partitions are usually P or L. Use only one bootable * partition on a disk that must boot an operating system.
Write the change only after the partition boundaries and file listing match the lost volume because a wrong layout can hide the real filesystem and make later recovery harder.




On a current Ubuntu live session, TestDisk ends the write step with
You have to reboot for the change to take effect.
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/sdb NAME SIZE TYPE FSTYPE MOUNTPOINTS sdb 931G disk `-sdb1 931G part ext4