Q. How can I Recover a bad superblock from a corrupted ext3 partition to get back my data? I’m getting following error:
/dev/sda2: Input/output error
mount: /dev/sda2: can’t read superblock
How do I fix this error?
A. Linux ext2/3 filesystem stores superblock at different backup location so it is possible to get back data from corrupted partition.
A. Linux ext2/3 filesystem stores superblock at different backup location so it is possible to get back data from corrupted partition.

If your system will give you a terminal type the following command, else boot Linux system from rescue disk (boot from 1st CD/DVD. At boot: prompt type command linux rescue).
Mount partition using alternate superblock
Find out superblock location for /dev/sda2:
Sample output:
# dumpe2fs /dev/sda2 | grep superblock
Sample output:
Primary superblock at 0, Group descriptors at 1-6 Backup superblock at 32768, Group descriptors at 32769-32774 Backup superblock at 98304, Group descriptors at 98305-98310 Backup superblock at 163840, Group descriptors at 163841-163846 Backup superblock at 229376, Group descriptors at 229377-229382 Backup superblock at 294912, Group descriptors at 294913-294918 Backup superblock at 819200, Group descriptors at 819201-819206 Backup superblock at 884736, Group descriptors at 884737-884742 Backup superblock at 1605632, Group descriptors at 1605633-1605638 Backup superblock at 2654208, Group descriptors at 2654209-2654214 Backup superblock at 4096000, Group descriptors at 4096001-4096006 Backup superblock at 7962624, Group descriptors at 7962625-7962630 Backup superblock at 11239424, Group descriptors at 11239425-11239430 Backup superblock at 20480000, Group descriptors at 20480001-20480006 Backup superblock at 23887872, Group descriptors at 23887873-23887878
Now check and repair a Linux file system using alternate superblock # 32768:
Sample output:
# fsck -b 32768 /dev/sda2
Sample output:
fsck 1.40.2 (12-Jul-2007) e2fsck 1.40.2 (12-Jul-2007) /dev/sda2 was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Free blocks count wrong for group #241 (32254, counted=32253). Fix? yes Free blocks count wrong for group #362 (32254, counted=32248). Fix ? yes Free blocks count wrong for group #368 (32254, counted=27774). Fix ? yes .......... /dev/sda2: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks
Now try to mount file system using mount command:
You can also use superblock stored at 32768 to mount partition, enter:
Try to browse and access file system:
# mount /dev/sda2 /mnt
You can also use superblock stored at 32768 to mount partition, enter:
# mount sb={alternative-superblock} /dev/device /mnt
# mount sb=32768 /dev/sda2 /mnt
Try to browse and access file system:
# cd /mnt
# mkdir test
# ls -l
# cp file /path/to/safe/location
You should always keep backup of all important data including configuration files.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 39 comments so far... add one ↓
🐧 39 comments so far... add one ↓
Related Tutorials
Linux NFS Mount: wrong fs type, bad option, bad…
FreeBSD: pkg_version: corrupted record (pkgdep line…
What you need to back up on Linux to recover
Linux Recover From A Lost Software RAID device…
Linux AWS: Find And Delete All Files Securely So…
How to: HP-UX UNIX Backup and Recover Data to Tape Device
Linux ntpd sendto() Bad file descriptor error and solution
Category | List of Unix and Linux commands |
---|---|
Disk space analyzers | df • ncdu • pydf |
File Management | cat • cp • mkdir • tree |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | NetHogs • dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Does any of this work on OpenBSD and the ffs
file system?
This is exactly what I needed instead of all the opinion with no solution.
Wrong fs type, bad option, bad superblock on /dev/sdd1
missing codepage or other error
In some cases usefull info is foinf in syslog – try
dmesg | tail or so
EXT3-fs: filesystem has both journal and inode journals!
# mke2fs -n /dev/[device and partition number]
This is making the utility you used to create the filesystem tell you where the backups are. You get a response similar to this:
# mke2fs -n /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
62248 inodes, 248976 blocks
12448 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
31 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
# mke2fs -j -n /dev/[device and partition number]
Marty.
Ashwin
I believe we will be able to mount the fs using a diff super block “only” if we r running system in rescue mode with cd media mounted,
I could not mount the fs when the system was live.. instead i was seeing help of mount command
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere’.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] … : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.