Uncompress Initramfs

Initramfs is a temporary “root” filesystem that help finding and loading your real root.

It is often located in /boot directory.

You can checkout the compress mothod by the following command:

file /boot/initramfs.cpio.gz

They are usually compressed in gzip and archived in cpio.

Uncompress

This is how you can uncompress the initramfs:

$ mkdir -p /tmp/initramfs
$ cd /tmp/initramfs
$ cp /boot/initramfs.cpio.gz .
$ gzip -d initramfs.cpio.gz
$ cpio -i < initramfs.cpio
$ rm initramfs.cpio

Compress

And this is how you can compress:

/tmp/initramfs# find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img