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
Steps to recover a missing disk partition table entry with TestDisk in Linux:
- Start a live Ubuntu session from installation media when the affected disk might otherwise remain in use.
Choose Try Ubuntu on the installer menu so the recovery runs from temporary media instead of the disk you are repairing.
- Open a terminal in the live session.
If the graphical desktop is unavailable, switch to a text console such as <ctrl> + <alt> + <f2>.
- Identify the whole disk that contains the missing partition entry.
$ 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.
- Unmount any mounted partition from the affected disk before scanning it.
$ 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.
- Install the testdisk package in the live session if it is not already present.
$ 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.
- Start TestDisk on the whole disk device.
$ sudo testdisk /dev/sdb
- Select Create to save a recovery log, or No Log if the live session is disposable.
A saved log makes it easier to review what TestDisk detected before you write changes.
- Select the disk with the missing partition and press [ENTER] to continue.

- Accept the detected partition table type and continue.
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.
- Select Analyse to inspect the current partition map.

- Confirm Quick Search to scan for lost partitions.

- Highlight a found partition and press P to list its files.
Continue only when the directory names and files match the lost volume you expect.
- Run Deeper Search when Quick Search does not find the correct partition or the reported boundaries are wrong.
Deeper Search can take a long time on large disks, so prevent the live session from sleeping until it finishes.
- Change the recovered partition from D to P, L, or * when TestDisk still marks it as deleted.
Ordinary data partitions are usually P or L. Use only one bootable * partition on a disk that must boot an operating system.
- Choose Write to save the recovered partition layout.
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.
- Press Y to confirm the partition table update.

- Press [ENTER] on Ok after the success message.

- Select Quit and press [ENTER] to return to the disk selection screen.

- Select Quit again and press [ENTER] to exit TestDisk.

- Restart the live session, or disconnect and reconnect a non-system removable disk, so the kernel reloads the restored partition table.
On a current Ubuntu live session, TestDisk ends the write step with
You have to reboot for the change to take effect.
- Verify that the partition entry is visible again before mounting the filesystem.
$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/sdb NAME SIZE TYPE FSTYPE MOUNTPOINTS sdb 931G disk `-sdb1 931G part ext4
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
