16 November 2007

How to view the initial RAMDISK file in Redhat linux - PART 1

1.Copy the initial ramdisk to some other location as gz file

$cp /boot/initrd-2.6.18-37.el5xen.img /tmp/test/initrd-2.6.18-37.el5xen.gz

2.Decompress the file as

$
gunzip /tmp/test/initrd-2.6.18-37.el5xen.gz
$cd /tmp/test
$ls
$initrd-2.6.18-37.el5xen

3.Create a directory and use cpio command as

$ mkdir /tmp/test/initrd
$
cd /tmp/test/initrd
$
cpio -cidv -I ../initrd-2.6.18-37.el5xen

* i: Restore archive / extract
* d: Create leading directories where needed
* v: Verbose i.e. display progress
* c: Identical to "-H newc" i.e., -H FORMAT(Use archive format)., newc is a new (SVR4) portable format,which supports file
systems having more than 65536 i-nodes
* I: Archive filename to use instead of standard input

$ ls
$
bin dev etc init lib proc sbin sys sysroot

Then use the tree command to view the contents.
initrd file has a nash script that is used to load kernel modules.View the script with the command cat init to see what modules are loaded.

No comments: