LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   /dev/root with EXT4-FS being mounted as EXT2-FS? (http://www.linuxquestions.org/questions/slackware-14/dev-root-with-ext4-fs-being-mounted-as-ext2-fs-797354/)

rfernandez 03-23-2010 01:22 PM

/dev/root with EXT4-FS being mounted as EXT2-FS?
 
Hi, everybody. First of all, sorry for this (probably dumb) question, but I'd like to know if this is some kind of problem or just an esthetic issue.

Here is the thing: I'm on Slackware-current and I've got a /dev/sda1 (the root partition) formatted as ext4. The output of /etc/fstab is:

Code:

/dev/sda2            swap                    swap        defaults                    0  0
/dev/sda1            /                            ext4        defaults                    1  1
/dev/sda3            /home                ext4        defaults                    1  2
#/dev/cdrom      /mnt/cdrom      auto          noauto,owner,ro    0  0
/dev/fd0              /mnt/floppy      auto          noauto,owner        0  0
devpts                /dev/pts              devpts    gid=5,mode=620  0  0
proc                    /proc                    proc        defaults                    0  0
tmpfs                  /dev/shm            tmpfs      defaults                    0  0

But, my /etc/mtab looks like this:

Code:

/dev/root / ext2 rw,relatime,barrier=1,data=ordered 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/sda3 /home ext4 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0

Now, the funny thing is that I haven't compiled my kernel (2.6.33.1) with ext2 support, and this is why i suspect this is an esthetic issue (but, I have to be sure, you know?). dmesg shows something like this:

Code:

[    4.368999] EXT4-fs (sda1): mounted filesystem with ordered data mode
[    4.372979] VFS: Mounted root (ext2 filesystem) readonly on device 8:1.

So, I really don't know, but I'd like to. =)

Other thing, I noted that the "/dev/root" symlink points to sda1 (of course), but, under the

/dev/.udev/links/root/b8:1
symlink points to
/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1

instead of /sys/device ..., but, would this be a problem?

Thanks in advance.

koenigdavidmj 03-23-2010 02:22 PM

Please list the output of the `mount` command.

rfernandez 03-23-2010 05:27 PM

mount = `cat /etc/mtab`

gnashley 03-24-2010 01:54 AM

Sorry, mount != `cat /etcmtab`
Not the same on most systems and definitely not on Slackware.

rfernandez 03-24-2010 09:26 AM

@gnashley

Sorry... I meant that the output of "mount" is the same output as "cat /etc/mtab", well, at least here, it is.

gnashley 03-24-2010 03:53 PM

Post the output of the two commands.

rfernandez 03-24-2010 08:58 PM

Code:

rodrigo@darkstar:~$ mount
/dev/root on / type ext2 (rw,relatime,barrier=1,data=ordered)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda3 on /home type ext4 (rw)
tmpfs on /dev/shm type tmpfs (rw)
rodrigo@darkstar:~$ cat /etc/mtab
/dev/root / ext2 rw,relatime,barrier=1,data=ordered 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/sda3 /home ext4 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0


LuckyCyborg 03-25-2010 09:02 AM

Quote:

Originally Posted by rfernandez (Post 3909328)
Hi, everybody. First of all, sorry for this (probably dumb) question, but I'd like to know if this is some kind of problem or just an esthetic issue.

Here is the thing: I'm on Slackware-current and I've got a /dev/sda1 (the root partition) formatted as ext4. The output of /etc/fstab is:

Code:

/dev/sda2            swap                    swap        defaults                    0  0
/dev/sda1            /                            ext4        defaults                    1  1
/dev/sda3            /home                ext4        defaults                    1  2
#/dev/cdrom      /mnt/cdrom      auto          noauto,owner,ro    0  0
/dev/fd0              /mnt/floppy      auto          noauto,owner        0  0
devpts                /dev/pts              devpts    gid=5,mode=620  0  0
proc                    /proc                    proc        defaults                    0  0
tmpfs                  /dev/shm            tmpfs      defaults                    0  0

But, my /etc/mtab looks like this:

Code:

/dev/root / ext2 rw,relatime,barrier=1,data=ordered 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/sda3 /home ext4 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0

Now, the funny thing is that I haven't compiled my kernel (2.6.33.1) with ext2 support, and this is why i suspect this is an esthetic issue (but, I have to be sure, you know?). dmesg shows something like this:

Code:

[    4.368999] EXT4-fs (sda1): mounted filesystem with ordered data mode
[    4.372979] VFS: Mounted root (ext2 filesystem) readonly on device 8:1.

So, I really don't know, but I'd like to. =)

Other thing, I noted that the "/dev/root" symlink points to sda1 (of course), but, under the

/dev/.udev/links/root/b8:1
symlink points to
/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1

instead of /sys/device ..., but, would this be a problem?

Thanks in advance.

I assume that you have a kernel configuration similar to generic, so EXT4FS is compiled as a module and Santa Claus of Linux saved your ass by a gracious kernel panic, somehow managing to mount the root partition using the built-in EXT2FS driver. :)

Use a initrd or rebuild the kernel with a proper EXT4FS built-in.

For creating a proper initrd, you can try:

Code:

mkinitrd -c -k $(uname -r) -f ext4 -r /dev/sda1 -m crc16:jbd2:mbcache:ext4 -o /boot/initrd-$(uname -r).gz
<EDIT>

I tried to reproduce the problem in a virtual machine, and it appears only if you have an incorrect initrd (-f ext2) that mounts the root partition as EXT2FS. So you have to rebuild the initrd.

rfernandez 03-25-2010 10:32 AM

@LuckyCyborg

I haven't installed ext2 support, neither as a module. I have built-in ext4 and ext3 as a module (the ext4 was built-in because then I won't need an initrd image). This is some of the .config output:

Code:

# CONFIG_EXT2_FS is not set
CONFIG_EXT3_FS=m
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set

So, if the system is really mounting /dev/root as ext2, then I don't know where this module came from.

Wops... seems that this line

Code:

CONFIG_EXT4_USE_FOR_EXT23=y
has something in it, I'll take a look into it and post something about it.

LuckyCyborg 03-25-2010 10:52 AM

Well... Your EXT4FS driver have support for EXT2/EXT3 too.

Try to use (the old good method of) EXT2FS as built-in and CONFIG_EXT4_USE_FOR_EXT23=n. Some times, the drivers can make funny things... ;-)

rfernandez 03-25-2010 11:05 AM

@LuckyCyborg

Totally agree with you. I just recompiled the kernel with CONFIG_EXT4_USE_FOR_EXT23=n, but without ext2fs. Now, the output is just the expected one:

Code:

rodrigo@darkstar:~/Source$ mount
/dev/root on / type ext4 (rw,relatime,barrier=1,data=ordered)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda3 on /home type ext4 (rw)
tmpfs on /dev/shm type tmpfs (rw)

Now, I wonder why this happend and I'm almost sure that that was just an esthetic issue. But, thank you, anyway. =)

LuckyCyborg 03-27-2010 02:46 AM

As bottom line.

Well, this problem is not only a esthetical one. Let's see what says a stock 2.6.33 (in a virtual machine):

Code:

Mar 26 12:59:06 darkstar kernel: EXT3-fs (sda1): error: couldn't mount because of unsupported optional features (240)
Mar 26 12:59:06 darkstar kernel: EXT2-fs (sda1): error: couldn't mount because of unsupported optional features (240)
Mar 26 12:59:06 darkstar kernel: VFS: Mounted root (ext4 filesystem) readonly on device 8:1.

So, for a EXT4FS root partition, kernel try to use EXT3FS, EXT2FS and finally EXT4FS driver. In your case, the EXT4FS driver also support EXT2. After EXT3FS driver gracious protest that this baby is not his problem, EXT4FS driver accept to mount the root partition AS EXT2.

What's wrong with mounting a EXT4 partition as EXT2? Well, the journaling is disabled. A simple power loss will create a big trouble, because the filesystem utilities will treat the dirty partition as EXT4 and his journal is NOT updated long time ago. That's very bad for your data... :doh:

rfernandez 03-27-2010 03:22 AM

This is very, very interesting... The partitions are formatted as EXT4-FS, so, they are EXT4-FS (I haven't ran cfdisk since Slackware installation nor mke2fs) and yet the system mounts the partition as EXT2-FS. Even more interesting, is that this begin to happen *after* kernel install 2.6.33.1, on kernel 2.6.32.9, everything was ok.

The bottom line:
Partitions *are not* EXT2-FS, but only the *root* partition were mounted so.
This all began with kernel 2.6.33.1

Another interesting thing:

Code:

Allow the ext4 file system driver code to be used for ext2 or
ext3 file system mounts
.  This allows users to reduce their
compiled kernel size by using one file system driver for
ext2, ext3, and ext4 file systems.

kernel help about CONFIG_EXT4_USE_FOR_EXT23.

Really, the problem is solved, but I have no idea at all about what happend.

jon_perez 11-24-2012 08:41 AM

This problem surfaced for me in 2.6.37.6 (Slackware 13.37), when I used virtio for the disks, e.g. /dev/root got mapped to /dev/vda1 and was being mounted as ext2.

CONFIG_EXT4_USE_FOR_EXT23=n did solve the problem, but I haven't tracked down why this was happening.

Looking through /etc/rc.d/rc.S didn't yield answers for me, but it's probably there somewhere. Could be a bug with 'mount'?


All times are GMT -5. The time now is 11:48 PM.