Skip to contentSkip to conversation

'-b superblock' flag for tune2fs

PATCH New Josh Glover 1 participant 1 message Mar 22, 2003 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 '-b superblock' flag for tune2fs

I searched the archives of this list, as well as a general Google search, and found nothing to suggest that this has been suggested and dismissed as a bad idea, so here goes:

The attached patch adds the '-b superblock' flag to tune2fs. The flag works exactly like the '-b superblock' flag to e2fsck:

-b superblock
Instead of using the normal superblock, use an alternative
superblock specified by superblock. This option is normally
used when the primary superblock has been corrupted. The loca- tion of the backup superblock is dependent on the filesystem's
blocksize. For filesystems with 1k blocksizes, a backup
superblock can be found at block 8193; for filesystems with 2k blocksizes, at block 16384; and for 4k blocksizes, at block 32768.

Additional backup superblocks can be determined by using the mke2fs program using the -n option to print out where the
superblocks were created. The -b option to mke2fs, which spec-
ifies blocksize of the filesystem must be specified in order for the superblock locations that are printed out to be accurate.

If an alternative superblock is specified and the filesystem is not opened read-only, e2fsck will make sure that the primary superblock is updated appropriately upon completion of the filesystem check.

So, you could run 'tune2fs -b 16384 -l /dev/hda1' on a filesystem with a blocksize of 2K and a block group size of 16384 to look at the first of the backup superblocks on the filesystem.

I found this flag to be useful, but YMMV, of course. As noted in the patch filename, I generated the patch against version 1.32 of e2fsprogs.

Cheers,
Josh

Signature · 8 lines
Josh Glover <[email protected]>

Associate Systems Administrator
INCOGEN, Inc.
http://www.incogen.com/

GPG keyID 0x62386967 (7479 1A7A 46E6 041D 67AE  2546 A867 DBB1 6238 6967)
gpg --keyserver pgp.mit.edu --recv-keys 62386967
misc/tune2fs.8.in +30 -0
diff -uNr e2fsprogs-1.32/misc/tune2fs.8.in 0_JMGLOV_e2fsprogs-1.32/misc/tune2fs.8.in
@@ -8,6 +8,10 @@
 .SH SYNOPSIS
 .B tune2fs
 [
+.B \-b
+.I superblock
+]
+[
 .B \-l
 ]
 [
@@ -87,6 +91,32 @@
 adjusts tunable filesystem parameters on a Linux second extended filesystem.
 .SH OPTIONS
 .TP
+.BI \-b " superblock"
+Instead of using the normal superblock, use an alternative superblock
+specified by 
+.IR superblock .
+This option is normally used when the primary superblock has been
+corrupted.  The location of the backup superblock is dependent on the
+filesystem's blocksize.  For filesystems with 1k blocksizes, a backup
+superblock can be found at block 8193; for filesystems with 2k
+blocksizes, at block 16384; and for 4k blocksizes, at block 32768.  
+.IP
+Additional backup superblocks can be determined by using the 
+.B mke2fs 
+program using the 
+.B \-n
+option to print out where the superblocks were created.   The 
+.B \-b 
+option to 
+.BR mke2fs ,
+which specifies blocksize of the filesystem must be specified in order
+for the superblock locations that are printed out to be accurate.
+.IP
+If an alternative superblock is specified and  
+the filesystem is not opened read-only, e2fsck will make sure that the
+primary superblock is updated appropriately upon completion of the 
+filesystem check.
+.TP
 .BI \-c " max-mount-counts"
 Adjust the maximal mounts count between two filesystem checks.  If 
 .I max-mount-counts
misc/tune2fs.c +28 -13

67 lines not on this page · raw message