≡ Menu

Linux: Find Alternative Superblocks

I think my file system has been damaged. Instead of block 1, I want to use block n as superblock. How do I find out an alternative superblock location under Linux?

Each file system has a superblock, which contains information about file system such as file system type, size, status, information about other metadata structures and so on.

You can use any one of the following command to find out the superblock location:

[a] mke2fs – Create an ext2/ext3/ext4 filesystem.

[b] dumpe2fs – dump ext2/ext3/ext4 filesystem information.

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command (alternatively you can boot from rescue or Live Linux CD and type the same commands):
# dumpe2fs /dev/sda5 | grep -i superblock
The above command will list all superblocks for /dev/sda5 as follows:

dumpe2fs 1.41.11 (14-Mar-2010)
  Primary superblock at 0, Group descriptors at 1-29
  Backup superblock at 32768, Group descriptors at 32769-32797
  Backup superblock at 98304, Group descriptors at 98305-98333
  Backup superblock at 163840, Group descriptors at 163841-163869
  Backup superblock at 229376, Group descriptors at 229377-229405
  Backup superblock at 294912, Group descriptors at 294913-294941
  Backup superblock at 819200, Group descriptors at 819201-819229
  Backup superblock at 884736, Group descriptors at 884737-884765
  Backup superblock at 1605632, Group descriptors at 1605633-1605661
  Backup superblock at 2654208, Group descriptors at 2654209-2654237
  Backup superblock at 4096000, Group descriptors at 4096001-4096029
  Backup superblock at 7962624, Group descriptors at 7962625-7962653
  Backup superblock at 11239424, Group descriptors at 11239425-11239453
  Backup superblock at 20480000, Group descriptors at 20480001-20480029
  Backup superblock at 23887872, Group descriptors at 23887873-23887901
  Backup superblock at 71663616, Group descriptors at 71663617-71663645
  Backup superblock at 78675968, Group descriptors at 78675969-78675997
  Backup superblock at 102400000, Group descriptors at 102400001-102400029

Now you can use the backup superblock to check the file system using superblock # 98304 (warning do not run the following on mounted live file system):
# e2fsck -f -b 98304 /dev/sda5
OR mount the file system using superblock # 98304:
# mkdir -p /mnt/data5
# mount -o sb=98304 /dev/sda5 /mnt/data5

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 7 comments… add one }
  • Gratzz June 3, 2011, 6:50 pm

    I am no expert but what I have been told is you have to issue a mkfs in read only mode with the exact same paramiters as your current file system.

  • Gratzz June 3, 2011, 9:42 pm

    To clarify my last comment. If the output you get from this guys command is a fault

    for example Journal backup: inode blocks
    Journal superblock magic number invalid!

    Your not totally hosed you can use mkfs with the correct paramiters to duplicate the filesystem and note the SB locations.

    If your in a raid youll want to pay attention to strip and stride.

  • gratzz August 16, 2013, 6:24 am

    I also had some luck recently using a hex editor to search for the magic number (ext4 = 0xEF53) that indicates the start of a superblock then using that sector offset as an alternate when mounting. This was in a strange location because something or one had changed the partition layout.

    Another side note: I would mount the filesystem read only and pull critical files before running a filesystem check. Just had a couple go really wrong in that situation.
    mount -o ro /dev/sdX1 /mountpoint

  • Manorama May 12, 2014, 9:31 am

    Hi ,

    We have mounted one partition after few days that server was rebooted unexpectedly,
    The file system entry was not there in /etc/fstab. So that file system is not mounted.
    I Just wanted to know what is the last mount point of that file system.
    Please advise.


  • pavloos August 19, 2014, 5:08 pm

    Hi Manorama,

    You can find this using tune2fs, example:

    # tune2fs -l /dev/vdb1 | grep “Last mounted on”
    Last mounted on: /mnt


  • Bernhard December 21, 2015, 11:19 pm

    I have a 4TB drive which was used on a raspberry, formatted with ext4. The content was copied to another hdd, but incomplete, which I didn’t realise. I formatted it in hfs+. Now I want to get the rest out of the original ext4 partition. which is not copied yet. Can I somehow restore the old partition?
    thanx for advise.

    ps I was not able to restore any suberblocks…

    regards, Bernhard

  • Hengki April 19, 2016, 8:49 pm

    Please help me to solve my problem.
    I got problem after execute this command line:
    # e2fsck -f -b 98304 /dev/dm-2
    # mount -o sb=98304 /dev/dm-2 /media/mnt_root
    mount: wrong fs type, bad option, bad superblock on /dev/mapper/centos-root,
    missing codepage or helper program, or other error
    In some cases useful info is found in syslog – try
    dmesg | tail or so.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , , , , ,