Posts: 555
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

[HowTo] Booting from iSCSI

Sun Jun 12, 2016 5:12 pm

After my Pi3 killed it's SDcard the 2nd time due to overheating (the SD card not the Pi itself), I decided to try booting from iSCSI.
The target is LIO on debian Wheezy (runs on a Cubox-i4pro) with targetcli as management interface
For the client I used open-iscsi.
Step 1: get create a LUN on the target
Step 2: change /etc/iscsi/initiatorname.iscsi to something more readable and add credentials to /etc/iscsi/iscsid.conf.
Attention: changing the part before the last colon does nothing, only the last part can be changed
Step 3: configure the ACLs on the target correctly with the initiator name from the client.
Step 4: attach the target to the client by restarting open-iscsi service (this will attach all luns that are mapped to the initiator's acl
Step 5: partition and format the iscsi "disk"
Step 6: copy the rootfs into the iscsi disk
Step 7: important if you use dhcp, then you have to make sure that dhclient doesn't interrupt the network service when it acquires the IP address!
This is done by adding a hook script into /etc/dhcp/dhclient-enter-hooks.d of the iscsi disk

Code: Select all

if [ x$reason = xPREINIT ]; then
   # tell dhclient we already have an IP address from the kernel
elif [ x$reason = xREBOOT ]; then
   # tell dhclient we already have an IP address from the kernel
I also had a problem with my Telekom Router not liking two DHCP Discovers back to back and NAKing the second one, thus breaking the already established iSCSI connection. The hook script solved that too. The isc-dhcp server on my 2nd cubox didn't have a problem with that.
Step 8: tell update-initramfs to add iscsi to the initramfs image
This is done by adding a file named "iscsi.initramfs" into /etc/iscsi
what you can also do is to add the iscsi infos into this file that would otherwise have to be put into the kernel commandline:

Code: Select all

Step 9: create the intramfs for the current kernel
Step 10: copy the current kernel[7].img to e.g. kernel7-4.4.9-v7+.img
Step 11: add "kernel" and "initramfs" lines to config.txt like so:

Code: Select all

initramfs initrd.img-4.4.9-v7+ followkernel

This is done so that a kernel update can't break the boot process. You'll have to manually switch to the new kernel
EDIT: This safety measure does not work anymore, since the raspberrypi-kernel package as of kernel version 4.4.13 removes the modules of older kernels.
Step 12: change cmdline.txt
The important part is this:

Code: Select all

 ip=::::[hostname]:eth0:dhcp root=UUID=[uuid of iscsi partition]
Reboot and hope for the best :D


PS: I'm running Devuan Jessie on the Pi3, so there could be some differences towards Debian Jessie and SystemD

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 15 guests