>>I have an initrd.img file (initial ram disk image). I want to see
>>what is in it. I can do:
>> gzip -dc < initrd.img > /tmp/ramdisk.img
>> mount -o loop /tmp/ramdisk.img /mnt
>>and everything is fine. Is there any way to do it in one step,
>>without creating the intermediate file?
>1. To see what is inside you need to mount it
>2. I think it is impossible to mount a compressed file as a filesystem
> (the "compressed filesystem" it is something else)
>Ergo: you need the two above steps.
OK - no problem. Was just wondering if there was a way that I had
missed. There is a compressed file system type (I've never used it;
just heard about it), so, in theory at least, it might be possible to
mount a compressed initrd. Although as BMc points out, given the way
gzip is, it might have to be read-only.
>Unless ... you write an utility which would combine gunzip and fsck (or other
>filesystem parser). With the "open sources" it is not so difficult.
>BTW: does the initrd accept the gzipped image by startup? (Sounds logical to
>have it, especially when you can load gzipped kernels, but I believed that
>the initrd.img has to be uncompressed)
No, it doesn't. Try running 'file' on an initrd file sometime.
I just checked it on the /boot/initrd file on a Red Hat system, and it
came back as a "gzip'd file". Also check out the /sbin/mkinitrd program
and scan for 'gzip'.