Grub4ext4 grub4ext4: Current Status and Future Plans Bergwolf@bupt.org Broad-band Network Research Center
Grub4ext4Agenda 1 Introduction to grub4ext4 2 Current Status 3 Future Plans
Grub4ext4 Introduction to grub4ext4What is grub4ext4? grub4ext4 is a 2008 Google Summer of Code program, working with opensuse.org mentored by Colyli. grub4ext4 aims at enabling GRUB legacy to boot an ext4 partition. The program is hosted at http://code.google.com/p/grub4ext4/, Development notes can be found at http://bergwolf.googlepages.com/grub4ext4.
Grub4ext4 Introduction to grub4ext4Proposed features of grub4ext4 The initial motivation of ext4 ﬁle system is to support larger single partition using larger block numbers. There are several incompatible features in ext4 that disables GRUB legacy from booting an ext4 partition. Replace indirect mapping with extent mapping. 64-bit metadata(superblock, inode, group descriptor) changes. Flexible block groups. This allows metadata blocks to be grouped together outside of the block group that they administer, allowing contiguous regions of data blocks to span multiple block groups, and making metadata intensive workloads seek less. Multiple mount protection. Not implemented yet(as of Linux kernel 220.127.116.11)
Grub4ext4 Current StatusAgenda 1 Introduction to grub4ext4 2 Current Status 3 Future Plans
Grub4ext4 Current StatusCurrent status of grub4ext4 Now GRUB legacy is able to read extents enabled partitions(without other ext4 incompatible features). Each ﬁle in the ﬁle system is divided into several logical blocks, and stored on disk in forms of several physical blocks. Ext4 ﬁle system uses extent mapping to map the logical block number of a ﬁle to physical block number, which is diﬀerent from indirect mapping in ext2/3.
Grub4ext4 Current StatusIndirect mapping in ext2/3 Figure: ext2/3 indirect mapping, image taken from ’Taking advantage of Ext3 journaling ﬁle system in a forensic investigation’ by firstname.lastname@example.org
Grub4ext4 Current StatusExtent mapping The biggest advantage of extent mapping over indirect mapping is that it avoids disk seeking when the ﬁle is allocated continuously. Figure: ext4 extent mapping, image taken from ’Ext4: The Next Generation of Ext2/3’ by Theodore Ts’o
Grub4ext4 Current Status i block(60 bytes) in ext4 inode structure can ﬁrst store one ext4 extent header and four ext4 extent. When the ﬁle needs more than four ext4 extent, it expands to an extent tree. Figure: ext4 extent tree, image taken from ’The new ext4 ﬁlesystem: current status and future plans’ by Andreas Dilger and Alex Tomas
Grub4ext4 Current StatusWhat I have done? Based on ext4 ext ﬁnd extent, I implemented static int ext4fs block map(int logical block), which looks for the physical block number mapped to logical block instead of building the extent path which traversal the extents tree. It working in this way: (1)Check eh depth in extent header. eh depth==0, go to(3), otherwise go to(2) (2)the current level if index. Find the extent index closest to(which means the smallest ei block that is larger than the logical block) the logical block we are looking for. Read the block pointed by the index found in (2) into buﬀer. Go to (1) (3)the current level is the leaf. So look for the closest extent and return the physical block.
Grub4ext4 Current StatusTest results I have run a simple test on my code. It worked just ﬁne on 8 partitions(four ext3 partitions and four ext4 partitions with extents feature enabled) on my USB storage device. You can check the test procedure at http://bergwolf.googlepages.com/test case1, and build your own test case if you are interested.
Grub4ext4 Future PlansFuture work support incompatible 64-bit metadata changes. This is mainly about supporting changes in group descriptor. I can check EXT4 FEATURE INCOMPAT 64BIT in superblock and determine which type of group descriptor to use. support ﬂexible block groups.
Grub4ext4 Future Plans Q&A Thank You! no rights reserved except that of others