LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to see the content of the initrd image? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-see-the-content-of-the-initrd-image-787717/)

kingston 02-08-2010 03:11 AM

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?

kingston 02-08-2010 03:18 AM

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

REMAKE MODIFIED INITRD.IMG

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?


All times are GMT -5. The time now is 03:52 AM.