Grub4ext4




            grub4ext4: Current Status and Future Plans

                          Bergwolf@bupt.org

                      Broad-band Network Research Center
Grub4ext4




Agenda



    1 Introduction to grub4ext4



    2 Current Status



    3 Future Plans
Grub4ext4
 Introduction to grub4ext4




What 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 grub4ext4




Proposed features of grub4ext4

    The initial motivation of ext4 file 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 2.6.25.1)
Grub4ext4
 Current Status




Agenda



    1 Introduction to grub4ext4



    2 Current Status



    3 Future Plans
Grub4ext4
 Current Status




Current status of grub4ext4



            Now GRUB legacy is able to read extents enabled
            partitions(without other ext4 incompatible features).
            Each file in the file system is divided into several logical
            blocks, and stored on disk in forms of several physical blocks.
            Ext4 file system uses extent mapping to map the logical block
            number of a file to physical block number, which is different
            from indirect mapping in ext2/3.
Grub4ext4
 Current Status




Indirect mapping in ext2/3




    Figure: ext2/3 indirect mapping, image taken from ’Taking advantage of
    Ext3 journaling file system in a forensic investigation’ by
    gnarvae@yahoo.com
Grub4ext4
 Current Status




Extent mapping
    The biggest advantage of extent mapping over indirect mapping is
    that it avoids disk seeking when the file 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 first store one
    ext4 extent header and four ext4 extent. When the file needs more
    than four ext4 extent, it expands to an extent tree.




    Figure: ext4 extent tree, image taken from ’The new ext4 filesystem:
    current status and future plans’ by Andreas Dilger and Alex Tomas
Grub4ext4
 Current Status




What I have done?

    Based on ext4 ext find 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 buffer. Go to (1)
            (3)the current level is the leaf. So look for the closest extent
            and return the physical block.
Grub4ext4
 Current Status




Test results



       I have run a simple test on my code. It worked just fine 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 Plans




Future 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 flexible block groups.
Grub4ext4
 Future Plans




                              Q&A

                              Thank You!




                no rights reserved except that of others

grub4ext4 status-plans

  • 1.
    Grub4ext4 grub4ext4: Current Status and Future Plans Bergwolf@bupt.org Broad-band Network Research Center
  • 2.
    Grub4ext4 Agenda 1 Introduction to grub4ext4 2 Current Status 3 Future Plans
  • 3.
    Grub4ext4 Introduction togrub4ext4 What 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.
  • 4.
    Grub4ext4 Introduction togrub4ext4 Proposed features of grub4ext4 The initial motivation of ext4 file 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 2.6.25.1)
  • 5.
    Grub4ext4 Current Status Agenda 1 Introduction to grub4ext4 2 Current Status 3 Future Plans
  • 6.
    Grub4ext4 Current Status Currentstatus of grub4ext4 Now GRUB legacy is able to read extents enabled partitions(without other ext4 incompatible features). Each file in the file system is divided into several logical blocks, and stored on disk in forms of several physical blocks. Ext4 file system uses extent mapping to map the logical block number of a file to physical block number, which is different from indirect mapping in ext2/3.
  • 7.
    Grub4ext4 Current Status Indirectmapping in ext2/3 Figure: ext2/3 indirect mapping, image taken from ’Taking advantage of Ext3 journaling file system in a forensic investigation’ by gnarvae@yahoo.com
  • 8.
    Grub4ext4 Current Status Extentmapping The biggest advantage of extent mapping over indirect mapping is that it avoids disk seeking when the file is allocated continuously. Figure: ext4 extent mapping, image taken from ’Ext4: The Next Generation of Ext2/3’ by Theodore Ts’o
  • 9.
    Grub4ext4 Current Status i block(60 bytes) in ext4 inode structure can first store one ext4 extent header and four ext4 extent. When the file needs more than four ext4 extent, it expands to an extent tree. Figure: ext4 extent tree, image taken from ’The new ext4 filesystem: current status and future plans’ by Andreas Dilger and Alex Tomas
  • 10.
    Grub4ext4 Current Status WhatI have done? Based on ext4 ext find 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 buffer. Go to (1) (3)the current level is the leaf. So look for the closest extent and return the physical block.
  • 11.
    Grub4ext4 Current Status Testresults I have run a simple test on my code. It worked just fine 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.
  • 12.
    Grub4ext4 Future Plans Futurework 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 flexible block groups.
  • 13.
    Grub4ext4 Future Plans Q&A Thank You! no rights reserved except that of others