# Why should I use InitramFS?

## GSnake

That's my question! Why should I use it? 

(Linux n00b here!)

Thanks!

----------

## CrankyPenguin

With recent versions of udev it is required if you have a "complex" drive layout.  In practical terms this means having a separate /usr partition.  

The rationale is simple.  The kernel and udev require certain programs to boot that are scattered across /sbin /bin /usr/sbin, and so on.  Thus it needs to have a basic set of programs to boot.  However with the latest udev these programs are required before all of the drives are up and running as per fstab.  Thus you need an initramfs to get the code up and running so that the rest of the booting takes place.  

That's the general picture.  For more detailed info I suggest you search the boards for udef info.  NeddySeagoon has put up some useful info.

----------

## GSnake

Ok so since I have an "all-in-one" partition won't be needed..but.. how does the initramfs know from where it should load all the binaries?

----------

## CrankyPenguin

When the initramfs is built you give it that information as well as lists of kernel modules to include.  You can do this "manually" using tools that come with the kernel distro or using a script.  Personally I use genkernel which builds a nice vanilla ramfs even for non gentoo kernels.  

There may be other reasons for the initramfs as well.  While the current udev (171-r9) requires it just for multiple partitions I know that bigger changes will be needed for udev 18x.  That is being held off till the docs are ready but you may want to look into it now since you are asking.  I believe NeddySeagoon has a good howto.  I was caught by surprise for the current change since it came as a standard update and had to spend more time fixing it after the fact than I cared to.

----------

## The Doctor

 *GSnake wrote:*   

> That's my question! Why should I use it? 
> 
> (Linux n00b here!)
> 
> Thanks!

 I think the more general answer to your question is to do things the kernel cannot do for itself. As noted above, one of these things recently became mount /user. A more planned example would be root on lvm. You can't use the lvm until you assemble it, and you can't  assemble it without the tools stored there. 

An initramfs is basically just a busybox script and compressed, striped down copy of your filesystem. The script includes the instructions that can either be as simple as assembling a known configuration to probing hardware and taking the appropriated action a binary distro or live CD.

It is completely practical to manually configure a kernel so one is not required. This does, however, require some knowledge or research on your part.  This website can help with that.

They do, however, offer an increase in options. Using an initramfs it is possible to encrypted the entire drive (except /boot).  They also slow down the boot process, so if you can do without you may want to.

----------

## greyspoke

A few more specific uses:

An initramfs is needed if any partition needed for booting is on a software RAID array managed by mdadm, at least for more recent versions of mdadm which don't seem to work with the auto assembler built into the kernel.

Another use is that you can create an initramfs with a larger array of tools in it than is needed just for booting and use it as a built in rescue CD.  I have found this useful on occasions when I have "updated" my system into an unusable state.  (Unless I set my grub.conf to go straight into the default kernel configuration without a delay, which renders having a rescue option in your grub.conf pointless...) 

Initramfs is also how bootsplash gets to work early on in the boot process.

----------

## GSnake

Thank you guys!

----------

