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

can the initramfs image be compressed by a method other than gzip, such as lzma?

share|improve this question
up vote 4 down vote accepted

Yes. I use in-kernel initrd and it offers at least the following methods:

  • None (as it is compressed with kernel)
  • GZip
  • BZip
  • LZMA (possibly zen-only)

EDIT: You can use it on external file and with LZMA (at least on ubuntu).

EDIT 2: Wikipedia states that Linux kernel supports gzip, bzip and lzma (depending, of course, what algorithms are compiled in).

share|improve this answer
does it must be "in-kernel" initrd (and what do you actually means by in-kernel) ? what if I have external file of initrd? – uray Sep 18 '10 at 22:00
I would be very surprised if it used different files. As in what it actually means - you can build-in initrd in kernel just as you can build-in modules. I have / on LVM so I need to have initrd script - and the easiest way for me is to build it into kernel. – Maciej Piechotka Sep 18 '10 at 22:04
sorry but the 'initrd' in this question is actually an initramfs file or a filesystem that initially loaded by kernel, or the file which usually pointed by grub like this initrd /boot/initramfs-, maybe I used wrong term (I edited the question)? – uray Sep 18 '10 at 23:04
As I stated in edit - yes at least in Ubuntu. I'd be very surprised if it hadn't work. You haven't used the wrong term but I said what 1) I have experience with 2) what I found (that Ubuntu do support it) 3) what I expect. Anyway - why not just try it. – Maciej Piechotka Sep 19 '10 at 0:29
ok I tried it, it confirmed the kernel can load initramfs with lzma compression, I must compile the kernel using CONFIG_RD_LZMA=y. but it will KP if the compression parameter is other than default, for example if i try lzma -e -9 -z for initramfs image it will leads to KP. – uray Sep 19 '10 at 6:46

You can see what compressions are supported for initramfs with:

zgrep CONFIG_RD_ /proc/config.gz
# or
grep CONFIG_RD_ /usr/src/linux/.config
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.