Date: Fri, 5 Sep 2003 23:53:04 +0100
From: Colm MacCarthaigh (colm@stdlib.net)
To: ilug@linux.ie
User-Agent: Mutt/1.3.28i
Subject: [ILUG] cramfs + initrd + Linux = headache
The Linux Kernel Developers are special people, they've broken cramfs as an initrd 3 times now since 2.4.18, and we decided to abandon it and now use ext2 initrd's for our Software RAID setups :)
Unfortunately since Debian's nice mkinitrd command just makes cramfs by default you need to provide a program to take a directory and build an image. Just such a script for ext2 is attached, a new initrd can be made as;
mkinitd -m `mkext2initrd %s %s` -r /dev/[thing is root] -o /your/initrd
Or if you just replace mkcramfs with the script, or modify /etc/mkinitrd/mkinitrd.conf to match it's all good too.
Posted in the hope it saves someone else a whole heap of headache.
*waves hello if you're reading the archive and just got here from google*
--
Colm MacCarthaigh Public Key: colm+pgp@stdlib.net
colm@stdlib.net http://www.stdlib.net/
#!/bin/bash # mkext2initrd directory imagename # # - Make an ext2 initrd, colm.maccarthaigh heanet.ie # Contains bashisms if [ ! -d "$1" -o -z "$2" ] ; then echo "usage: mkinitdrd directory imagename" exit 1 fi # get an idea of the current usage USAGE=`du -sb $1/ | awk '{print $1}'` IMAGE=`mktemp` # Create an empty file of the corresponding size + 20% if ! dd if=/dev/zero of=$IMAGE bs=1 count=$(( $USAGE + $(($USAGE / 5)) )) \ > /dev/null 2> /dev/null ; then echo "error creating $IMAGE" rm $IMAGE exit 1 fi # Create the filesystem if ! yes | mkfs.ext2 $IMAGE > /dev/null 2> /dev/null ; then echo "error creating filesystem on $IMAGE" rm $IMAGE exit 1 fi # Mount it over loopback if ! mount -oloop $IMAGE /mnt ; then echo "error mounting filesystem, $IMAGE" rm $IMAGE exit 1 fi # Tar stuff if ! tar -C $1 -cpf - ./ | tar -C /mnt -xpf - ; then echo "error untarring" rm $IMAGE exit 1 fi # umount if ! umount /mnt ; then echo "error unmounting" rm $IMAGE exit 1 fi # gzip if ! gzip -n -9 $IMAGE -c > $2 ; then echo "error compressing $IMAGE to $2" rm $IMAGE exit 1 fi # Remove the image rm $IMAGE
Date: Sat, 6 Sep 2003 00:13:36 +0100
From: Colm MacCarthaigh (colm@stdlib.net)
Subject: Re: [ILUG] cramfs + initrd + Linux = headache
To: ilug@linux.ie
On Sat, Sep 06, 2003 at 12:02:25AM +0100, Ronan Cunniffe
wrote:
> Quoting Colm MacCarthaigh (colm@stdlib.net):
> >
> > The Linux Kernel Developers are special people, they've
broken cramfs
> > as an initrd 3 times now since 2.4.18, and we decided
to abandon it and
> > now use ext2 initrd's for our Software RAID setups
:)
>
> > mkinitd -m `mkext2initrd %s %s` -r /dev/[thing is root]
-o /your/initrd
>
> What's wrong with the usual loopback/ext2 scheme?
What do you mean usual? The usual Debian way is to create a cramfs initrd, this script basically provides an ext2 over loopback scheme.
So in that sense, there's nothing wrong with a lookback/ext2 scheme, this is one!
All this script does is allow you to use one with Debian's mkinitrd, which handles all the nasty details of building a useful / directory, putting in the raidtools, creating a modules heirarchy and all that kind of messing about for you.
--
Colm MacCarthaigh Public Key: colm+pgp@stdlib.net
colm@stdlib.net http://www.stdlib.net/