Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#165796 - 13/06/2003 20:14 mkinitrd on RedHat 7.1 ?
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I decided it was time to upgrade the kernel on my RH 7.1 box to something a little more recent and start using ext3.

Thankfully up2date did me proud and the upgrade of the kernel went well. This box only has a single root filesystem. I ran tune2fs to convert the root filesystem and rebooted.

When it rebooted the root filesystem got mounted as ext2 not ext3. I did some digging and discovered that the reason is that ext3 is built as a module.

The info I found tells me I need to run mkinitrd to add the ext3 module to the initial ram disk. The problem is that mkinitrd doesn't look like it is working properly.

I run:

mkinitrd /boot/vmlinux-2.4.20-18.7-test 2.4.20-18.7

which runs with no errors. I then look at the contents of /boot:

-rw-r--r-- 1 root root 2993373 May 29 13:56 vmlinux-2.4.20-18.7
-rw-r--r-- 1 root root 117494 Jun 14 03:59 vmlinux-2.4.20-18.7-test

vmlinux-2.4.20-18.7 is the initrd that the system is currently booting from and it is nearly 3Mb in size, my newly created initrd is only 117Kb.

Something obviously isn't right with my new initrd, it is just too small.

What am I doing wrong?
_________________________
Remind me to change my signature to something more interesting someday

Top
#165797 - 14/06/2003 07:22 Re: mkinitrd on RedHat 7.1 ? [Re: andy]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Hmm. Your kernel is nearly 3M in size. Admittedly that's uncompressed, but that still sounds large to me. Which suggests that you already have a lot of stuff built in that could otherwisebe modularised.

I'm trying to work out why you would want ext3 as a module anyway. It's not like you'd ever unload it.
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#165798 - 15/06/2003 04:35 Re: mkinitrd on RedHat 7.1 ? [Re: genixia]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Hmm. Your kernel is nearly 3M in size. Admittedly that's uncompressed, but that still sounds large to me. Which suggests that you already have a lot of stuff built in that could otherwisebe modularised.

Ok looks like I don't understand how this initrd stuff works. Last time I was messing about changing kernels on Linux boxes (way back before 2.x) things were more simple. There was no initrd so I just compiled a new kernel, added an entry to /etc/lilo.conf, ran lilo and rebooted.

Now I am using RedHat and I don't want to start building my own kernel at this point (I was just trying to get ext3 working before going away for three weeks).

Looking at the kernel config file 933 items are built as modules !

Here is some of the stuff I have in "/boot":

2993373 May 29 13:56 vmlinux-2.4.20-18.7
117248 Jun 14 04:05 vmlinux-2.4.20-18.7-test
2280836 Apr 9 2001 vmlinux-2.4.2-2
1073013 May 29 13:56 vmlinuz-2.4.20-18.7
781806 Apr 9 2001 vmlinuz-2.4.2-2

Version 2.4.2 is the kernel I was running from install, 2.4.20 is what I have just upgraded to using up2date.

Because the file sizes are so large I had assumed that those files weren't just the kernel, but also had the initrd tacked onto the end of them ?

When I ran "mkinitrd /boot/vmlinux-2.4.20-18.7-test 2.4.20-18.7" I expected to end up with a file "/boot/vmlinux-2.4.20-18.7-test" that was just slightly larger than "/boot/vmlinux-2.4.20-18.7" because it would now also contain ext3.o (I looked at the source of mkinitrd, it looks in "/etc/fstab" and if there are any ext3 entries includes ext3.o).

If those files aren't the kernel plus the initrd, then where does RedHat keep the initrd images ?

Confused :-(

I'm trying to work out why you would want ext3 as a module anyway. It's not like you'd ever unload it.

Because that's the way it is built on RedHat.
_________________________
Remind me to change my signature to something more interesting someday

Top
#165799 - 15/06/2003 04:46 Re: mkinitrd on RedHat 7.1 ? [Re: andy]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I think I might have worked it out.

I think that the moment that I'm not using an initrd at all, because my system doesn't have scsi or anything else that requires it. So those files in /boot really are just kernel images.

So I need to run mkinitrd to produce the initrd image in /boot, then add a new entry to /etc/lilo.conf, complete with an initrd line. Then run lilo.

About to try it...
_________________________
Remind me to change my signature to something more interesting someday

Top
#165800 - 15/06/2003 04:57 Re: mkinitrd on RedHat 7.1 ? [Re: andy]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I was right:

[root@dipsy /root]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
/proc /proc proc rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
/dev/hda6 /boot16 ext2 rw 0 0
none /dev/shm tmpfs rw 0 0
none /dev/pts devpts rw 0 0
automount(pid697) /misc autofs rw 0 0


Success, I can now be fairly sure that if the power goes out for more than 20 minutes while I'm away that I won't be stuck with a Linux box that won't boot. It is protected with a UPS, but only the Win2k box is setup to shutdown cleanly at the moment, the Linux box just gets it's power yanked after 20 minutes on batteries.

Right, time to go and cut the lawn...
_________________________
Remind me to change my signature to something more interesting someday

Top
#165801 - 15/06/2003 09:48 Re: mkinitrd on RedHat 7.1 ? [Re: andy]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Cool. Should have thought about that. I'd still personally build ext3 into the kernel (ie non-modular), simply because it's always going to be in use. Modules have some overhead.

wrt to your UPS situation, if you have an APC UPS then check out apcupsd. apcupsd will run in network mode, so one UPS can trigger multiple machines. Runs fine on *nix and Win.
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#165802 - 15/06/2003 11:27 Re: mkinitrd on RedHat 7.1 ? [Re: genixia]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I'd still personally build ext3 into the kernel (ie non-modular), simply because it's always going to be in use. Modules have some overhead.

I think I'll stick to the RedHat supplied kernel. This box is my mail DNS/MX server, the overwhelming requirement is that it be stable and reliable. Memory usage and performance come second.

wrt to your UPS situation, if you have an APC UPS then check out apcupsd. apcupsd will run in network mode, so one UPS can trigger multiple machines. Runs fine on *nix and Win.

I'll have to take a look at that. Not before I got on holiday though, it looks complex enough to screw up so that it doesn't work on the first attempt...
_________________________
Remind me to change my signature to something more interesting someday

Top
#165803 - 15/06/2003 11:57 Re: mkinitrd on RedHat 7.1 ? [Re: andy]
Mataglap
enthusiast

Registered: 11/06/2003
Posts: 384
The initrd file contains only those modules necessary to boot and mount your / filesystem (and a few other things to help out). Typically it's filesystem modules, scsi controller modules, or raid (md) modules.

When the computer boots it just starts reading the hard drive at a certain point and executing the code it finds. Your boot loader makes sure this is your kernel. The initrd file contains all of the modules the kernel needs to get access to the rest of your system, because the kernel was't started knowing about your disk controllers and filesystems.

At a certain point the system does the "pivot_root" process which is where the filesystems are actually mounted and programs other than the kernel can run, like init.

Make a copy of your initrd file. Add a .gz to the end of the filename. gzip -d copyofinitrd.gz; mount -t ext2 -o loop copyofinitrd /mnt; cd /mnt; ls

And you can look at what's inside of the initrd file.

--Nathan

Top