initramfs vs initrd

Differences between initramfs and initrd

  • initramfs is a Linux 2.6 and above feature made up from a cpio archive of files that enables an initial root filesystem and init program to reside in kernel memory cache, rather than on a ramdisk, as with initrd filesystems.
  • with initramfs, you create an archive with the files which the kernel extracts to a tmpfs.
  • intramfs can increase boot-time flexibility, memory efficiency, and simplicity
  • dracut is the tool used to create the initramfs image.
  • initramfs location of init : /init
  • initrd is for Linux kernels 2.4 and lower
  • initrd is deprecated and is replaced by initramfs
  • initrd requires at least one file system driver be compiled into the kernel
  • initrd is a ram based block device which means that it required a fixed block of memory even if unused and as a block device, it requires a file-system, initramfs is file based (cpio of files)
  • kdump uses initrd -> /boot/initrd-2.6.32-358.2.1.el6.x86_64kdump.img
  • mkinitrd is the tool used to create the initrd image.
  • initrd location of init : /sbin/init

What is mkdumprd ?
mkdumprd creates the initrd for kdump.

mkdumprd -v -d -f /boot/initrd-`uname -r`kdump.img `uname -r`

Building an initramfs image

yum install -y dracut-network

# /etc/dracut.conf
# add the VMware network driver
sed -i 's/add_drivers+=\"\"/add_drivers+=\"vmxnet3\"/' /etc/dracut.conf
sed -i 's/#add_dracutmodules+=\"\"/#add_dracutmodules+=\"network nfs\"/' /etc/dracut.conf

# Re-Build /boot/initramfs-2.6.32-358.2.1.el6.x86_64.img
dracut -f

# lsinitrd | grep vmxnet3.ko
-rwxr--r-- 1 root root 78040 Apr 4 10:51 lib/modules/2.6.32-358.2.1.el6.x86_64/kernel/drivers/net/vmxnet3/vmxnet3.ko

# grep initramfs-$(uname -r) /etc/grub.conf
initrd /initramfs-2.6.32-358.2.1.el6.x86_64.img

Further reading

This entry was posted in linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s