Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-23-2008, 08:43 AM   #1
LQ Newbie
Registered: Aug 2007
Posts: 13

Rep: Reputation: 0
Question ext3 super block get modified after mkfs.ext3

Did not find any suitable thread for Linux kernel, so started a new Topic. My apologize if, its already present.

A bit too long description of problem follows: ( Please bear with me )

I am working on CentOS 5.0 distribution. The base kernel used in it is 2.6.18-8 which is a vanilla kernel. I have modified the ext3 & ext2 super block by inducing an struct (ABC of 6 longs) inside it & reduced the reserved array (from 190 to 184) at the end of the structure. Everything works fine, except for one.

When I create a new LV using LVM or a new partition using fdisk and execute mkfs.ext2/3 to format the disk, the super block initialized using mkfs.ext2/3 is not propagated properly to on disk super block. Due to which, one of my structure member gets some junk value.

When I browsed through mkfs code from "e2fsprogs" source, found out that the latest e2fsprogs (version 1.40.8) has a default served array of 163 longs in super block structure of ext2/3. This might be the reason why my ABC structure members get some value initialized. I want it to be zero.

Further study of other versions of e2fsprogs source ( showed that version 1.29 of e2fsprogs source has 189 longs as reserved in super block of ext2/3, whereas 1.30 has 192 longs free. Don't know whether this is the problem.

But as per my understanding, when you format the disk using mkfs, mkfs.ext3 will use its super block structure for ext3 and initialize it to zero (in code, using memset) & then fill the required members. But as the structure read in mkfs is different then that present in kernel, it make the new member have some initial value.

How do you solve this problem ? Any pointers in this direction would be of great help.

I solution for the problem, I feel is to modify the mkfs utility source code to have ext3 super block similar to what is available in kernel source & then use the newly compiled mkfs utility.


Last edited by amitpardesi; 04-23-2008 at 08:47 AM.
Old 04-25-2008, 10:42 AM   #2
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.


block, ext3, modification, super

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I override the '(5.00%) reserved for the super user' mkfs.ext3 creates? guba04 Linux - Hardware 9 01-27-2008 12:20 AM
mkfs.ext3: No medium found FreezEy Arch 1 05-14-2007 02:44 PM
HELP: QTparted says There was a problem with mkfs.ext3 dhruba.bandopadhyay Linux - General 2 06-14-2006 10:27 AM
mkfs.ext3 nearly stops at about 61% of blocks ejkeebler Linux - Newbie 1 04-27-2006 06:23 PM
ext3 bad super block Sridhar Kumar K Linux - General 3 05-23-2005 08:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration