How to find superblock?

5,582

You can also find the superblock with

mkfs.ext4 -n /dev/sda
mkfs.ext2 -n /dev/sda

(pick ext4/ext2 if your system is ext4/ext2; REPLACE sda with your disk). From the manual:

-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.

Repairing

fsck -b 11111 /dev/sda

where 11111 is the superblock, and sda the partition (REPLACE both with what you need).

Share:
5,582

Related videos on Youtube

Ani
Author by

Ani

Updated on September 18, 2022

Comments

  • Ani
    Ani almost 2 years

    I am trying to find the superblock with dumpe2fs command, but with this output there is no information about superblocks.

    • guiverc
      guiverc about 6 years
      i don't know what you want; but man dumpe2fs says -h "only display the superblock information and not any of the block group..."
    • Rinzwind
      Rinzwind about 6 years
      @guiverc dumpe2fs can error out and not show the superblock ;) The answer uses the "backup" location for the superblock (dumpe2fs does not use that one).
  • Ani
    Ani about 6 years
    trying with mkfs.ext2 coz my fs is ext2
  • Ani
    Ani about 6 years
    not working after mkfs.ext2 command ask for wipe all data from partition
  • Rinzwind
    Rinzwind about 6 years
    You did not include the -n: "Causes mke2fs to not actually create a filesystem" ? man page for ext2 is the same: linux.die.net/man/8/mkfs.ext2
  • Ani
    Ani about 6 years
    root@aniket-VirtualBox:/home/aniket# mkfs.ext2 -n /dev/sda1 mke2fs 1.42.13 (17-May-2015) /dev/sda1 contains a ext2 file system last mounted on /boot on Wed May 9 14:14:10 2018 Proceed anyway? (y,n)
  • Rinzwind
    Rinzwind about 6 years
    How is that "ask(ing) for wipe all data from partition"?
  • Ani
    Ani about 6 years
    i think mkfs is only use for apply fs on block not for checking super-block information
  • Rinzwind
    Rinzwind about 6 years
    Then explain the "-n" option to me ;-) That options shows the location of the superblock based on the --backup-- it created when making the filesystem. In case tools error out you can use that one since it is saved elsewhere it is likely to be corrupted if your superblock is.
  • Ani
    Ani about 6 years
    for this option check man page u will get all information related -n