[NCLUG] (LONG) Superblocks (WAS Re: Hard disk failure)

dobbster dobbster at dobbster.com
Sat May 19 01:02:21 MDT 2001


I just noticed this.  Very interesting!  I'll see if I can get it to work... 
Thanks for the educational suggestion.

Mark (dobbster at dobbster.com)

BluKnight wrote:
> 
> Actually, there are multiple backup superblocks on a disk (scattered
> roughly every inode group)... [1]  You might try some of the others.
> Fortunately, mke2fs does support the -n flag like Solaris does[2], so you
> can simulate creating the filesystem and use that to show you where the bad
> blocks are...  However....  The following was run on one of my spare hard
> drives: (sysinfo:  PIII running Debian/Unstable, kernel 2.4.4)
> 
> alexis:/export# mke2fs /dev/hdf1
> mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> 2448000 inodes, 4887784 blocks
> 244389 blocks (5.00%) reserved for the super user
> First data block=0
> 150 block groups
> 32768 blocks per group, 32768 fragments per group
> 16320 inodes per group
> Superblock backups stored on blocks:
>         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
> 2654208,
>         4096000
> 
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
> 
> This included the sparse superblock option.  If I run it with no sparse
> superblocks (-O none) I get:
> 
> alexis:/export# mke2fs -O none /dev/hdf1
> mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> 2448000 inodes, 4887784 blocks
> 244389 blocks (5.00%) reserved for the super user
> First data block=0
> 150 block groups
> 32768 blocks per group, 32768 fragments per group
> 16320 inodes per group
> Superblock backups stored on blocks:
>         32768, 65536, 98304, 131072, 163840, 196608, 229376, 262144, 294912,
>         327680, 360448, 393216, 425984, 458752, 491520, 524288, 557056,
> 589824,
>         622592, 655360, 688128, 720896, 753664, 786432, 819200, 851968,
> 884736,
>         917504, 950272, 983040, 1015808, 1048576, 1081344, 1114112, 1146880,
>         1179648, 1212416, 1245184, 1277952, 1310720, 1343488, 1376256,
> 1409024,
>         1441792, 1474560, 1507328, 1540096, 1572864, 1605632, 1638400,
> 1671168,
>         1703936, 1736704, 1769472, 1802240, 1835008, 1867776, 1900544,
> 1933312,
>         1966080, 1998848, 2031616, 2064384, 2097152, 2129920, 2162688,
> 2195456,
>         2228224, 2260992, 2293760, 2326528, 2359296, 2392064, 2424832,
> 2457600,
>         2490368, 2523136, 2555904, 2588672, 2621440, 2654208, 2686976,
> 2719744,
>         2752512, 2785280, 2818048, 2850816, 2883584, 2916352, 2949120,
> 2981888,
>         3014656, 3047424, 3080192, 3112960, 3145728, 3178496, 3211264,
> 3244032,
>         3276800, 3309568, 3342336, 3375104, 3407872, 3440640, 3473408,
> 3506176,
>         3538944, 3571712, 3604480, 3637248, 3670016, 3702784, 3735552,
> 3768320,
>         3801088, 3833856, 3866624, 3899392, 3932160, 3964928, 3997696,
> 4030464,
>         4063232, 4096000, 4128768, 4161536, 4194304, 4227072, 4259840,
> 4292608,
>         4325376, 4358144, 4390912, 4423680, 4456448, 4489216, 4521984,
> 4554752,
>         4587520, 4620288, 4653056, 4685824, 4718592, 4751360, 4784128,
> 4816896,
>         4849664, 4882432
> 
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
> 
> Hmm. I wonder where I got that 8193 number from...  Maybe it's stuck in my
> mind from a really old filesys I created...  Lemme tinker around...  Ah,
> here it is:  the -b flag, specifies the block size:
> 
> alexis:/export# mke2fs -b 1024 -m 0 -O none /dev/hdf1
> mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
> Filesystem label=
> OS type: Linux
> Block size=1024 (log=0)
> Fragment size=1024 (log=0)
> 2444288 inodes, 19551136 blocks
> 0 blocks (0.00%) reserved for the super user
> First data block=1
> 2387 block groups
> 8192 blocks per group, 8192 fragments per group
> 1024 inodes per group
> Superblock backups stored on blocks:
>         8193, 16385, 24577, 32769, 40961, 49153, 57345, 65537, 73729, 81921,
>         90113, 98305, 106497, 114689, 122881, 131073, 139265, 147457,
> 155649,
>         163841, 172033, 180225, 188417, 196609, 204801, 212993, 221185,
> 229377,         237569, 245761, 253953, 262145, 270337, 278529, 286721,
> 294913, 303105,         311297, 319489, 327681, 335873, 344065, 352257,
> 360449, 368641, 376833,         385025, 393217, 401409, 409601, 417793,
> 425985, 434177, 442369, 450561,         458753, 466945, 475137, 483329,
> 491521, 499713, 507905, 516097, 524289,         532481, 540673, 548865,
> 557057, 565249, 573441, 581633, 589825, 598017,         606209, 614401,
> 622593, 630785, 638977, 647169, 655361, 663553, 671745,         679937,
> 688129, 696321, 704513, 712705, 720897, 729089, 737281, 745473,
> 753665, 761857, 770049, 778241, 786433, 794625, 802817, 811009, 819201,
>     827393, 835585, 843777, 851969, 860161, 868353, 876545, 884737, 892929,
>         901121, 909313, 917505, 925697, 933889, 942081, 950273, 958465,
> 966657,         974849, 983041, 991233, 999425, 1007617, 1015809, 1024001,
> 1032193,
> ....
>         19357697, 19365889, 19374081, 19382273, 19390465, 19398657,
> 19406849,
>         19415041, 19423233, 19431425, 19439617, 19447809, 19456001,
> 19464193,
>         19472385, 19480577, 19488769, 19496961, 19505153, 19513345,
> 19521537,
>         19529729, 19537921, 19546113
> 
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
> 
> Hmm, that helped...  It would help even more if you wrote down the flags
> used to create the filesystem (yeah, I know, it's hard to find without
> switching consoles, but in cases like this, it helps.)[3]
> 
> Also, if you can, look at the dumpe2fs man page -- you might get some clues
> from there.  Normal block sizes are 1024, 2048, and 4096 bytes.  Most
> likely, your inode group size hasn't changed, so if you can find the proper
> block size and do a mke2fs -n, you're in business.
> 
> I'm willing to lend more of a hand, if you really need to recover the
> drive...  Otherwise, you did have recent backups, didn't you?  ;)
> 
> --mec
> 
> [1] Heh -- I just learned all I ever wanted to know (and some stuff I
> didn't) about filesystems last week -- my company is paying for me to take
> Solaris Sysadmin classes at Sun.  Lotsa interesting stuff, even if a lot is
> review...  I learned buttloads, however...  Let's see how much I forget.  :P
> 
> [2] Actually, the flag in Solaris is -N.  Really damned nice to have,
> however.
> 
> [3] Recording the flags is something that's highly reccomended in that
> class.  Yes, disks are cheap, and if it's damaged, it's probably cheaper to
> buy a new disk...  However, is it cheap to try and restore data from tape
> and/or floppy?  Most likely, if you can recover a superblock, you can at
> least recover SOME data...  Requires some knowledge of how a filesystem
> works, however...  Hmm, may be a good talk for the next NCLUG.
> 
> _______________________________________________
> NCLUG mailing list
> NCLUG at nclug.org
> http://www.nclug.org/mailman/listinfo/nclug



More information about the NCLUG mailing list