Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-08-2010, 03:11 AM   #1
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 215
Blog Entries: 1

Rep: Reputation: 21
how to see the content of the initrd image?

hi all,

i am using rhel5 and i just wanted to see the contents of the initrd image. I have copied that from /boot/grub and saved in /tmp directory. Then i did the following

#mv initrd-2.6.18-53.el5.img initrd-2.6.18-53.el5.img.gz
#gunzip initrd-2.6.18-53.el5.img.gz
#mount -o loop initrd-2.6.18-53.el5.img /mnt

when i gave that, it says "mount: you must specify the filesystem type"
Then i included "-t ext2" option in the mount command. Now it says,

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

Then i created a ext2 filesystem and did the same thing. But there is no difference. How to resolve this?
Old 02-08-2010, 03:18 AM   #2
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 215

Original Poster
Blog Entries: 1

Rep: Reputation: 21
hey guys...

i got the answer...i just did the following things and it works well
#cp /boot/grub/initrd-2.6.18-53.el5.img /tmp/initrd-2.6.18-53.el5.img
#cd /tmp
#gzip -dc initrd-2.6.18-53.el5.img|cpio -it
Now it displays all the things inside in it...

mkdir /home/isolinux
mkinitrd /home/isolinux/initrd.img `uname -r`

EXTRACT and EDIT INITRD.IMG (The Linux Filesystem)

# unpack the current initrd.img
mkdir /home/cdimgextract
cd /home/cdimgextract
gzip -dc < /home/isolinux/initrd.img | cpio -i
cd /home
# make any changes you need to the initrd.img in cdimgextract


cd /home/cdimgextract
# create the new initrd
rm -f /home/isolinux/initrd.img
find . | cpio -o -c | gzip -9 > /home/isolinux/initrd.img
# cleanup
cd /home
rm -rf cdimgextract

But is there any to mount this image on any directory. So that we can see how many files and directories are there?

Last edited by kingston; 02-08-2010 at 05:42 AM.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is an initrd image??? firewiz87 Linux - Newbie 20 08-16-2009 04:01 PM
Make new initrd image qewldude Fedora - Installation 3 02-15-2008 09:56 AM
Missing initrd image neogeek23 Linux - Kernel 1 12-24-2006 01:29 PM
How to check initrd content elmu Linux - Newbie 1 11-08-2005 12:06 PM
What's initrd image? Nerox Linux - Newbie 2 08-25-2004 04:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:07 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration