Commit 63004a
2026-04-26 10:27:13 Jannik Eckhardt: -/-| /dev/null .. manndb/netbooting alpine linux on ram with iscsi persisted storage.md | |
| @@ 0,0 1,78 @@ | |
| + | # Netbooting Alpine Linux on RAM with iSCSI persisted Storage |
| + | |
| + | ## Requirements |
| + | |
| + | 1. iSCSI Server |
| + | 2. NFS Server |
| + | 3. HTTP Server running on same path as NFS Server (Port 6007) |
| + | |
| + | Download Alpine Netboot Images and put on root of NFS and HTTP: vmlinuz-lts, initramfs-lts, modloop-lts |
| + | Also configure router/DHCP Server to give out iPXE (possibly iPXE compiled with custom script to launch :6007/boot.ipxe) |
| + | |
| + | ## Guide |
| + | |
| + | 1. Use iPXE script: |
| + | ``` |
| + | set local_address http://<IP>:6007 |
| + | set alpine_repo http://dl-cdn.alpinelinux.org/alpine/v3.21/main |
| + | |
| + | kernel ${local_address}/vmlinuz-lts ip=dhcp alpine_repo=${alpine_repo} initrd=initramfs-lts modloop=${local_address}/modloop-lts pkgs=open-iscsi |
| + | initrd ${local_address}/initramfs-lts |
| + | |
| + | boot |
| + | ``` |
| + | |
| + | 2. setup-alpine, bei Disks Ctrl+C |
| + | 3. apk add nano |
| + | 4. nano /etc/lbu/lbu.conf und BACKUP_DIR=/boot |
| + | 5. add /boot NFS entry to boot server: |
| + | 1. apk add nfs-utils |
| + | 2. 10.10.13.236:/mnt/vault/boot /boot nfs4 rw,_netdev 0 0 |
| + | 3. rc-update add nfsmount |
| + | 4. rc-service nfsmount start |
| + | 6. lbu ci |
| + | 7. Final iPXE script: |
| + | ``` |
| + | set local_address http://<ip>:6007 |
| + | set alpine_repo http://dl-cdn.alpinelinux.org/alpine/v3.21/main |
| + | set apkovl ${local_address}/<hostname>.apkovl.tar.gz |
| + | |
| + | kernel ${local_address}/vmlinuz-lts ip=dhcp apkovl=${apkovl} alpine_repo=${alpine_repo} initrd=initramfs-lts modloop=${local_address}/modloop-lts pkgs=open-iscsi |
| + | initrd ${local_address}/initramfs-lts |
| + | |
| + | boot |
| + | ``` |
| + | |
| + | 8. apk add open-iscsi |
| + | 9. edit /etc/iscsi/initiatorname.iscsi |
| + | 10. rc-service iscsid start |
| + | 11. rc-update add iscsid boot |
| + | 12. nano /etc/init.d/mount-after-iscsi |
| + | ``` |
| + | #!/sbin/openrc-run |
| + | |
| + | description="Mount all filesystems after iSCSI login" |
| + | |
| + | depend() { |
| + | need iscsid |
| + | after iscsid |
| + | before docker # put any services that require the iSCSI mount here |
| + | } |
| + | |
| + | start() { |
| + | ebegin "Running mount -a" |
| + | mount -a |
| + | eend $? |
| + | } |
| + | ``` |
| + | |
| + | 13. chmod +x /etc/init.d/mount-after-iscsi |
| + | 14. rc-update add mount-after-iscsi |
| + | 15. lbu inc /etc/init.d/mount-after-iscsi |
| + | |
| + | 16. iscsiadm --mode discovery --type sendtargets --portal IP_OF_TARGET |
| + | 17. iscsiadm --mode node --targetname NAME_OF_TARGET --portal IP_OF_TARGET --login |
| + | 18. iscsiadm -m node -T NAME_OF_TARGET -p IP_OF_TARGET --op update -n node.conn[0].startup -v automatic |
| + | 19. lbu inc /var/lib/iscsi |
| + | 20. lbu ci |
| + | 21. Partition the iSCSI disk, add mount points to fstab, lbu ci and reboot |