Learn how to resolve bad magic number in super-block error in Linux. This process describes step by step procedure to resolve bad magic number in super-block error.
Error: bad magic number in super-block error
So Below is the error that you may get while booting of the server.
fsck.ext4: Bad magic number in super-block while trying to open /dev/sdel /dev/sdel: The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
Now to solve this error of “bad magic number in super-block error” firstly you need to know the location of the super-block by which you can resolve the issue.
Step1: Get the location of backup superblock
This will not format file system or create any new file system. However this command will give the location of the backup superblock.
[root@rhel1 ~]# mke2fs -n /dev/sde1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 78400 inodes, 313259 blocks 15662 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=322961408 10 block groups 32768 blocks per group, 32768 fragments per group 7840 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912
As per output backup super blocks are stored at location “32768” and also at “98304”. Now let’s use location “32768” and supply this as parameter to command “e2fsck” to resolve “bad magic number in super-block” error.
Step 2: Perform file system check using “e2fsck”
Just fire command e2fsck -b and answer with “y” in case system asks.
[root@rhel1 ~]# e2fsck -b 32768 /dev/sde1 e2fsck 1.41.12 (17-May-2010) /dev/sde1 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 #0 (32192, counted=32191). Fix<y>? yes Free blocks count wrong for group #4 (32276, counted=32269). Fix<y>? yes Free blocks count wrong (307865, counted=307857). Fix<y>? yes Free inodes count wrong for group #0 (7829, counted=7826). Fix<y>? yes Free inodes count wrong for group #4 (7840, counted=7833). Fix<y>? yes Directories count wrong for group #4 (0, counted=4). Fix<y>? yes Free inodes count wrong (78389, counted=78379). Fix<y>? yes /dev/sde1: ***** FILE SYSTEM WAS MODIFIED ***** /dev/sde1: 21/78400 files (0.0% non-contiguous), 5402/313259 blocks
Now Try to mount the filesystem in this case “/home” partition.
[root@rhel1 ~]# cat /etc/fstab |grep -i /dev/sde1 /dev/sde1 /home ext4 defaults,usrjquota=aquota.user,jqfmt=vfsv0 1 2 [root@rhel1 ~]#
[root@rhel1 ~]# mount /home [root@rhel1 ~]# df /home Filesystem 1K-blocks Used Available Use% Mounted on /dev/sde1 1233308 1880 1168780 1% /home
Hence we have successfully resolved “bad magic number in super-block” error in Linux. Also this procedure guarantees protection against data loss.
View Comments (1)
You saved me! God bless you!