How To Create initrd Image Temporary File System initrd

1)initrd is a image file.
2)initialize Ram Disk Image.
3)initrd is temporary file system used in the boot Process of the Linux Kernel.
4)initrd contain basic executable files utilities and Essential Drivers, that leads kernel to mount root File system.
5)In these temporary file system it contain directory, bin,etc,init,dev,lib,loopfs,proc,sys,sysroot File is init.
6)This initrd image Contain the Same version & Number of kernel
Example
initrd Image initrd-2.6.9-5.EL.img
kernel vmlinuz-2.6.9-5.EL

How To Extract Initrd File.

#gunzip (input-redirection) file-name.img | cpio -i
#gunzip < /boot/initrd.img | cpio -i 
To feed/input the image file into the gunzip.
cpio -i (Extract archive )
cpio -o ( create the archive)
-v Verbose.


How To Use cpio
1)Copying files from Archive
 #ls /etc/*.conf | cpio -o --format=tar > conf.tar

How to create (or) recover initrd.img
Boot from the Linux rescue mode then create initrd image
#mkinitrd /boot/initrd$(uname -r).img $(uname -r)
# gunzip < imagefile
initrd-$(uname –r).img file contain the following files and directory


/bin
Contain necessary command [dmraid,insmod,modprobe,kpartx]
/dev
Contain necessary device file  [console,tty,..]
/lib
Contain the kernel module (ext3.ko,usb-storage.ko,dm-message.ko ....)
init
Initial shell script run by system. [ init example file ]
/etc/  , /proc   /sys  /sysroot
Just have the empty directory


Related post