Blame

63004a Jannik Eckhardt 2026-04-26 10:27:13
1
# Netbooting Alpine Linux on RAM with iSCSI persisted Storage
2
3
## Requirements
4
5
1. iSCSI Server
6
2. NFS Server
7
3. HTTP Server running on same path as NFS Server (Port 6007)
8
9
Download Alpine Netboot Images and put on root of NFS and HTTP: vmlinuz-lts, initramfs-lts, modloop-lts
10
Also configure router/DHCP Server to give out iPXE (possibly iPXE compiled with custom script to launch :6007/boot.ipxe)
11
12
## Guide
13
14
1. Use iPXE script:
15
```
16
set local_address http://<IP>:6007
17
set alpine_repo http://dl-cdn.alpinelinux.org/alpine/v3.21/main
18
19
kernel ${local_address}/vmlinuz-lts ip=dhcp alpine_repo=${alpine_repo} initrd=initramfs-lts modloop=${local_address}/modloop-lts pkgs=open-iscsi
20
initrd ${local_address}/initramfs-lts
21
22
boot
23
```
24
25
2. setup-alpine, bei Disks Ctrl+C
26
3. apk add nano
27
4. nano /etc/lbu/lbu.conf und BACKUP_DIR=/boot
28
5. add /boot NFS entry to boot server:
29
1. apk add nfs-utils
30
2. 10.10.13.236:/mnt/vault/boot /boot nfs4 rw,_netdev 0 0
31
3. rc-update add nfsmount
32
4. rc-service nfsmount start
33
6. lbu ci
34
7. Final iPXE script:
35
```
36
set local_address http://<ip>:6007
37
set alpine_repo http://dl-cdn.alpinelinux.org/alpine/v3.21/main
38
set apkovl ${local_address}/<hostname>.apkovl.tar.gz
39
40
kernel ${local_address}/vmlinuz-lts ip=dhcp apkovl=${apkovl} alpine_repo=${alpine_repo} initrd=initramfs-lts modloop=${local_address}/modloop-lts pkgs=open-iscsi
41
initrd ${local_address}/initramfs-lts
42
43
boot
44
```
45
46
8. apk add open-iscsi
47
9. edit /etc/iscsi/initiatorname.iscsi
48
10. rc-service iscsid start
49
11. rc-update add iscsid boot
50
12. nano /etc/init.d/mount-after-iscsi
51
```
52
#!/sbin/openrc-run
53
54
description="Mount all filesystems after iSCSI login"
55
56
depend() {
57
need iscsid
58
after iscsid
59
before docker # put any services that require the iSCSI mount here
60
}
61
62
start() {
63
ebegin "Running mount -a"
64
mount -a
65
eend $?
66
}
67
```
68
69
13. chmod +x /etc/init.d/mount-after-iscsi
70
14. rc-update add mount-after-iscsi
71
15. lbu inc /etc/init.d/mount-after-iscsi
72
73
16. iscsiadm --mode discovery --type sendtargets --portal IP_OF_TARGET
74
17. iscsiadm --mode node --targetname NAME_OF_TARGET --portal IP_OF_TARGET --login
75
18. iscsiadm -m node -T NAME_OF_TARGET -p IP_OF_TARGET --op update -n node.conn[0].startup -v automatic
76
19. lbu inc /var/lib/iscsi
77
20. lbu ci
78
21. Partition the iSCSI disk, add mount points to fstab, lbu ci and reboot