initrd vs initramfs linux

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

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

Lets create initramfs:
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

Leave a Reply

Your email address will not be published. Required fields are marked *