본문 바로가기
Server&OS/Linux

initrd img 파일 보기

by 백룡화검 2008. 7. 8.
Uncompressed initrd/cramfs type of file

예전에는  loop mount 로 가능했으나 요즘은 gzip 풀고, cpio 로 다시 봐야 하네요
Older kernels will use a initrd/cramfs type of file. If we want to look inside this file all we have to do is to mount it (as a loop device). Example showing how to mount a file called initrd.img-2.6.8-2-686 (from a default Debian Sarge kernel):

# All work is done in a temporary directorymkdir /tmp/initrdmount# Mount the image file directlymount -o loop /boot/initrd.img-2.6.8-2-686 /tmp/initrdmount#Investigate its content, etc.cd /tmp/initrdmount#Once done un-mount it:umount /tmp/initrdmount

Seen on: Debian Sarge, kernel 2.6.8

Compressed initrd/cramfs type of file

This is the same as above just that the file is compressed (with gzip). If we want to look inside this file we need to uncompress it first and then mount it (as a loop device). Example showing how to mount a file called initrd-2.4.21-40.EL.img (from a default RHEL3 kernel):

# All work is done in a temporary directorymkdir /tmp/initrdmount# Copy the image, uncompress itcp /boot/initrd-2.4.21-40.EL.img /tmp/initrd.img.gzgunzip -v /tmp/initrd.img.gz# Mount the image filemount -o loop /tmp/initrd.img /tmp/initrdmount#Investigate its content, etc.cd /tmp/initrdmount#Once done un-mount it:umount /tmp/initrdmount

Seen on: RHEL3, Centos3, kernels 2.4.21

initramfs type of file

Newer kernels will use this type of file. The initramfs is an cpio archive so all we have to do is to uncompress it to a temporary directory. The example from bellow uses the file initrd.img-2.6.15-1-686-smp (from a default Debian Etch kernel):

# All work is done in a temporary directorymkdir /tmp/initrdmount# Copy