Fixing “wrong fs type / bad superblock” on an External Drive

(When Linux Sees /dev/sda but No /dev/sda1)

When mounting an external drive, I hit the following error:

sudo mount /dev/sda /media/external
mount: /media/external: wrong fs type, bad option, bad superblock on /dev/sda, ...

At first glance, this looks like a “broken filesystem.”
In reality, Linux could not see any partition at all (no /dev/sda1), so I was effectively trying to mount the entire disk device instead of a partition.

This post documents a safe, reproducible recovery workflow:

  • Identify the real problem
  • Create a full disk image with ddrescue
  • Use TestDisk to locate the lost partition
  • (Optional) Write the partition table back so the disk mounts normally again

Boot Sector vs. Partition Table — What Was Actually Broken?

Before doing anything, it’s critical to understand where the failure occurred:

  • Partition table (MBR/GPT)
    • Lives at the very beginning of the disk
    • Describes where partitions start/end
    • If this is missing or corrupt, you won’t even get /dev/sda1
  • Boot sector / filesystem metadata
    • Lives inside a partition
    • If only this is damaged, you usually still see /dev/sda1, but mounting fails

👉 In this case, the partition table was missing/corrupt, which is why lsblk showed sda but no sda1.


0) Safety Rules (Read This First)

  • Do NOT format the disk
  • Do NOT run destructive commands
    (e.g., mkfs, wipefs without -n, or random “repair” tools)
  • Always double-check the device name
    One typo in /dev/... can destroy your system disk
  • If you see many USB resets or I/O errors in dmesg,
    suspect cable/enclosure/power issues first

1) Confirm the Disk Is Detected

lsblk -o NAME,SIZE,MODEL,SERIAL,TYPE,MOUNTPOINTS

Identify your external drive by size and model.
Example:

/dev/sda   ~476GiB

2) Check for Partitions or Filesystems

lsblk -f
sudo fdisk -l /dev/sda

Key observation

  • If you see only sda and no sda1/sda2,
    the partition table is likely missing or corrupt.

Force a partition table reread (safe):

sudo partprobe /dev/sda
lsblk -o NAME,SIZE,TYPE,FSTYPE,LABEL,MODEL /dev/sda

Read-only signature checks:

sudo wipefs -n /dev/sda
sudo file -s /dev/sda

If wipefs -n shows nothing and file -s prints only data,
Linux does not recognize any partition table or filesystem header.

Quick read test (read-only):

sudo dd if=/dev/sda of=/dev/null bs=1M count=16 status=progress

If this runs at normal speed, the disk is at least readable.


3) Create a Full Disk Image First (Strongly Recommended)

Make sure another disk has enough free space (≥ disk size) and supports large files (avoid FAT32):

df -hT /mnt/recovery

Install tools:

sudo apt update
sudo apt install -y gddrescue testdisk

Create directories:

sudo mkdir -p /mnt/recovery/sda_backup
sudo mkdir -p /mnt/recovery/sda_recovered

First ddrescue pass (fast, minimal retries)

sudo ddrescue -f -n /dev/sda \
  /mnt/recovery/sda_backup/sda.img \
  /mnt/recovery/sda_backup/sda.log

Optional second pass if there were read errors:

sudo ddrescue -f -d -r3 /dev/sda \
  /mnt/recovery/sda_backup/sda.img \
  /mnt/recovery/sda_backup/sda.log

If you end up with 100% rescued and 0 read errors, the entire disk has been safely captured.


4) Use TestDisk on the Image to Find the Lost Partition

sudo testdisk /mnt/recovery/sda_backup/sda.img

In the interactive UI:

  1. Select the disk image
  2. Analyse → Quick Search
    (Use Deeper Search only if needed)
  3. Highlight a candidate partition and press P to list files

If P shows your real folders/files, that partition entry is correct.

Optional: Copy Files Out

  • Press a to select all → C (uppercase) to copy
  • Destination:/mnt/recovery/sda_recovered

If space is limited, copy only what you need.


5) Restore the Partition Table to the Original Disk

⚠️ Do this only after you have a full backup image.

Run TestDisk on the real device:

sudo testdisk /dev/sda

Steps:

  1. Analyse → Quick Search
  2. Highlight the correct partition and press P to confirm files
  3. Back in the list:
    • Set the correct entry to P (Primary)
    • Set wrong/overlapping entries to D (Deleted)
  4. Press Enter → Write → Y

This writes the recovered partition table back to /dev/sda.


6) Reload Partition Info and Mount (Read-Only First)

sudo partprobe /dev/sda
sudo partx -u /dev/sda
lsblk -f /dev/sda

You should now see:

/dev/sda1

Mount read-only to verify:

sudo mkdir -p /media/external
sudo mount -o ro /dev/sda1 /media/external

If everything looks correct:

sudo umount /media/external
sudo mount /dev/sda1 /media/external

Troubleshooting Notes

  • Seeing NTFS when you expected exFAT
    Trust what TestDisk reports; the drive may have been formatted differently than you remember.
  • NTFS “hibernated / unsafe state” warnings
    Best fix is on Windows:chkdsk /f Linux-side helper:sudo ntfsfix /dev/sda1
  • I/O errors or USB resets
    Change cable/port/enclosure, avoid hubs, ensure sufficient power, then image with ddrescue.
  • TestDisk can’t list files
    The filesystem metadata may be damaged. As a last resort, use PhotoRec (filenames/folders are usually lost).

Summary

  • The mount error was a symptom; the key clue was no /dev/sda1
  • The real issue was a missing or corrupt partition table
  • Best practice is always:

Image first with ddrescue, then analyze and recover with TestDisk.

留下评论

通过 WordPress.com 设计一个这样的站点
从这里开始