Root filesystem on ext2

Bodo Thiesen bothie at gmx.de
Sun Oct 8 21:59:03 UTC 2006


"Jayjitkumar Lobhe" <jayjitkumar.lobhe at patni.com> wrote:

> - My initrd image

... is irrelevant ...

> - /etc/fstab

... which is irrelevant as well, as the *kernel* doesn't look there.

> - I dont mount the real root during [...] linuxrc [...] the kernel will 
>   mount it after linuxrc is finished.

Right, using the general autoprobe order. You have to know: ext2 and ext3 
(and ext4) are the same file systems. There are three differend drivers for 
the same file system, ext2 which supports the "normal" filesystem including 
many extenstions, but NOT supporting the extension "journalling", that 
extension is only supported by the ext3 *driver*. But again: It's the same 
file system (thus calling it ext3 and ext4 is a very very bad misnomer, but 
that is another story).

The kernel must autoprobe for the driver to use when mounting it's root file 
system as it doesn't get any hints. So it tries to mount as iso9660 ... and 
fails, it tries to mount as vfat ... and fails and so on. The order in which 
the file system *drivers* are tried is controlled by the order they are 
kernel internally registered. Your ext3 driver will be registered later than 
the ext2 driver. So ext2 will be tried first, and ext2 recognizes the file 
system as ext2 as long as the file system was unmounted correctly. So the 
ext2 driver can successfully mount the root file system, and you are stuck 
without journalling forever [i.e. until you reboot].

Solutions:

a) Make the ext3 file system driver a part of the static kernel (i.e. NOT a 
   modul). In this case the kernel code makes sure, ext3 gets registeres 
   before ext2. ext3 only works with file systems countaining a journal and 
   thus leaving those file systems which don't have a journal alone.
b) Don't unmount the root file system before rebooting *scnr*
   [Of course you would need it to be mounted as ext3 at any point for this 
   to work (a Knoppix boot would suffice), but you wouldn't consider that 
   anyways, I hope ;)]
c) Change the file system of the initrd to ANYTHING else than ext2 AND make 
   ext2 a module as like ext3. Them make sure to modprobe ext3 BEFORE ext2.

> - The system boots up successfully, mount command shows / partition
> mounted as ext3 but /proc/mount shows it as ext2.

That's another thing. When you (the kernel) mount(s) your root file system, 

1.) That file system isn't accessible nor is it writable yet (that it is 
    only AFTER being mounted)
2.) There is no mount utility doing it.

I guess, your /etc is on your root partition. In /etc you will find a file 
called mtab. That file contains the (wrong and very old) information, that 
your root was mounted using the ext3 file system driver. mount just cat's 
this file and thus shows the same wrong information. /proc/mount contains 
the current and correct information known by the kernel. Some peoble even 
deleted /etc/mtab already and replaced it by a symlink to /proc/mount. Other 
peoble told that to be a problem, I don't see the point, but just to warn 
you ;). For me, it worked fine.

Regards, Bodo




More information about the Ext3-users mailing list