Messages in this thread | | | From | danielt@digi ... | Date | Wed, 17 Nov 1999 11:20:20 -0600 (CST) | Subject | Re: Ext2 defragmentation |
| |
On Wed, 17 Nov 1999, Theodore Y. Ts'o wrote:
> From: danielt@digi.com > Date: Wed, 17 Nov 1999 10:03:36 -0600 (CST) > > The superblock at the first 32M should always be there. > It would be the first backup with 4k blocks and the > fourth with 1k blocks (or the second with 2k blocks?). > > No, it's not that simple. The superblock is located at: > > superblock_offset = superblock_n * block_size > > where > > superblock = 1 + (blocks_per_group * n) > blocks_per_group = block_size * 8 > > Using 4k blocks, the first superblock is located at 32769 * 4k, or an > offset of 131076k. Using 1k blocks, the sixteenth (not 4th!) > superblock is located at (8192*16 + 1) * 1k, for an offset of 131073k. > > So yes, there is a superblock somewhere around 128 Meg which is the > first superblock on a 4k filesystem and the 16th superblock on a 1k > system, but it's not quite in the same place. > I see. So you need some way of identifying the block size and whether sparse superblocks are enabled to find the real superblock.
I don't suppose using a "magic number" head and tail on the superblock is a viable option here? Say 4 bytes at the head and tail of the superblock that would allow for a search for a valid superblock.
It would require significant changes, but should be robust enough for about any service. Especially since the odds of random data reproducing a valid signature at a valid potential location are minimal. Of course the search only gets invoked if the specified superblock is not present/valid and after checking with the user.
-- Daniel Taylor Senior Test Engineer Digi International danielt@digi.com Open systems win.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |