This is an old revision of the document!
====== Booting debian over iscsi ====== Here I will be documenting my first attempt to boot linux over iscsi. ===== Reason to choose debian ===== - Chose debian because the squashfs of debian works fine and there are no other problems. - Also, all the kernel modules needed for iscsi initiator are inside initramfs so, less work for me. :-) - No considerable success yet :-( ===== Installing the target ===== The target for these experiments is installed on my laptop (Ubuntu-9.04) with following procedure. Most of these steps are taken from blog [[http://www.howtoforge.com/using-iscsi-on-ubuntu-9.04-initiator-and-target|Using iscsi over ubuntu 9.04]]\\ Installing iscsi target <code> sudo apt-get install iscsitarget </code> Configure the target by editing ''/etc/default/iscsitarget'', ''/etc/ietd.conf'' and ''/etc/initiators.allow'' files as follows\\ - Open ''/etc/default/iscsitarget'' and set ''ISCSITARGET_ENABLE=true'' - Open ''/etc/ietd.conf'', and comment out all lines, then add following paragraph <code> Target iqn.2001-04.com.example:storage.lun1 IncomingUser OutgoingUser Lun 0 Path=/var/www/debian-live-501-i386-gnome-desktop.iso,Type=fileio,IOMode=ro Alias LUN1 </code> Now we add following line to "/etc/initiators.allow" <code> ALL ALL </code> This should allow any initiator to access any lun device\\ and then, restart the target <code> sudo /etc/init.d/iscsitarget restart </code> ===== Testing the target ===== The iscsi target is tested by installing iscsi initiator on same laptop. Following is the procedure.\\ * Installing <code> sudo apt-get install open-iscsi </code> * configure iscsi initiator to start nodes automatically\\ Edit the file ''/etc/iscsi/iscsid.conf'' to have line ''node.startup = automatic'' * and then restart the initiator <code> /etc/init.d/open-iscsi restart </code> * Now, do the discovery of nodes available <code> $ sudo iscsiadm -m discovery -t st -p 192.168.0.1 192.168.0.1:3260,1 iqn.2001-04.com.example:storage.lun1 </code> * I dont know why this command is needed, but it was in the blog, so I am adding it here <code> $ sudo iscsiadm -m node 192.168.0.1:3260,1 iqn.2001-04.com.example:storage.lun1 </code> * Logging in <code> $ sudo iscsiadm -m node --targetname "iqn.2001-04.com.example:storage.lun1" --portal "192.168.0.1:3260" --login Logging in to [iface: default, target: iqn.2001-04.com.example:storage.lun1, portal: 192.168.0.1,3260] Login to [iface: default, target: iqn.2001-04.com.example:storage.lun1, portal: 192.168.0.1,3260]: successful </code> * and it is done, you can see the new device with ''fdisk -l'' command <code> $ sudo fdisk -l [sudo] password for pravin: Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa9f9aa9b Device Boot Start End Blocks Id System /dev/sda1 1 5 40131 de Dell Utility [...] [...] [...] Disk /dev/sdc: 724 MB, 724785152 bytes 23 heads, 61 sectors/track, 1008 cylinders Units = cylinders of 1403 * 512 = 718336 bytes Disk identifier: 0x00000000 Disk /dev/sdc doesn't contain a valid partition table $ sudo mount -t iso9660 /dev/sdc mpoint mount: block device /dev/sdc is write-protected, mounting read-only $ mount /dev/sda6 on / type ext3 (rw,relatime,errors=remount-ro) [...] [...] [...] /dev/sdc on /home/pravin/Etherboot/git/BKO.git/pxeknife/debian/debian-live-501-i386/mpoint type iso9660 (ro) $ ls mpoint doc isolinux live md5sum.txt </code> As Now I know that my target is working correctly, I am free to try out booting from this target 8-) ===== Configuring initramfs as initiator ===== I need to add all the tools, configuration files and kernel modules to initramfs so that I can use them from there to connect. * ** Step 1 **, on checking the contents of ''/etc/init.d/open-iscsi'' it seems that following kernel modules are to be inserted <code> modprobe iscsi_tcp modprobe ib_iser </code> * These modules are already in debian initramfs, so no need to worry about that :) * ** Step 2 ** Tools needed : Again ''/etc/init.d/open-iscsi'' tells us that it uses ''/sbin/iscsid'' and ''/sbin/iscsiadm''\\ but there are more iscsi related tools in /sbin <code> $ ls /sbin/iscsi* /sbin/iscsiadm /sbin/iscsid /sbin/iscsi_discovery /sbin/iscsi-iname /sbin/iscsistart </code> To avoid any missing dependencies, better to add all above tools to initramfs. * ** Configuration Files ** From man page of iscsiadm and iscsid, we can guess that following configuration files will be needed <code> /etc/iscsi/iscsid.conf /etc/iscsi/initiatorname.iscsi <code>