SLS

 
Title: HowTo: Find a backup superblock
Description: Procedure for finding a backup superblock for any SuSE version with the dumpe2fs application installed.

  • Note: This is intended to be used with ext2 and ext3 filesystems. This has not been tested (by me) with reiser or any other filesystem.

Getting the location of the backup superblocks, part I


If you are reading this, you probably either are very proactive in protecting your filesystems, or you have a damaged ext2 or ext3 filesystem, and you need to find a backup superblock.

If you fall in to the former category, you have an easy job ahead of you. Let's assume you want to find a backup superblock on /dev/hda1. All you have to do is run the command:

dumpe2fs /dev/hda1


Alternatively, if you don't want so much information, run the command:

dumpe2fs /dev/hda1 | grep Backup


This will give you a nice summary of all the backup superblocks. If you now have the backup superblock information, you can skip the next section and go right to "Attempting to fix the broken filesystem". If not, read on...


Getting the location of the backup superblocks, part II


If the last section didn't work in getting the backup superblocks, you can try another approach. Read this entire section (including the caveats at the bottom) before continuing.

First, get the size of the broken partition/filesystem. Let's assume /dev/hda1 has the problem. Run the command:

df /dev/hda1


Let's assume this tells us that there are 800000 blocks on /dev/hda1. Next, we are going to create a dummy file called "delete-me", using the same number of blocks.

dd if=/dev/zero of=/tmp/delete-me bs=1024 count=800000


Finally, create an ext2 filesystem on the new file:

mke2fs /tmp/delete-me


When prompted with a warning that this is not a block device, proceed anyway. After the filesystem is created, you will have some output, including something like:
...
Superblock backups stored on blocks:
	    32768, 98304, 163840


Since your "delete-me" file is the exact same number of blocks as your broken partition, the location of the backup superblocks should match.

A couple important caveats here:
  • Make sure you have enough space to create "delete-me"!
  • Make sure you create "delete-me" as the exact same number of blocks as the broken filesystem!

Attempting to fix the broken filesystem

Since you have a damaged filesystem, you will now need to attempt to fix it. Let's assume you want to fix /dev/hda1, and you know there is a backup superblock at 32768. First, make sure /dev/hda1 (or whichever partition you're fixing) is not mounted - it probably isn't, or you would not be reading this. Second, run the command:

e2fsck -b 32768 /dev/hda1


That's it. Let the file system check application do its thing. If you are a fortunate person, you will have a usable filesystem again when it's finished.

Sources:
edseek.com archives for the creative secondary method for getting the backup superblocks.

Credits:
http://forums.suselinuxsupport.de/, anyone who has had to recover a hosed filesystem.

Comments and Suggestions:
http://forums.suselinuxsupport.de/index.php?showtopic=14168

There are no comments on this page. [Add comment]


Warning: include(http://forums.suselinuxsupport.de/ssi.php?a=active) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/customers/webs/slwiki/actions/footer.php on line 51

Warning: include() [function.include]: Failed opening 'http://forums.suselinuxsupport.de/ssi.php?a=active' for inclusion (include_path='.:/home/customers/webs') in /home/customers/webs/slwiki/actions/footer.php on line 51

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0207 seconds