Ext4 filesystem: extent, flex_bg, sparse_super

Photo by Mr Cup / Fabien Barral on Unsplash
has_journal, ext_attr, resize_inode, dir_index, filetype, extent, 64bit, flex_bg, sparse_super, large_file, huge_file, dir_nlink, extra_isize, metadata_csum


ext2/ext3 uses the traditional indirect scheme: Direct blocks, indirect blocks, double indirect blocks, triple indirect blocks, etc.

Image source: https://www.geeksforgeeks.org/file-allocation-methods/
Image source: https://www.semanticscholar.org/paper/The-new-ext-4-filesystem-%3A-current-status-and-plans-Mathur-Cao/b8ddec47f9fab1eddb5c9cacf703781dd5337b87/figure/1


A block group consists of contiguous blocks combined. A flexible block group consists of a contiguous block group.
Each block group has inode bitmap, data block bitmap, group descriptor table (GDT), (sometimes superblock), etc. if flex_bg is enabled in ext4, the bitmap, GDT, superblock, etc of each block will be stored in the first group. Thus, only data blocks will be allocated in the block groups.


If sparse_super is enabled, the block group numbers 0, 1, and powers of 3, 5, and 7 will have backup superblocks. (e.g.: 343, 243, 125, 81, etc.).

What are the group flags?

INODE_UNINT: Inode bitmap and Inode table not initialized yet.
BLOCK_UNINT: Block bitmap has not yet been initialized.
ITABLE_ZEROED: Inode bitmap table zeroed (Assuming not all nodes are used initially).



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store