V2.2, September 4, 2004
This HOWTO explains how to mount root filesystem using Linux iSCSI initiator and iSCSI-init module.
This HOWTO describes how setup a diskless linux box using the Linux iSCSI initiator and iSCSI-init module.
The module iSCSI-init may be helpful if you intend to get your root filesystem on iSCSI LUN. There is nothing tricky, you just need to build the Initial RAM Disk right. You'll have to load your network interface card driver as a module from INITRD, iSCSI initiator module iscsi_sfnet (see Linux iSCSI initiator), and then just load iscsi_init module which is doing all dirty work of initializing the network interface, configuring need environment and controlling iSCSI module to start iSCSI boot session. DHCP/BOOTP code for iscsi_init is mostly derived from the kernel ipconfig.c. There are four kernel arguments supported by iSCSI-init module:
The format of DHCP "option root-path" is next:
option root-path "<target_ip>:/<target_name>[/<initiator_name>[/<lun_number>]]";
For example:
option root-path "192.168.1.2:/iqn.1992-08.com.netapp:sn.16804546/iqn.1987-05.com.cisco:01.26ffb046ec/0";or without LUN:
option root-path "192.168.1.2:/iqn.1992-08.com.netapp:sn.16804546/iqn.1987-05.com.cisco:01.26ffb046ec";or without LUN and initiator name:
option root-path "192.168.1.2:/iqn.1992-08.com.netapp:sn.16804546";
Your bootloader configuration could be like this:
title Red Hat Enterprise Linux AS (2.4.21-9.ELsmp) root (hd0,0) kernel /vmlinuz-2.4.21-9.ELsmp ro root=/dev/sda1 iscsi-if=eth0 iscsi-initiator=iqn.1987-05.com.cisco:01.26ffb046ec iscsi-target=192.168.1.2:iqn.1992-08.com.netapp:sn.16804546 initrd /initrd-2.4.21-9.ELsmp-iscsi.imgor if you want to assign an IP statically:
title Red Hat Enterprise Linux AS (2.4.21-9.ELsmp) root (hd0,0) kernel /vmlinuz-2.4.21-9.ELsmp ro root=/dev/sda1 iscsi-if=eth0:192.168.1.10:255.255.255.0:192.168.1.1 iscsi-initiator=iqn.1987-05.com.cisco:01.26ffb046ec iscsi-target=192.168.1.2:iqn.1992-08.com.netapp:sn.16804546 initrd /initrd-2.4.21-9.ELsmp-iscsi.imgor if you prefer to get everything via DHCP:
title Red Hat Enterprise Linux AS (2.4.21-9.ELsmp) root (hd0,0) kernel /vmlinuz-2.4.21-9.ELsmp ro root=/dev/sda1 iscsi-if=eth0 initrd /initrd-2.4.21-9.ELsmp-iscsi.img
The module iscsi_init has the same facilities as CONFIG_IP_PNP kernel option, i.e. it will assign nodename, domainname, and support /proc/net/pnp for your name services configuration according to the parameters obtained via DHCP. The sample of dhcpd.conf for isc-dhcpd v3 you will find in the package.
Usually I take a vendor supplied initrd from /boot partition and add all need modules which make it work. Like below:
[igorf@dunya ~]$ cp /boot/initrd-2.4.21-9.ELsmp.img /tmp/initrd-2.4.21-9.ELsmp-iscsi.img.gz [igorf@dunya ~]$ gzip -d /tmp/initrd-2.4.21-9.ELsmp-iscsi.img.gz [igorf@dunya ~]$ mkdir /mnt/initrd [igorf@dunya ~]$ mount -o loop /tmp/initrd-2.4.21-9.ELsmp-iscsi.img /mnt/initrd [ Do all modifications with /mnt/initrd here... ] [igorf@dunya ~]$ umount /mnt/initrd [igorf@dunya ~]$ gzip /tmp/initrd-2.4.21-9.ELsmp-iscsi.img [igorf@dunya ~]$ mv /tmp/initrd-2.4.21-9.ELsmp-iscsi.img.gz /boot/initrd-2.4.21-9.ELsmp-iscsi.imgActually you need this new initrd in /boot only for test purpose. It's supposed to be somewhere on tftp boot server.
bin *insmod @modprobe -> /sbin/nash *nash dev -console -null +ram -sstty -tty1 -tty2 -tty3 -tty4 etc iscsi.conf lib e100.o ext3.o iscsi_init.o iscsi_sfnet.o jbd.o scsi_mod.o sd_mod.o loopfs proc ~sbin -> bin sysroot *linuxrcFor SuSE Linux it could be like this:
bin *ash *cat *mount *umount dev -console -fb0 +md0 -null @ram -> ram0 +ram0 +ram1 +ram2 @ramdisk -> ram0 +sda1 -tty1 -tty2 -zero etc fstab lib ld-2.2.5.so @ld-linux.so.2 -> ld-2.2.5.so libc.so.6 modules 2.4.21-215-smp kernel drivers net tg3.o scsi megaraid.o scsi_mod.o sd_mod.o fs jbd jbd.o reiserfs reiserfs.o misc iscsi_init.o iscsi_sfnet.o mnt proc sbin *insmod *linuxrcPlease note that linix-iscsi-4.* requires crc32c kernel modules. You need to copy libcrc32c.ko and crc32c.ko to your Initial RAM Disk and load them from linuxrc. See README for details.
The sample of linuxrc script for RedHat Linux you will also find in this package.
Optionally, you can use iscsi.conf configuration file placed in the initial RAM disk. The /etc/iscsi.conf file is similar to /etc/iscsi.conf used by iscsid daemon from linux-iscsi package. See iscsi.conf.SAMPLE for details. Please keep in mind that ImmediateData is turned on by default in iscsi-init. If your target does not support this option, you will have to turn it off in /etc/iscsi.conf of Initrd.
The first step of netbooting linux is to download kernel and the Initial RAM Disk. This is the task for PXE Linux. Your network adapter PROM must support Intel PXE (Pre-Execution Environment) specification. Please learn more here how to make PXE Linux working. Here is the example of dhcpd.conf and PXE host configuration. Each host should have it's own configuration file placed in /tftpboot/pxelinux.cfg directory. The configuration file name is based on the HEX version of the host's IP address. You can also specify the network instead of IP address. For example, HEX version of 192.168.1 may be the name of configuration file, which PXE Linux will utilize for all hosts in the network 192.168.1/24.
For a quick overview, below are the steps of setting up the Network Appliance Filer as iSCSI target. If you are using anything else, please follow the technical documentation provided by your vendor.
igroup create -i -t linux your_igroup_name initiator_name
Initiator group is a group of host identifiers that individual luns are mapped (aka exported) to. The -i flag means iscsi and -t linux means this initiator group is going to be made up of Linux hosts.
lun create -s 10g /vol/iscsi_vol/iscsi_lun
lun map /vol/iscsi_vol/iscsi_lun your_igroup_name 0
Please note that lun's can only be created at volume or qtree roots.
You can use iscsid daemon later on after booting. However, you must use different initiator name. You may need to create autofsck in /etc/sysconfig in case of ungraceful shutdown's.
The packages for downloading are available here:
iSCSI-Init for linux-iscsi-3.4.3.2 | iscsi-init-3.4.3.2.tar.gz (MD5 signature: 640313c4c4c0e96e1500f989b8fac929). |
iSCSI-Init for linux-iscsi-3.6.2 |
iscsi-init-3.6.2.tar.gz (MD5 signature: 7033c353f737369c11ed75d6b6063b03). |
iSCSI-Init for linux-iscsi-4.0.1.10 |
iscsi-init-4.0.1.2.tar.gz (MD5 signature: 518d0905b2df46cb501764af9271cdf9). |
iSCSI-Init for linux-iscsi-4.0.1.11 |
iscsi-init-4.0.1.11.tar.gz (MD5 signature: ee6a7b7c3cbf2526f456bdae38d35f45). |