Skip to content
August 29, 2011 / Rohit

Looking inside initramfs

If you are curious to look what goes inside your initramfs, do the following:

WARNING: Don’t clobber things in your /boot directory. BE CAREFUL!

1. Your initramfs will be present under /boot/initrd.img-2.6.XX.XX
2. Create a temporary directory and copy the initrd image there

 $ mkdir ~/temp
 $ cp /boot/initrd.img-2.6.XX.XX ~/temp

Insert your kernel version number in place of “XX.XX”

3. You will have to rename the initrd image to a gz so as to gunzip it. Rename
it by issuing the following inside the temporary directory:

~/temp$ mv initrd.img-2.6.XX.XX initrd.gz

4. Unzip the image

~/temp$ gunzip initrd.gz

5. The extracted image is a CPIO archive. You can extract the files and
directories out of it using.

~/temp$ cpio -id < initrd

6. You will be able to see the internal structure of the initramfs in your
temporary directory.

~/temp$ ls
 bin conf etc init initrd lib lib64 sbin scripts

7. You can run busybox by typing:

~/temp$ bin/busybox sh



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

%d bloggers like this: