2000-11-19 03:40:24

by Michael Rothwell

[permalink] [raw]
Subject: ext2 sparse superblocks

I'm looking for documentation on Ext2's support for sparse superblocks.
Canvasing search engines gets me the same two references to tune2fs and
the dac960. I've also looked in /usr/doc and
/usr/src/linux/Documentation without success.

What it the method uses to reduce the number of superblocks? How are
they laid out before vs after sparse_super is enabled? Any caveats?

Thanks.

-M


2000-11-20 05:53:14

by Andreas Dilger

[permalink] [raw]
Subject: Re: ext2 sparse superblocks

Michael Rothwell write:
> I'm looking for documentation on Ext2's support for sparse superblocks.
> What it the method uses to reduce the number of superblocks? How are
> they laid out before vs after sparse_super is enabled? Any caveats?

In an old-style (non-sparse) filesystem, every block group has a superblock
copy. Only the superblock in the first group is used in normal cases. In
a sparse filesystem, superblock copies are in groups 0, 1 and ones that are
powers of 3, 5, and 7. The primary superblock is in group 0, and backups
are in groups 1, 3, 5, 7, 9, 25, 27, 49, 81, 125, etc.

This greatly reduces the number of superblock copies stored in large
filesystems. What is actually more important is that group descriptor
backups are only stored in the "sparse" groups as well. Because the
group descriptor table grows with the size of the filesystem, if there
is a backup copy in each group (as with the old non-sparse layout) it
would eventually fill the entire filesystem.

For a 1kB block non-sparse ext2 filesystem, this happens at 2TB -
basically the entire filesystem is full with metadata, and no room
to put any regular data. For a 4kB block filesystem, this would
happen at 524 TB. With sparse filesystems, the metadata will only
take a small percentage of the available space.

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert