• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy
Who cares about initrd?

Who cares about initrd?

Vijesh Vijayan

  • 6 min read
Who cares about initrd?

Generating audio, please wait...

Preface

The boot sequence of Linux starts with the BIOS determining the primary boot device (Usually the first disk). Next the grub is displayed and we choose the desired Operating System. Loading of the OS starts next and the kernel is loaded into memory. Following the Kernel, the linux initrd is mounted. After this, control is passed to the kernel. The kernel mounts the partitions and starts the init process. Init takes over and runs the scripts triggering the services needed to bring the system to a full swing. Phew, that was long. In this sequence there is one element which is less noticed, initrd. Why is it is needed at all and why is it loaded just after the mighty kernel? Lets peek into this little known utility.

Initrd in a nutshell

Initrd is the initial ram disk image. As the name suggests it an image file. The Linux kernel consists of selected drivers. However, all the drivers needed for the system to become fully functional cannot be placed within the kernel. This will make the kernel consume more space and complex and the loading of the kernel will be slow.

The initrd comes into play here. It is a temporary root file system that is mounted during system boot to support the two-state boot process. It is composed of the necessary executables and specific drivers to access the devices. After the kernel is loaded into memory. The kernel decompresses this image file and mounts it. The init executable present within it (an init different from the one in your /sbin/init ) is run next and the drivers and executables available in the initrd are utilised to mount the root partition. The task of initrd is finished here and the kernel can safely mount the / (root) partition.

Precious initrd

initrd is used primarily to install the disk drivers of RAID, SCSI etc that hold the root partition. Yet another usage is at the time of hibernation when the system will dump the image of memory to the swap. This has to be loaded from the disk back to the memory before the root filesystem is mounted. Some times the partitions are encrypted as in the case of high secure data drives and a specific utility will have to be preloaded to interpret the data in the disk partition, for this, the initrd is preconfigured with the utility to read the data from the device. In the embedded platform, as the memory finger print is quite small, the default file system used in the system will be the initrd, no disk/data is further mounted. In this case the initrd will possess all the binaries and libraries the embedded system will require.

initrd and initramfs
Now, initrd comes in two flavours, the classic initrd and the newer initramfs. initrd is a raw ext2 filesystem containing the necessary utilities whereas initramfs is cpio archieve. Both are additionally compressed with gzip. initrd is no more supported and current distributions (using the 2.6 kernel and onward) come with initramfs as default.

To determine if you are having an initrd or initramfs for your distribution, perform the below command on your inirtd file:

gunzip -c /boot/initrd-2.4.17.img.gz | file -
/dev/stdin: Linux rev 1.0 ext2 filesystem data

(This is an initrd file, notice the ext2 filesystem)

gunzip -c /boot/initrd.img-2.6.24-19-generic | file -
/dev/stdin: ASCII cpio archive

(This is an initramfs file, notice the cpio archive)

Anatomy
I will be discussing about initramfs file here on as initrd. The initrd file is present in the /boot/ directory (usually in a different partition). This file is present with the filename format initrd-kernelversion.img like initrd-2.6.18-128.el5.img. It is usually a cpio or cpio-gzip compressed archive (determinable with the file command). To observe the content in it, follow the commands below:

mkdir /tmp/initrd_unpack/
cp /boot/initrd-2.6.18-128.el5.img /tmp/initrd_unpack/
cd /tmp/initrd_unpack/
file initrd-2.6.18-128.el5.img
(to determine if this is a gzip or just a cpio archive)

mv initrd-2.6.18-128.el5.img initrd-2.6.18-128.el5.img.gz
gunzip initrd-2.6.18-128.el5.img.gz
cpio -idv < initrd-2.6.18-128.el5.img

Most of the directories present will be empty except for the lib and the dev. The lib hold the kernel object files (.ko). Each file is a loadable kernel module, this is an added feature of linux 2.6. The dev directory will hold device files.

custom tailored images
There are two commands which can be used to make the initrd images. On debian/ubuntu systems, mkinitramfs can be used. The command to be used is:
mkinitramfs -v -o /tmp/initramfs-$(uname -r)

In redhat based systems, mkinitrd may be used. The command in this case is:

 

mkinitrd /tmp/initrd-$(uname -r).img $(uname -r)

eg: mkinitrd /tmp/initrd-2.2.16-3ext3.img 2.2.16-3ext3

 

The second argument is the directory in /lib/modules/ from which the necessary driver modules are retrieved. recollect that uname -r only provides the kernel version of the currenly loaded kernel, so if the kernel for which the image to be made is different, it has to be specified explicitly.

In either of the two commands the image file is created in the tmp directory. The image thus created will have to be moved to /boot and grub will have to be configured to use the new one. For this, edit the line beginning with initrd corresponding to the required kernel (eg: for the kernel /boot/vmlinuz-2.4.20-24.9, the line is initrd /boot/initrd-2.4.20-24.9.img) to the newer one and you are done.

  • Linux

AIDE to aid your server security needs

SupportSages Logo
  • Linux
  • Security
logo

All about SSL

All about SSL
  • cPanel
  • General
  • Howtos
  • Linux
  • Snippets
  • Training
  • Troubleshooting
  • VPS
logo

IFS

IFS
  • cPanel
  • Customer Care
  • General
  • Howtos
  • Linux
  • Offers
  • PostgreSQL
  • Security
  • Snippets
  • Special Offers
  • Training
  • Troubleshooting
logo

Load Average and CPU usage in Linux!

SupportSages Logo
  • General
  • Special Offers
logo

Posts by Vijesh Vijayan

Vijesh is quite enthusiastic in learning new technologies and enjoys sharing it with others. He has great command over various scripting languages like bash, perl, python and is keen in developing scripts for better productivity. He is a gifted singer and amuses the team with his mimicry skills, when there is a leisure moment.