Re: initrd -- what exactly is it?
On Fri, Jan 31, 2003 at 12:42:22PM -0800, nate wrote:
> Matt Price said:
> > hi there,
> >
> > can someone help me figure out what exactly initrd is, and why
> > kernels use it? I have looked through the docs, and I understand that
> > it's thefile used for an initial ramdisk in some cases, but I don't
> > understand why it would be used in some cases and not in others. So for
> > inst ance, the demudi kernel I just installed seems to demand the use of
> > initrd, and I take it GRUB needs an anitrd argument to load the kernel.
> > But why don't my own self-compiled kernels require an initrd argument at
> > boot (nor have an initrd file anywhere in /boot, as far as I can tell)?
>
> the initrd image usually holds a small basic set of drivers used to
> get the system to a basic working state(disk controllers, filesystem
> drivers, perhaps raid or LVM as well), so it can mount the root filesystem
> and access the 'rest' of the drivers.
>
> I haven't looked into it much but I think it's primarily used so that
> you can still use modules in the kernel, having everything built into
> the kernel doesn't always work(some drivers may conflict, or may require
> certain options to be passed to them to work). If you build your own
> kernel for your own hardware, which it seems that you do(I do too) you
> probably don't need initrd(I don't use it myself), since you can just build
> your drivers directly into the kernel.
Even then it may be needed. Let's pretend you want your root
filesystem on an LVM partition which in turn rests on a software RAID
device.
1) The kernel boots.
2) RAID is built in, so the md devices autostart. Cool.
3) You activate the LVM groups. Oh wait, you need to mount /proc
first. Where are you going to mount it? Uh ...
In this scenario you must have an initrd to provide a small root fs on
a ramdisk. vgchange and vgscan (+ libraries) must be included. Now
step three goes like this:
3) mount initrd, mount /proc
4) Run vgscan
5) run vgchange to activate volume groups.
6) mount root filesystem using pivot_root.
7) continue the boot process ...
HTH,
--
Nathan Norman - Incanus Networking mailto:nnorman@incanus.net
A good plan today is better than a perfect plan tomorrow.
-- Gen. George S. Patton, Jr.
Reply to: