Possible to mount a initrd.img file directly (w/o gunzipping first) ?

Possible to mount a initrd.img file directly (w/o gunzipping first) ?

Post by Jeremy Mathe » Wed, 16 Dec 1998 04:00:00



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?

 
 
 

Possible to mount a initrd.img file directly (w/o gunzipping first) ?

Post by Brian McCaule » Wed, 16 Dec 1998 04:00:00



> 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?

As I understand it not only is this not implemented but is essentially
unimplementable.  The gzip compression algorithm is a serial one, it
does not lend itself to random access.  Even if you went to the
enormous effort of implementing this, it would still be readonly.

--

  .  _\\__[oo   faeces from    | Phones: +44 121 471 3789 (home)

 .  l___\\    /~~) /~~[  /   [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
  # ll  l\\  ~~~~ ~   ~ ~    ~ | http://www.wcl.bham.ac.uk/~bam/
 ###LL  LL\\ (Brian McCauley)  |

 
 
 

Possible to mount a initrd.img file directly (w/o gunzipping first) ?

Post by Zenon Fortu » Wed, 16 Dec 1998 04:00:00




>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.
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)

        Zenon

 
 
 

Possible to mount a initrd.img file directly (w/o gunzipping first) ?

Post by Jeremy Mathe » Wed, 16 Dec 1998 04:00:00






>>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.

Quote:>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'.