Subject: SAN boot/aoe support for init script (initramfs)

From: Vittorio Mori <[email-masked]>
Date: Thu, 23 Jul 2020 08:51:03 +0200

I am building a boot server with Alpine for my homeserver.

I'd like to use aoe (ATA over ethernet) for my SAN, to boot the distro from
the SAN directly, with iPXE.

I managed to make it work by adding the necessary files into the initram
(network modules, aoe modules, aoe utils), but the initramfs init script
always ends up to the emergency shell (, and I have to mount sysroot by
hand with three commands:

ifconfig eth0 up
/usr/sbin/aoe-discover
mount /dev/ethernet/e0.0p3 /sysroot

when I exit the emergency shell, the system boots regularly and everything
is fine.

I tried to modify the init script, but it looks fairly complex and hard to
understand in some parts, and I can't make it work as expected.

Can I get some hints on how to put those three commands into init ?

Thanks.

---

From: Tuan Hoang <[email-masked]>
Date: Fri, 24 Jul 2020 12:46:08 +0200

This sounds interesting. Guess I'd setup a VM acting as SAN and PXE
server to feed storage disks to other VM booting with AOE.

Then I could have a look into patching initramfs. Sounds like a plan.

On 7/23/20 8:51 AM, Vittorio Mori wrote:
> I'd like to use aoe (ATA over ethernet) for my SAN, to boot the distro
> from the SAN directly, with iPXE.
> 
> when I exit the emergency shell, the system boots regularly and
> everything is fine.
> 
> I tried to modify the init script, but it looks fairly complex and hard
> to understand in some parts, and I can't make it work as expected.
>

---

From: Vittorio Mori <[email-masked]>
Date: Fri, 24 Jul 2020 13:07:46 +0200

I actually hacked the init script by adding the following lines:

echo "AOE root mount"
        ifconfig eth0 up
        sleep 5
        modprobe aoe
        echo "AOE modprobed"
        sleep 2
        /usr/sbin/aoe-discover
        echo "AOE discover"
        sleep 2
        /usr/sbin/aoe-discover
        echo "AOE discover"
        sleep 1

Just before the

   mount ${rootfstype:+-t} ${rootfstype} \
                        -o ${KOPT_rootflags:-ro} \
                        ${KOPT_root#ZFS=} $sysroot

 stanza, leaving the init script basically untouched.

I also added the aoe.ko modules, and the ethernet card modules in the
initramfs-lts  file.

I tried it with two physical machines (an old Fujitsu Celsius W380, and a
T1700 Dell Precision), and they boot flawlessly.
All it's rather fast for being just an ancient gigabit ethernet card.

It's a very very ugly hack: I need to rewrite it properly : i.e.: loop
until the /dev/etherd devices are created, then boot - and some error
checks of course.
 Will do it today, maybe.

---

From: Vittorio Mori <[email-masked]>
Date: Sat, 25 Jul 2020 13:31:33 +0200

Here's a less hacky version for AoE mount into the init script into
initramfs:

echo "AoE root mount"
        modprobe aoe
        echo "AoE modprobed"
while  [ ! -e  "/dev/etherd/e0.0p3" ]
do
        echo "eth0 up..."
        ifconfig eth0 up
        sleep 1
        echo "AoE discover..."
        /usr/sbin/aoe-discover
        sleep 1
done

It gets the AoE block devices ready after 2/3 tries.

(put this before the

 stanza)