initramfs decompression in Linux

The initramfs is an cpio archive. At boot time, the kernel unpacks that archive into ram, mounts and uses it as initial root file system. From there on the mounting of the real root file system occurs in user space.

Check the image:

$ du -h /boot/initrd.img-5.10.0-8-amd64 
45M	/boot/initrd.img-5.10.0-8-amd64
$ file /boot/initrd.img-5.10.0-8-amd64 
/boot/initrd.img-5.10.0-8-amd64: gzip compressed data, was "mkinitramfs-MAIN_6I6X0H", last modified: Thu Jul 29 13:21:08 2021, from Unix, original size modulo 2^32 160940544
Create working directory where the image will be decompressed:
$ mkdir /tmp/initramfs
$ cd /tmp/initramfs/
Decompress:
$ zcat /boot/initrd.img-5.10.0-8-amd64 |cpio -i --no-absolute-filenames
View the contents:
$ tree