For example we have exotic file system on the disk and in order to load system we need mount root filesystem. But we cannot because there is no suitable driver exists in kernel image.
Let me explain how I understand kernel and initrd.
- When kernel is compiled we can select different modules to be included into kernel image (one single file)
- For example my root filesystem is
reiserfsand I have configured kernel not to includemodulefor this filesystem - In this case kernel doesn't know how to mount such filesystem and it needs some help -> so load
initramfsinto the memory - Find proper module in ram fs (lib/modules or etc)
- Load this module to the kernel
- Now kernel can mount
reiserfsit mounts and than unloads (frees) memory occupied byramfs
Am I right ?
But I don't understand why do we need initramfs in every distro ( I have seen it in every distro I have ever installed) if most of specific drivers are already present in kernel image (single file) furthermore we only need drivers for filesystems when kernel boots other drivers can be loaded from the filesystem after it is mounted.
So is it really essential part of any distro ?
P.S What is used more often initramfs or initrd and why ?