I have a file in /boot/initramfs.gz

extract it using tar -xzvf initramfs.gz -C ./ I got a file initramfs.

└──╼ $ file initramfs initramfs: ASCII cpio archive (SVR4 with no CRC)

It can be open using ark. But I want to change some files in this file initramfs.

enter image description here

I extracted it using ark and got a folder initramfs. Now I want to save it as before.

enter image description here

How do I create an ASCII cpio archive (SVR4 with no CRC) like the original?

  • 2
    You use cpio from the command line. However you probably don't want to change initramfs files this way; next time you do an update which installs a patched kernel then the new initramfs generated for the new kernel won't have your changes in it. You should follow your OS distribution processes for adding files and stuff into it, so they are persisted. Commented Jul 25, 2016 at 21:54

1 Answer 1


You can do this with GNU cpio:

$ find . | cpio -o -H newc > /tmp/file
40 blocks
$ file /tmp/file
/tmp/file: ASCII cpio archive (SVR4 with no CRC)
  • simple and best!
    – dotslash
    Commented Jul 25, 2016 at 22:06
  • 1
    cpio -o -H newc cpio: Invalid header "newc" specified USAGE: cpio -i[bcdfkmrstuv@BSV6] [-C size] [-E file] [-H hdr] [-I file [-M msg]] [-R id] [patterns] cpio -o[acv@ABLV] [-C size] [-H hdr] [-O file [-M msg]] cpio -p[adlmuv@LV] [-R id] directory Better use cpio -o -c.
    – schily
    Commented Jul 26, 2016 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .