Segmentation fault in mke2fs

  • Sri

    Sri - 2013-12-02


    I have built e2fsprogs-1.42.8 for a MIPS64-based board. The tools were generated on an Intel machine with a MIPS cross compiler.

    The MIPS-based board will have a 2 TB VFAT formatted external USB hard drive connected to it. The goal is to format the 2 TB drive from VFAT to EXT4 using the 'mke2fs' program.

    When I try to run the following command, the 'mke2fs' code results in a segmentation fault:

    mke2fs -t ext4 /dev/sda1

    mke2fs 1.42.8 (20-Jun-2013)
    Segmentation fault

    As a parallel test, I tried formatting from VFAT to EXT3 for the same drive and this worked correctly. The issue only seems to occur for EXT4.

    Debugging the code, I see that the seg fault occurs in mke2fs.c: end of the should_do_undo() function in the following call:

    If you have any thoughts on this issue, please let me know.

    A few details on the MIPS-based board:
    Linux kernel: 3.4.27
    Cavium Octeon Plus dual core processor
    256 MB RAM

    Please let me know if you need additional details.


  • Theodore Ts'o

    Theodore Ts'o - 2013-12-02

    Hmm. That doesn't make any sense, since the at the point when
    should_do_undo() is called, there wouldn't be any real difference in
    how mke2fs would behave. We've parsed the command line options, but
    that's pretty much about it.

    Can you single step through should_do_undo in a debugger, and see what
    code path is getting taken, and then print out the contents of
    "channel" data structure before the seg fault?

  • Sri

    Sri - 2013-12-03

    Thanks for the reply, Theodore.

    I have been sidetracked into a different bug at the moment.
    I will bring more details to this thread once I get back on the mke2fs seg fault issue.


  • Theodore Ts'o

    Theodore Ts'o - 2013-12-03

    Sure. When you have a chance to take a closer look at this, could you send the information to the linux-ext4 mailing list at That way more people will be more likely to look at it.


    -- Ted

  • Sri

    Sri - 2013-12-10

    Hi Ted,

    I have emailed the linux-ext4 mailing list with the debug details.


  • Sri

    Sri - 2013-12-13


    I found that the segmentation fault occurs in optimized code (-O2). It does not happen when optimization is turned off. I am not sure what exactly happened but mke2fs is now able to get past that point.

    The command now fails at a different point:

    ext2fs_mkdir: EXT2 directory corrupted while creating /lost+found

    Tracing from the ext2fs_mkdir() function, I found that the code returns an error here:
    ext2fs_read_dir_block3(): returns EXT2_ET_DIR_CORRUPTED

    Any thoughts or ideas on this issue will be very helpful.


    Last edit: Sri 2013-12-13

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks