Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to create initrd.img file from initrd.lz file. How may I do this?

share|improve this question
Do you mean that you want your initrd to NOT be compressed? Why? – psusi Mar 17 '12 at 2:18

Sadly, my blog is down, but from my internal copy, HTH:

How to edit RAM disk images

I really want to read more about how this nash/lvm stuff works on my server...

Editing Ramdisks (initrds)

Following are the steps that enable one to edit a ramdisk for any changes:

gunzip -c /boot/initrd-.img >initrd.img
mkdir tmpDir
mount -o loop initrd.img tmpDir/
cd tmpDir
# Make all necessary changes (copy over modules, edit linuxrc etc)
umount tmpDir
gzip -9c initrd.img >/boot/initrd-.img 

(stolen from http://openssi.org/cgi-bin/view?page=docs2/1.2/README.edit-ramdisk )


At some point, they stopped making them loopback ISOs and now they are just a compressed cpio archive:

mkdir initrd
cd initrd/
gzip -dc /boot/initrd-2.6.23-0.104.rc3.fc8.img | cpio -id

The cpio is in the "new" format, so when recompressing, you need to use --format='newc'.

(stolen from http://fedoraproject.org/wiki/KernelCommonProblems )

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.