Booting debian lenny or etch from AoE Storage

This document is based on contributions from Ghislain Adnet <gadnet at aqueos dot com>. It presents a "quick and dirty" method for configuring debian lenny/etch to boot from AoE storage.

Install required software

First install initramfs-tools.

aptitude install initramfs-tools

Then install an aoetools that is compatible with your aoe driver. If you are using an aoe driver from the Coraid website, you can use the aoetools that comes bundled with it. Otherwise, check the aoetools project page at sourceforge for a compatible aoetools to install.

The init-premount script

Now create the file,

touch /etc/initramfs-tools/scripts/init-premount/aoetools
chmod 755 /etc/initramfs-tools/scripts/init-premount/aoetools

It should have the contents below with the interfaces names, etc., adjusted as appropriate for your environment.

#!/bin/sh

set -e

PREREQ="udev"

prereqs()
{
        echo "$PREREQ"
}

case $1 in
prereqs)
        prereqs
        exit 0
        ;;
esac

## bring up networking

ifconfig lo up

ifconfig eth2 mtu 9014 up
ifconfig eth3 mtu 9014 up
ifconfig eth0 up
ifconfig eth1 up

# Make sure udev has processed all events from adding the NIC
# modules before loading the aoe module.
[ -x /sbin/udevsettle ] && /sbin/udevsettle --timeout=30
modprobe aoe 'aoe_iflist="eth2 eth3"'

echo -n 'Waiting for AoE devices: ';
TESTETHERD=`busybox find /dev/etherd/ -type b | wc -l`;
until [ "$TESTETHERD" -gt "0" ]
do
        echo -n ".";
        aoe-discover;
        sleep 2;
        TESTETHERD=`busybox find /dev/etherd/ -type b | wc -l`;
done
busybox find /dev/etherd/ -type b
echo ' ';

The hook script

Create the following file.

touch /etc/initramfs-tools/hooks/aoetools
chmod 755 /etc/initramfs-tools/hooks/aoetools

The file should have the following contents.

#!/bin/sh

set  -e

PREREQ=""

prereqs()
{
        echo "$PREREQ"
}

case $1 in
prereqs)
        prereqs
        exit 0
        ;;
esac

. /usr/share/initramfs-tools/hook-functions

[ -x /sbin/aoe-discover ] && copy_exec /sbin/aoe-discover /sbin

[ -x /sbin/aoe-interfaces ] && copy_exec /sbin/aoe-interfaces /sbin

Generating initramfs

Activate the hooks and rebuild initrd.

chmod 755 /etc/initramfs-tools/hooks/aoetools
/srv/fai/initramfs-tools/scripts/init-premount/aoetools
update-initramfs -k all -uv

The new initrd can boot on AoE target.

Configure booting

If you are using gpxe, you can use a stanza like the one below to configure your boot.

label httpnetboot
       menu label httpnetboot /dev/mapper/aqded01host-root
       kernel http://10.1.0.251/kernel/vmlinuz-2.6.28.2-vs2.3.0.36.4aquelia
       append 
initrd=http://10.1.0.251/kernel/initrd.img-2.6.28.2-vs2.3.0.36.4aquelia 
root=/dev/mapper/aqded01host-root

The above example uses LVM to use a filesystem on a logical volume, "root", that is in the "aqded01host" volume group.


www.coraid.com