3

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

Ani
  • 31
  • i don't know what you want; but man dumpe2fs says -h "only display the superblock information and not any of the block group..." – guiverc May 09 '18 at 08:25
  • 1
    @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). – Rinzwind May 09 '18 at 08:26

1 Answers1

2

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

Rinzwind
  • 299,756
  • trying with mkfs.ext2 coz my fs is ext2 – Ani May 09 '18 at 08:58
  • not working after mkfs.ext2 command ask for wipe all data from partition – Ani May 09 '18 at 08:59
  • You did not include the -n: "Causes mke2fs to not actually create a filesystem" ? man page for ext2 is the same: https://linux.die.net/man/8/mkfs.ext2 – Rinzwind May 09 '18 at 09:01
  • 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) – Ani May 09 '18 at 09:10
  • How is that "ask(ing) for wipe all data from partition"? – Rinzwind May 09 '18 at 09:11
  • i think mkfs is only use for apply fs on block not for checking super-block information – Ani May 09 '18 at 12:06
  • 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. – Rinzwind May 09 '18 at 13:18
  • for this option check man page u will get all information related -n – Ani May 10 '18 at 07:38