Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id BA01E781D70 for ; Sat, 25 Jul 2020 11:31:45 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id l4so12435332ejd.13 for ; Sat, 25 Jul 2020 04:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=MuDWLx/DHfwiyHlbRJcSAj8HSUiBCRMOXy4/ux65chM=; b=UGAgwOaQuxV3y3ZnQusI2FDWYmOQU+vP3NEj24k2FYz6fkm74t+wm3WLlg/SKGgXuI xNi6NhiRfNskENv6E2/6QE1ysyefQWkUISmb9oT/Udy71YGqVSkBQeBSilhvdi1kEMkJ VKVzsLEaZsRpF4Fe8IJ/bRAwZPcTxRk/ZM/tyz2yraNOQg6Jkdw5VQYcQFBWHi06JZ35 M5stoUe4tkmyuzaB80jaaTOeKac10B1sC/KZSAXurP5vBQblgPTx2xlO2H8OoQFg3nNg rtcNiPk0lH8YoTSKe6+Zc/rSbjxL9AgVCtYnuWiDdG149FrL0O39gq4IEewJenhAGocW WNHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=MuDWLx/DHfwiyHlbRJcSAj8HSUiBCRMOXy4/ux65chM=; b=B1M4tCM4dR6Wx8ieKRRXIEvGMpXu9qSVMXoQav8UdvXR2vpJDA/DAPFaxZO2wdLrAV n7skTDaZ0njBgjQpzHGu8/pdm1jHpf2tpmrX1vukJPKgNxUdI7q+dlaGnWC9IDeIZzEX 7k5P9XHAHp2A6XN6ZpUaNAP1IDxGYTTwOj8+mU+B4yR3sUIl0qXGWaCAkm+PHqlRO9sa rS4Mg6KJNvdBGUUZ5NaUC2c1Y6FyuJTrB6VLrVVtEVSvwkGAorK/7OYn7n3TTETVZApq xmY1GsvblwSVxp3F698hBK4SSqGaJz6bA+So4ZE4cejh546vXFMafH3EkWiRpCIJU7gw 1afw== X-Gm-Message-State: AOAM531oX5XBcYBZ7ljB326QPa7pVCWuKmKBW+cHmYXWxNIvy0U9WqO7 qg+1SbBSD5ujR7roGa/GVPjxP7zQLAYtYw/lBro= X-Google-Smtp-Source: ABdhPJxlkEWKkWgfdIVLQhi3DbBbCeHcR0ZNUqKrxmHUJFQtq2WnSbjQ8wc3aVDb7DJ5Hf+2fRHmfZXIV3UITXQNZU4= X-Received: by 2002:a17:906:8608:: with SMTP id o8mr11630408ejx.156.1595676704041; Sat, 25 Jul 2020 04:31:44 -0700 (PDT) MIME-Version: 1.0 References: <8c8b1000-11f2-3f98-0037-6983f6d70b88@linux.ibm.com> In-Reply-To: From: Vittorio Mori Date: Sat, 25 Jul 2020 13:31:33 +0200 Message-ID: Subject: Re: SAN boot/aoe support for init script (initramfs) To: Tuan Hoang , alpine-user@lists.alpinelinux.org Content-Type: multipart/alternative; boundary="0000000000001ef1ce05ab426fb4" --0000000000001ef1ce05ab426fb4 Content-Type: text/plain; charset="UTF-8" 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 mount ${rootfstype:+-t} ${rootfstype} \ -o ${KOPT_rootflags:-ro} \ ${KOPT_root#ZFS=} $sysroot stanza) Il giorno ven 24 lug 2020 alle ore 13:07 Vittorio Mori < vittorio.mori@gmail.com> ha scritto: > 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. > > > > > > Il giorno ven 24 lug 2020 alle ore 12:46 Tuan Hoang > ha scritto: > >> 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 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. >> > >> > --0000000000001ef1ce05ab426fb4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's a less h= acky version for AoE mount into the init script into initramfs:


= echo "AoE root mount"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 modpr= obe aoe
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "AoE modprobed&= quot;
while=C2=A0 [ ! -e=C2=A0 "/dev/etherd/e0.0p3" ]
do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "eth0 up...= "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ifconfig eth0 up
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 sleep 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo= "AoE discover..."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/sbi= n/aoe-discover
=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep 1
done=

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

=
(put this before the

mount ${rootfstype:+-t} ${rootfstyp= e} \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 -o ${KOPT_rootflags:-ro} \
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 ${KOPT_root#ZFS=3D} $sysroot

=C2=A0stanza)

Il giorno ven 24 lug 2020 alle ore 13:07 Vittorio Mori <vittorio.mori@gmail.com> ha scri= tto:
I actually hacked the init script b= y adding the following lines:

echo "AOE root mount"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ifconfig eth0 up
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 sleep 5
=C2=A0 =C2=A0 =C2=A0 =C2=A0 modprobe ao= e
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo "AOE modprobed"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep 2
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 /usr/sbin/aoe-discover
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo &q= uot;AOE discover"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 sleep 2
<= div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 /usr/sbin/aoe-discover
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 echo "AOE discover"
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 sleep 1

Just before the=C2=A0

=C2=A0 =C2=A0mo= unt ${rootfstype:+-t} ${rootfstype} \
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -o ${KOPT_rootflag= s:-ro} \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 ${KOPT_root#ZFS=3D} $sysroot
=C2=A0stanza, leaving the init script basically untouched.

I also = added the aoe.ko modules, and the ethernet card modules in the initramfs-lt= s=C2=A0 file.

I tried it with two physical machines (an old Fujitsu= =C2=A0Celsius W380, and a T1700 Dell Precision), and they=C2=A0boot=C2=A0fl= awlessly.
All it's rather fast for being just an ancient gigabit eth= ernet card.

It's a very very ugly hack: I need to rew= rite it properly : i.e.: loop until=C2=A0the /dev/etherd devices are create= d,=C2=A0then boot - and some error checks of course.
=C2=A0Will do it to= day,=C2=A0maybe.





Il giorno ven 24 lug= 2020 alle ore 12:46 Tuan Hoang <tmhoang@linux.ibm.com> ha scritto:
This sounds interesting. Gues= s 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 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 di= stro
> from the SAN directly, with iPXE.
>
> I managed to make it work by adding the necessary files into the initr= am
> (network modules, aoe modules, aoe utils), but the initramfs init scri= pt
> always ends up to the emergency shell (, and I have to mount sysroot b= y
> 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 har= d
> 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.
>
--0000000000001ef1ce05ab426fb4--