How to access a disk with bad superblock Linux Ubuntu Debian Redhat CentOS ext3 ext4

Have you ever tried mounting a partition that you exists but you get this error?

mount: /mnt: can't read superblock on /dev/sda1.

The superblock in this example was bad because the physical disk had corruption and bad blocks/sectors.  However, the data was generally accessible and you can always try this trick below (with caution and no warranty).

This is specifically for filesystems that place superblocks in multiple locations, which makes the drive accessible.

Run the mkfs for your filesystem, in this case it was ext4 and pass the "-n" option. 

mkfs.ext3 -n /dev/sda1

*Do not forget the -n above or you will destroy the partition.

Then you'll see the prompt below, once again make sure you used -n

       -n     Causes  mke2fs  to not actually create a filesystem, but display
              what it would do if it were to create a filesystem.  This can be
              used  to  determine the location of the backup superblocks for a
              particular filesystem, so long as  the  mke2fs  parameters  that
              were  passed when the filesystem was originally created are used
              again.  (With the -n option added, of course!)
 

Hit y to proceed as long as you're sure that you used the -n flag.


mke2fs 1.44.1 (24-Mar-2018)
/dev/sda1 contains a ext4 file system
    last mounted on / on Wed Jun  8 11:40:24 2022
Proceed anyway? (y,N) y

Then you'll hopefully see a list of superblocks as below:


ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/sda1 is mounted.
Creating filesystem with 120038912 4k blocks and 30015488 inodes
Filesystem UUID: 91fcf16a-7f97-47cf-82b3-654d7dca6d70
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
    102400000



You can try any of those locations, if the disk is badly damaged you may need to try a few different superblocks.

Here is how you would mount with one of the superblocks above.

mount -o sb=4096000 /dev/sda1 /mnt
 

The -o sb= is where we plugin one of the superblocks we located earlier, and I used one of them from 4096000. 

Hopefully you can access and recover most of your data if this happens to you.


Tags:

disk, superblockhave, mounting, partition, mount, mnt, superblock, dev, sda, corruption, sectors, generally, accessible, caution, warranty, filesystems, superblocks, multiple, locations, mkfs, filesystem, ext, quot, ll, prompt, mke, fs, display, determine, parameters, originally, mar, contains, mounted, wed, jun, fs_check_if_mount, mtab, determining, creating, inodes, uuid, fcf, cf, dca, backups, stored, sb, plugin, located,

Latest Articles

  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide