LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to mount ext3 filesystem (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-mount-ext3-filesystem-612786/)

kkpal 01-11-2008 01:48 AM

How to mount ext3 filesystem
 
hi all

I am creating initrd.gz file for that I was creating ext2 fs and mount that its working fine but when i try mount ext3 fs then it is giving error.
for ext2 fs I am running these commands:
# dd if=/dev/zero of=/boot/initrd bs=1M count=4
# mke2fs -F -m 0 1024 /boot/initrd
# mount -t ext2 -o loop /boot/initrd /mnt/initrd/


for ext3 fs what I will do?

Regards
KKPAL

whansard 01-11-2008 01:51 AM

the only difference between ext2 and ext3 is ext3's journal. you don't want a journal in an initrd.

kkpal 01-11-2008 02:07 AM

hi

when I was using ext2 fs to make initrd.gz image when I am booting with it the boot process ends up with this error message :

"No filesystem could mount root, tried:cramfs squashfs romfs.
kernel panic- not syncing: VFS:unable to mount root fs on unknown block(1,0)"


thats why i am trying it with ext3 fs.

what is going wrong?

regards
kkpal

whansard 01-11-2008 03:47 AM

i would guess you left ext2 out of the kernel config of the kernel that you are doing this with.

ravibhure 01-11-2008 03:55 AM

Hi,
can you try with this one
#mke2fs -j /boot/initrd
#mount -t ext3 -o remount,ro /boot/initrd

kkpal 01-11-2008 04:43 AM

its working fine for ext3 fs but it not solve my problem.
same error come at boot time.
I do not left ext2 out of the kernel config.
some lines of kernel config file:

# CONFIG_EXT2_FS=m
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

I changed last two lines

# CONFIG_EXT2_FS_XATTR=y
# CONFIG_EXT2_FS_XIP=y

Emerson 01-11-2008 08:10 AM

Quote:

Originally Posted by kkpal (Post 3018827)
its working fine for ext3 fs but it not solve my problem.
same error come at boot time.
I do not left ext2 out of the kernel config.
some lines of kernel config file:

# CONFIG_EXT2_FS=m
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

I changed last two lines

# CONFIG_EXT2_FS_XATTR=y
# CONFIG_EXT2_FS_XIP=y

This is not a proper way to configure kernel nowadays. Besides, you are doing it wrong.
Code:

CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

This will give you ext filesystem support. But it's strongly recommended to use make menuconfig for kernel configuration.

onebuck 01-11-2008 08:42 AM

Hi,

Quote:

Originally Posted by Emerson (Post 3018962)
This is not a proper way to configure kernel nowadays. Besides, you are doing it wrong.
Code:

CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

This will give you ext filesystem support. But it's strongly recommended to use make menuconfig for kernel configuration.

Not to argue but if someone wants to use a module for a kernel then there is nothing wrong or improper. As to direct editing a '.config' that is not an advised way of create/edit/update of such. Menuconfig is a curses based configure tool. If you want a 'X' based then use 'make xconfig' for your 'X' environment.

If you don't have the filesystem support compiled in the kernel then you will need to create a 'initrd'. I'm not sure what the OP is trying to do at this point.

Code:

from Slackware 12;
:~# cat /boot/README.initrd |most

  Slackware initrd mini HOWTO
by Patrick Volkerding, volkerdi@slackware.com
Wed Jun 27 15:58:08 CDT 2007

This document describes how to create and install an initrd, which may be
required to use the 2.6 kernel.  Also see "man mkinitrd".

1.  What is an initrd?
2.  Why to I need an initrd?
3.  How do I build the initrd?
4.  Now that I've built an initrd, how do I use it?


1.  What is an initrd?

Initrd stands for "initial ramdisk".  An initial ramdisk is a very small
Linux filesystem that is loaded into RAM and mounted as the kernel boots,
and before the main root filesystem is mounted.

2.  Why do I need an initrd?

The usual reason to use an initrd is because you need to load kernel
modules before mounting the root partition.  Usually these modules are
required to support the filesystem used by the root partition (ext3,
reiserfs, xfs), or perhaps the controller that the hard drive is attached
to (SCSI, RAID, etc).  Essentially, there are so many different options
available in modern Linux kernels that it isn't practical to try to ship
many different kernels to try to cover everyone's needs.  It's a lot more
flexible to ship a generic kernel and a set of kernel modules for it.
3.  How do I build the initrd?

The easiest way to make the initrd is to use the mkinitrd script included
in Slackware's mkinitrd package.  We'll walk through the process of
upgrading to the generic 2.6.21.5-smp Linux kernel using the packages
found in Slackware's slackware/a/ directory.

First, make sure the kernel, kernel modules, and mkinitrd package are
installed (the current version numbers might be a little different, so
this is just an example):

  installpkg kernel-generic-2.6.21.5_smp-i486-1.tgz
  installpkg kernel-modules-2.6.21.5_smp-i486-1.tgz
  installpkg mkinitrd-1.1.2-i486-3.tgz

Change into the /boot directory:

  cd /boot

Now you'll want to run "mkinitrd".  I'm using reiserfs for my root
filesystem, and since it's an IDE system the reiserfs module will be
the only one I need to load:

  mkinitrd -c -k 2.6.21.5-smp -m reiserfs

This should do two things.  First, it will create a directory
/boot/initrd-tree containing the initrd's filesystem.  Then it will
create an initrd (/boot/initrd.gz) from this tree.  If you wanted to,
you could make some additional changes in /boot/initrd-tree/ and
then run mkinitrd again without options to rebuild the image.  That's
optional, though, and only advanced users will need to think about that.

Here's another example:  Build an initrd image using Linux 2.6.21.5-smp
kernel modules for a system with an ext3 root partition on /dev/hdb3.

  mkinitrd -c -k 2.6.21.5-smp -m ext3 -f ext3 -r /dev/hdb3

The resulting initrd will automatically load the mbcache and jbd modules
used by the ext3 module.

To automatically use the current root filesystem and kernel, you can
simply use:

  mkinitrd -m ext3

4.  Now that I've built an initrd, how do I use it?

Now that you've got an initrd (/boot/initrd.gz), you'll want to load
it along with the kernel at boot time.  If you use LILO for your boot
loader you'll need to edit /etc/lilo.conf and add a line to load the
initrd.  Here's an example section of lilo.conf showing how this is
done:

# Linux bootable partition config begins
image = /boot/vmlinuz-generic-2.6.21.5-smp
  initrd = /boot/initrd.gz
  root = /dev/hda6
  label = Lnx26215smp
  read-only
# Linux bootable partition config ends

The initrd is loaded by the "initrd = /boot/initrd.gz" line.
Just add the line right below the line for the kernel image you use.
Save the file, and then run LILO again ('lilo' at the command line).
You'll need to run lilo every time you edit lilo.conf or rebuild the
initrd.

Other bootloaders such as syslinux also support the use of an initrd.
See the documentation for those programs for details on using an
initrd with them.


---------

Have fun!

This readme is for Slackware 12 but the information should give the general use information.

Quote:

excerpt from 'man mkinitrd';

mkinitrd is used to build an initial ramdisk. An initial ramdisk is a
very small set of files that are loaded into RAM and "mounted" (as
initramfs doesn't actually use a filesystem) as the kernel boots
(before the main root filesystem is mounted). The usual reason to use
an initrd is because you need to load kernel modules before mounting
the root partition. Usually these modules are required to support the
filesystem used by the root partition (ext3, reiserfs, xfs), or perhaps
the controller that the hard drive is attached to (SCSI, RAID, etc).
Essentially, there are so many different options available in modern
Linux kernels that it isn't practical to try to ship many different
kernels to try to cover everyone's needs. It's a lot more flexible to
ship a generic kernel and a set of kernel modules for it.

To the 'OP'; What are you trying to do?

Emerson 01-11-2008 10:13 AM

Quote:

Originally Posted by kkpal (Post 3018827)
its working fine for ext3 fs but it not solve my problem.
same error come at boot time.
I do not left ext2 out of the kernel config.
some lines of kernel config file:

# CONFIG_EXT2_FS=m
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

I changed last two lines

# CONFIG_EXT2_FS_XATTR=y
# CONFIG_EXT2_FS_XIP=y

Well, the EXT2_FS line is commented out. That's why I said it's wrong. And direct editing is certainly improper way for inexperienced users.

onebuck 01-11-2008 10:29 AM

Hi,
Quote:

Originally Posted by Emerson (Post 3019086)
Well, the EXT2_FS line is commented out. That's why I said it's wrong. And direct editing is certainly improper way for inexperienced users.

I agree that direct editing is not the way. I was pointing out that you could use modules and don't need compiled/static within your kernel for a filesystem. I was not commenting about the '.config'.

The '# CONFIG_EXT2_FS=m' was commented out as you indicated. I was responding about the initrd and support.

There are advantages to using a initrd for the filesystem and support modules.

kkpal 01-14-2008 10:59 PM

I am giving you details of my building process for embedded target (I am using T2 SDE):
1. I downloaded t2-7.0-rc2.tar.bz2 and extract it in my root directory.
2. # cd t2-7.0-rc2
3 # ./script/Config -cfg new
4 then I choose:
- Target Distribution
(embedded) Generic Embedded
-Target Style
(dietlibc) diet libc (less is more)

-Architecture, CPU and Optimisation
(x86) x86 (AMD, Intel, VIA and compatible)
(i486) Optimised for intel 486
(isolinux) Use Syslinux/isolinux as CD loader

5 # ./script/Build-Target -cfg new
6. Some packages are failed to build, I removed those from config/new/package file. (i.e. libtool, cpio, coreutils, findutils, ppp, zile, popt, util-linux, psmisc. tftp-hpa, clockspeed) and add cramfs.
and continue rerun ./script/Build-Target -cfg new
7. Build process completed.
8. # dd if=/dev/zero of=/boot/initrd bs=1M count=20
9. # mke2fs -F -m 0 -b 1024 /boot/initrd
10. # mkdir /mnt/test
11. # mount -t ext2 -o loop /boot/initrd /mnt/test
12 and copy the contents of /root/t2-7.0-rc2/build/new-7.0-rc2-embedded-x86-i486/TOOLCHAIN/rootfs into /mnt/test directory.
13. # umount /mnt/test
14. # gzip -9 /boot/initrd
15. initrd.gz file is created
16. I copied initrd.gz, vmlinuz (/root/t2-7.0-rc2/build/new-7.0-rc2-embedded-x86-i486/boot/vmlinuz_2.6.21.7-dist) and syslinux.cfg in Compact Flash.
17. # syslinux /dev/sdb1 (to make CF bootable).
18. syslinux.cfg contain:
default vmlinuz root=/dev/ram0 initrd=initrd.gz ide=nodma PMEDIA=ideflash PKEYS=us
19. when I boot my system with CF support. It ended with these errors:
No filesystem could mount root, tried: cramfs squashfs romfs
kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

I am sorry. By mistake I commented lines in my previous post.
actually these are the lines.

CONFIG_EXT2_FS=m
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set

I changed last two lines

CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_XIP=y

whansard 01-15-2008 02:26 AM

CONFIG_EXT2_FS=m

doesn't that need to be "y" to be able to mount the initrd at boot time? That's all i can think of.

Emerson 01-15-2008 07:57 AM

Quote:

Originally Posted by whansard (Post 3022852)
CONFIG_EXT2_FS=m

doesn't that need to be "y" to be able to mount the initrd at boot time? That's all i can think of.

If you set it to y then you do not need initrd.

viklahan 10-23-2008 01:36 PM

How to mount ext3 in RAM?
 

Hey Guyz! I was just wondering if its possible to mount an ext3 file system in RAM which I can later scan it.
For example... JFFS2 can be mounted and I have tried that and have been successful -

http://wiki.buici.com/wiki/Mounting_...esystem_in_RAM

It gives some information as how to mount a JFFS2 in RAM, I tried using similar commands for ext3 but then I get the following error:

ERROR: Module ext3 is in use

when I check /proc/modules I get the following abt ext3

ext3 110281 1 - Live 0xf887c000

So ext3 is already in use but then how can mount another ext3 file system in RAM?

Thanks
Vik




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