How to Fix “Error mounting /dev/sdb2 at /media/ubuntu” in Ubuntu

This error typically occurs when Ubuntu can’t mount a partition due to filesystem issues. Follow these steps to resolve it:

🔧 Prerequisites

  • Administrative access (sudo privileges)
  • Backup critical data if possible

📌 Step 1: Identify the Partition

sudo fdisk -l

Look for your problematic partition (e.g., /dev/sdb2) and note its filesystem type.

📌 Step 2: Install Required Tools

sudo apt update
sudo apt install ntfs-3g exfat-fuse exfat-utils

📌 Step 3: Manual Mounting Attempt

sudo mkdir -p /media/ubuntu/drive
sudo mount -t ntfs /dev/sdb2 /media/ubuntu/drive

📌 Step 4: Repair Filesystem

For NTFS Partitions:

sudo ntfsfix -d /dev/sdb2

For ext4/ext3/ext2:

sudo umount /dev/sdb2
sudo fsck -y /dev/sdb2
⚠️ Important: Always unmount the drive before running repair commands!

📌 Step 5: Superblock Recovery (ext4)

sudo mke2fs -n /dev/sdb2  # Find backups
sudo fsck -b 32768 /dev/sdb2

📌 Step 6: Last Resort – Reformat

sudo mkfs.ntfs /dev/sdb2  # Erases all data!

💡 Summary

  1. Confirm partition details with fdisk -l
  2. Use ntfsfix or fsck for repairs
  3. Restore superblocks if needed
  4. Reformat only as last option

🔗 Additional Tips

  • Check disk health: sudo smartctl -a /dev/sdb
  • Always safely eject drives