14

I would like to know, what is the difference between initrd and initramfs?

muru
  • 197,895
  • 55
  • 485
  • 740

2 Answers2

15

Initrd is deprecated, replaced by Initramfs, which doesn't have some of the weaknesses of initrd:

  • Initrd requires at least one file system driver be compiled into the kernel
  • A disk created by Initrd has got to have a fixed size
  • All of the reads/writes on Initrd are buffered redundantly (unnecessarily) into main memory

I think that's all.


How does this update-initramfs command generate /boot/initrd.img?

It makes the necessary files into a cpio archive, which is a binary archive format (very similar to tar, not extensively used in Linux) and then uses gzip to compress that archive. Gzip is not an archive itself, just a compression (which is why you get .tar.gz archive files).

At boot time, the archive is uncompressed and unpacked onto a   ram-disk.

Also see: How a computer boots

Kulfy
  • 17,696
  • "Initrd requires at least one file system driver be compiled into the kernel".. I dint get much idea on this. Could you please explain this?? – Navaneeth Sen Nov 26 '10 at 10:16
  • Normally, File system drivers can be bolted onto the operating system at will, for some things they have to be compiled right into the kernel. Which is a pain, since all kernel versions have to be customised, get larger, introduce additional dependencies and so on. (At least that's what I believe to be the case, could well be wrong, I've not got great knowledge about file systems specifically) – Stefano Palazzo Nov 26 '10 at 10:28
  • Is it like initramfs need not be mounted initially?? – Navaneeth Sen Nov 26 '10 at 10:55
  • All file systems have to be mounted before they can be used. If you want to learn about initramfs in depth, have a look at http://en.wikipedia.org/wiki/Initrd - there's a far more detailed explanation. – Stefano Palazzo Nov 26 '10 at 11:02
  • How does this update-initramfs command generate /boot/initrd.img? – Navaneeth Sen Dec 08 '10 at 04:56
  • @Sen edited my answer to hopefully explain that too; let me know. – Stefano Palazzo Dec 08 '10 at 12:31
  • @Stefano: If i want to add some more things(like GNU toolchain or some other utilities) into the initrd.img(which i think is exactly also called initramfs), how can i do that?? – Navaneeth Sen Dec 08 '10 at 13:48
3
  • initrd was block device based, initramfs is file base.

  • with initrd, you created a file system image. with initramfs, you create an archive with the files which the kernel extracts to a tmpfs.

karthick87
  • 81,947