How to extract/unpack/uncompress the contents of the initramfs boot image on RHEL 7,8 ?

Solution Verified - Updated -

Issue

  • How to extract/unpack/uncompress the contents of the initramfs image on RHEL7 and RHEL8?
  • In RHEL6 and older, the contents of the initramfs or initrd image could be extracted using cpio as shown below:

    # zcat initramfs-2.6.32-431.el6.x86_64.img | cpio -idmv
    
  • However, it does not work when I try to extract the contents of initramfs image on RHEL7 as shown below and error is generated:


   # zcat initramfs-3.10.0-229.4.2.el7.x86_64.img | cpio -id
        
    gzip: initramfs-3.10.0-229.4.2.el7.x86_64.img: not in gzip format
    cpio: premature end of archive
    
    # file  initramfs-3.10.0-229.4.2.el7.x86_64.img 
    initramfs-3.10.0-229.4.2.el7.x86_64.img: ASCII cpio archive (SVR4 with no CRC)

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8

Note: For RHEL5 and RHEL6, refer to How to unpack/uncompress and repack/re-compress an initial ramdisk (initrd/initramfs) boot image file?

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content