WHY block groups? Spinning disk pe head ko door jump karana slow hota hai. Agar ek file ka metadata (inode) aur uske data blocks ek hi region mein hon, toh head mushkil se hilaata hai. ext4 yeh locality idea SSDs pe bhi rakhta hai kyunki yeh fragmentation bhi kam karta hai aur allocation bitmaps ko chhota rakhta hai.
Global filesystem info: total blocks/inodes, block size, blocks-per-group, free counts, UUID, mount count, magic number 0xEF53.
Why are there backup superblocks?
Superblock critical metadata hai; agar primary (offset 1024) corrupt ho, toh fsck selected block groups mein stored backups se restore karta hai.
Why does ext4 split the disk into block groups?
Metadata ko uske data ke paas rakhne ke liye (locality/kam seek), bitmap size bound karne ke liye, aur fragmentation kam karne ke liye.
What does the block bitmap track and how big is it?
Group mein har block ke liye ek bit, used/free; yeh exactly ek block hota hai, isliye ek group 8B blocks hold karta hai (B = block size in bytes).
Blocks per group for 4 KiB blocks?
8 × 4096 = 32768 blocks = 128 MiB per group.
What is an inode and what does it NOT contain?
Ek fixed record (256 B) jisme file ka metadata + data-block locations hain; isme filename nahi hota.
Where is the filename stored?
Directory entry mein, jo name → inode number map karti hai.
What makes hard links possible?
Multiple directory entries same inode number pe point karti hain; inode mein link count hota hai, data tab free hota hai jab count 0 ho.
What are ext4 extents and why are they better?
Ek record jo logical blocks ki contiguous range ko physical blocks pe map karta hai; bade files ke liye ext2/3 indirect pointers se kaafi zyada compact/fast.
Inode usage (disk space se alag ek fixed pool), mkfs time pe set hota hai.
Recall Feynman: ek 12-saal ke bachche ko samjhao
Socho ek bada parking lot (disk) identical chunks of spaces (block groups) mein baanta gaya hai. Entrance pe ek sign (superblock) hai jo bata raha hai lot kitna bada hai aur rules kya hain. Har chunk mein ek chhota-sa checklist (bitmap) hai jo dikhata hai kaun-se spaces taken hain. Har gaadi (file) ka ek ID card (inode) hota hai jo bata hai kaun uska owner hai, kab parking ki, aur exactly kaun-se spaces use karta hai — lekin card pe gaadi ka nickname nahi hota. Nicknames ek phone book (directory) mein hain jo kehti hai "Ada ki gaadi → ID card #4732." Isliye ek gaadi ke do nicknames ho sakte hain: do phone-book lines, ek ID card.