A missing partition table entry can make Linux show a disk as empty even when the filesystem data is still on the media. Recovering the entry restores the partition boundary in the disk map, which is safer than file-by-file recovery when the lost partition can still be identified.
TestDisk scans a whole disk such as /dev/sdb or /dev/nvme1n1 for old partition boundaries and filesystem signatures. It lets you inspect the directory listing before writing the recovered partition table, so the disk name, partition size, start position, and visible files all need to match the lost volume.
Work from live Ubuntu media when the affected disk might otherwise stay mounted or active. If the missing volume lives inside LUKS, LVM, mdraid, or another storage layer, recover that layer instead of rewriting the outer disk partition table, and check disk health first when kernel logs already show 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 recovery runs from temporary media instead of the disk being repaired.
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 being restored.
Related: How to unmount a disk in Linux
$ sudo apt update
$ sudo apt install testdisk
The Ubuntu distribution package is named testdisk. Connect the live session to a network first if the package is not already cached on the installation media.
$ sudo testdisk /dev/sdb
A saved log helps compare what TestDisk detected before any partition table write.

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


Continue only when the directory names and files match the lost volume.
Deeper Search can take a long time on large disks, so prevent the live session from sleeping until the scan 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.




TestDisk reports You have to reboot for the change to take effect. after a successful partition table write.
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/sdb NAME SIZE TYPE FSTYPE MOUNTPOINTS sdb 931G disk `-sdb1 931G part ext4