What is the difference between initrd and initramfs?

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


Solution 1:

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

Solution 2:

  • 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.