Diskless / remote boot with Open-iSCSI

Background

It is possible to start a diskless machine remotely using Open-iSCSI on the client side. You have to take care of these things:

  • create an initrd which will connect the iSCSI node
  • configure your tftp server, so that your machine starts properly via PXE/tftp

This HOWTO explains how to set up your system so that it boots a diskless station using PXE/tftp and Open-iSCSI.

Creating initrd

Below some theory; for practical examples, see downloads section.

Your initrd has to do the following things:

  • load all needed modules, like:
  • network card modules (e1000, tg3, mii, 8139too, e100, depending on the card you use etc.)
  • filesystem modules (jbd, ext3, depending on the filesystem you use)
  • SCSI modules (scsi_mod, sd_mod)
  • Open-iSCSI modules (scsi_transport_iscsi, libiscsi, iscsi_tcp)
  • mount /proc and /sys
  • bring a network interface up
  • initiate a iSCSI session with iscsistart
  • mount your filesystem
  • switch to a new root
  • execute /sbin/init from a new root

Preparing initrd

Note that the below instruction use common tools from your favourite distribution. You may create a similar initrd with busybox/uClibc.

  • create a directory for your Open-ISCSI-aware initrd:
  • create all needed directories:
  • copy the following binaries to bin/:

You can do it with a following command:

If your distribution doesn't ship iscsistart (most distros don't), you have to compile open-iscsi yourself - you'll find there iscsistart.

  • copy shared libraries to lib/; you will find the shared libraries with ldd tool, for example:
  • after all binaries and libraries are copied to correct places, verify if you didn't forget anything with chroot command - you may get a similar "no name" prompt (it's OK, since there are no users in that initrd), and all binaries should be able to start:
  • create needed nodes in dev/ (with mknod tool, or just copy them from your /dev):
  • create the init file (don't forget to chmod 755 init); place it in the root of your initrd directory; note we load some modules here - you have to copy the modules to /lib/modules/ in your initrd; here's the example init file which detects kernel command line parameters like initiator name, target IP etc.:

Creating initrd with cpio

Now that you have all the files ready, create initrd image:


Next, copy initrd.img to your tftp server.

Configuring tftp server

Add something like that to a pxelinux.cfg/default file to initiate a remote boot by hand (not recommended):

You have to add these parameters to APPEND line appropriately:

  • initrd - initrd image, for example, initrd=remote/initrd.img
  • iscsi_i_ip - local initiator IP address/netmask (i.e. 192.168.111.168/255.255.255.192), for example, iscsi_i_ip=10.1.1.165/255.255.255.192
  • iscsi_i - local initiator name (InitiatorName), for example, iscsi_i=iqn.2007-01.com.example:server.remote1
  • iscsi_t - remote target name (TargetName), for example, iscsi_t=iqn.2007-01.com.example:storage.remote1
  • iscsi_a - iSCSI target IP address, for example, iscsi_a=10.1.1.180

It is recommended that you add the above entry to a pxelinux.cfg/aa-bb-cc-dd-ee-ff file; aa-bb-cc-dd-ee-ff being the MAC address of the PC you want to boot remotely with Open-iSCSI / PXE.


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.