We're trying to put all of the static ext4 metadata at the beginning of the disk to see whether this gives us a performance improvement (avoid seeking during e2fsck, avoid free space fragmentation). This is on a filesystem somewhat smaller than 16TB, and the flex_bg count 131072 would seem large enough to put all of groups into a single flex group.
However, running the below command spins forever, apparently trying to allocate the static metadata:
mke2fs -j -b 4096 -G 131072 -J size=1024 -i 65536 \
-O flex_bg,uninit_bg,extents -I 256 -F /dev/vgost0/lvost0 4294965248
Looking at the mke2fs/libext2fs code it appears that it will try to allocate a contiguous space for the each bitmap, so a flex_bg size of 32768 would be the maximum the number of blocks in a group. Unfortunately, with the superblock in the way, there are only 32767 free blocks in groups 0 and 1, yet we can't use this size since flex_bg size of 32767 is not allowed (must be a power of two). It would also seem possible to allocate 131071 blocks worth of bitmaps across groups 5-8 and 9-12 (each of which have a single superblock), and then go back and stuff inode tables into groups 0-4 but I'm not yet sure why it isn't doing that.
Any ideas before I have to dig into the libext2fs/flex_bg allocator?
Cheers, Andreas
--
Andreas Dilger
Lustre Technical Lead
Oracle Corporation Canada Inc.