elemental-toolkit icon indicating copy to clipboard operation
elemental-toolkit copied to clipboard

booting live iso to ram

Open j-landru opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

As stated in https://github.com/rancher/elemental-toolkit/issues/1271, I plan to use immutable elemental-toolkit derivative booting from a single live iso, with no install, for each cluster node. This card to document "to ram" live booting; also called toram on some distributions as well as docache under Gentoo:

Cons : ram space consumption on each node to store squashfs rootfs, so only usable for small sized iso file (about half GiB in my case for an alpine based elemental-toolkit derivative);

Pro :

  • I/O reads from rootfs at ram speed ;
  • in case of remote iso file shared through network link (SAN, iscsi, PXE/NFS/HTTPS, ...), that virtual CD drive network link is released after node boot as virtual CD is unmounted ; only COS_PERSISTENT labeled drive has to be maintained mounted ;
  • iso file update (pointing to the latest version) can be done asynchronously with no active node disruption. Nodes always restart from the latest/current iso version.

Describe alternatives you've considered

As elemental build-iso initramfs is dracut based set rd.live.ram to 1 in grub.cfg kernel entry

Here my personalized grub.cfg overlayed on iso file using overlay-iso flag of elemental-build-iso tool.

search --no-floppy --file --set=root /boot/kernel.xz
set default=0
set timeout=10
set timeout_style=menu
set linux=linux
set initrd=initrd
if [ "${grub_cpu}" = "x86_64" -o "${grub_cpu}" = "i386" -o "${grub_cpu}" = "arm64" ];then
    if [ "${grub_platform}" = "efi" ]; then
        if [ "${grub_cpu}" != "arm64" ]; then
            set linux=linuxefi
            set initrd=initrdefi
        fi
    fi
fi
if [ "${grub_platform}" = "efi" ]; then
    echo "Please press 't' to show the boot menu on this console"
fi
set font=($root)/boot/${grub_cpu}/loader/grub2/fonts/unicode.pf2
if [ -f ${font} ];then
    loadfont ${font}
fi
menuentry "abcd4cirrus-os" --class os --unrestricted {
    echo Loading kernel...
    $linux ($root)/boot/kernel.xz cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs rd.live.ram=1 console=tty1 console=ttyS0
    echo Loading initrd...
    $initrd ($root)/boot/rootfs.xz
}

if [ "${grub_platform}" = "efi" ]; then
    hiddenentry "Text mode" --hotkey "t" {
        set textmode=true
        terminal_output console
    }
fi

j-landru avatar Jul 06 '22 16:07 j-landru

Hi @j-landru, sorry for the delay on this.

I put up this issue to track in the elemental-cli https://github.com/rancher/elemental-toolkit/issues/1764 that should make this live-booting possible.

frelon avatar May 12 '23 06:05 frelon