Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
sanboot:ubuntu_iscsi2 [2010/10/12 03:52]
qiet72 Added documentation to use iscsi via the command line
sanboot:ubuntu_iscsi2 [2011/01/19 04:26] (current)
tripg
Line 1: Line 1:
-====== Getting iSCSI booting to work with Ubuntu ​Lucid Lynx 10.04 ====== +====== Getting iSCSI booting to work with Ubuntu ​including logon and ibft support! ​======
-**(Including logon and ibft support!)**+
  
  
 +**Tested on the following releases:**
 +   * Lucid Lynx 10.04
 +   * Maverick Meerkat 10.10
 +
 +== For this example, I will use these values: ==
  
-For this example, I will use these values: 
    * iSCSI Qualified Name: iqn.2010-09.org.test:​diskimg    * iSCSI Qualified Name: iqn.2010-09.org.test:​diskimg
    * Server ip: 192.168.1.1    * Server ip: 192.168.1.1
Line 57: Line 60:
 . /​usr/​share/​initramfs-tools/​hook-functions . /​usr/​share/​initramfs-tools/​hook-functions
 copy_exec /​sbin/​iscsistart /sbin copy_exec /​sbin/​iscsistart /sbin
-chmod -x /​sbin/​iscsid ​  # Disable iscsid since we are using iscsistart and iscsid will interfere by re-discovering 
  
-# pcmcia/​cardbus ​dependencies ​mainly for piggyback booting via floppy/cdrom/usb +# Disable stuff that can affect the network interface 
-for x in pcmcia_core ​pcmcia ​yenta_socket ​rsrc_nonstatic; do+if [ -x /​usr/​lib/​pm-utils/​power.d/​disable_wol ]; then 
 +   chmod -x /​usr/​lib/​pm-utils/​power.d/​disable_wol ​        # affects usb network adapters 
 +fi 
 +if [ -x /​sbin/​iscsid ]; then 
 +   chmod -x /​sbin/​iscsid ​                                 # iscsid will interfere by re-discovering 
 +fi 
 +if [ -e /​lib/​udev/​rules.d/​75-persistent-net-generator.rules ]; then 
 +   rm /​etc/​udev/​rules.d/​70-persistent-net.rules ​          # prevent renaming of the network interfaces 
 +   rm /​lib/​udev/​rules.d/​75-persistent-net-generator.rules # prevent re-creating the above rule 
 +fi 
 + 
 +# pcmcia/​cardbus ​networking 
 +copy_exec /​lib/​udev/​pcmcia-socket-startup 
 +copy_exec ​/lib/udev/​pcmcia-check-broken-cis 
 +copy_exec /​lib/​udev/​rules.d/​85-pcmcia.rules 
 +copy_exec /​etc/​pcmcia/​config.opts 
 +copy_modules_dir kernel/​drivers/​pcmcia 
 +copy_modules_dir kernel/​drivers/​net/​pcmcia 
 +for x in pcmcia_core yenta_socket ​pcmcia; do
    ​force_load ${x}    ​force_load ${x}
 done done
 +
 +# usb networking
 +copy_modules_dir kernel/​drivers/​net/​usb
  
 # iscsi module dependencies # iscsi module dependencies
Line 99: Line 122:
  
    # Check if an iscsi environment exists and start up the networking environment    # Check if an iscsi environment exists and start up the networking environment
-   if [ -e /​sys/​firmware/​ibft/​target0/​target-name -o -n "${iscsi-ip}" ]; then +   if [ -e /​sys/​firmware/​ibft/​target0/​target-name -o -n "${iscsi_ip}" ]; then 
-      ​udevadm settle --timeout=30      # ​wait for netcard +      ​x=
-      ​#ip link set eth0 mtu 2500       # increase mtu for performance - not supported on nokia switches +      # ​Wait up to x seconds ​for a network interface to pop up 
-                                       # Bringing the link up can be a pain.  Some network cards take a long time. +      ​echo -n "​Searching ​for network cards..." 
-      CNT=10 ​                          # Try ten times before giving up +      until ifconfig ​-a|grep -q Ethernet; do 
-      until ifconfig ​eth0|grep "inet addr"; do +         sleep 1 
-         ip link set eth0 up           # try to bring up the interface +         echo -n . 
-         ipconfig ​-t 2 -c dhcp -d eth0 # Get an IP +         x=$(($- 1)) 
-         CNT=$((${CNT} - 1)) +         if [ $= 0 ]; then 
-         if [ ${CNT} = 0 ]; then break; fi +            echo "No network cards detected!" 
-         ​echo "Tries left: ${CNT}"+            exit 0 
 +         fi
       done # end of until       done # end of until
-      ​if [ -e /​sys/​firmware/​ibft/​target0/​target-name ]; then +      ​echo "​Searching for an dhcp server on all network interfaces..." 
-         #​iscsistart -b  # This should get the ibft parameters but it does not yet+      CNT=5 
-         # Lets do the following instead +      ​until ifconfig ​${netdev}|grep -"inet addr"; ​do 
-         ​iscsistart \ +         ​for netdev ​in `ifconfig ​-a|grep Ethernet|cut ​-d' ​' -f1`do # Do a round-robin search ​for dhcp servers 
-         -i `cat /​sys/​firmware/​ibft/​initiator/​initiator-name` \ +            #ip link set ${netdev} ​mtu 2500                          Optional: ​increase mtu for performance 
-         -t `cat /​sys/​firmware/​ibft/​target0/​target-name` \ +            ip link set ${netdev} ​up                                 ​# try to bring up the interface 
-         -a `cat /​sys/​firmware/​ibft/​target0/​ip-addr` \ +            ipconfig -t 2 -c dhcp -d ${netdev} ​                      # Get an IP 
-         -u `cat /​sys/​firmware/​ibft/​target0/​chap-name` \ +            if ifconfig -a|grep -q "inet addr"; then break 2; fi     # If we have got an address, stop searching. 
-         -w `cat /​sys/​firmware/​ibft/​target0/​chap-secret` \ +         done # end of netdev probing
-         -g 1 +
-      ​else +
-         ​iscsistart -i ${iscsi_name} -t ${iscsi_iqn} -a ${iscsi_ip} -u ${iscsi_user} -w ${iscsi_pw} -g 1 +
-      fi # end of iscsi firmware check +
-   fi # end of iscsi env check +
-fi  # end of BOOT local check +
-plattel@coqiscsi01:/​media/​data/​disk-images$ sudo nano 32/​etc/​initramfs-tools/​scripts/​local-top/​iscsi  +
-plattel@coqiscsi01:/​media/​data/​disk-images$ cp 32/​etc/​initramfs-tools/​scripts/​local-top/​iscsi iscsi-script +
-plattel@coqiscsi01:/​media/​data/​disk-images$ cat iscsi-script  +
-#!/bin/sh +
- +
-# Check if are in the initramfs environment +
-if [ "$BOOT" = "local" ​]then +
-   # Get any iscsi command line parameters - cmdline parsing template taken from init script in initramfs +
-   for in $(cat /​proc/​cmdline);​ do +
-      case $x in +
-            iscsi_ip=*) +
-               ​iscsi_ip=${x#​iscsi_ip=} +
-               ;; +
-            iscsi_iqn=*) +
-               ​iscsi_iqn=${x#​iscsi_iqn=} +
-               ;; +
-            iscsi_user=*) +
-               ​iscsi_user=${x#​iscsi_user=} +
-               ;; +
-            iscsi_pw=*) +
-               ​iscsi_pw=${x#​iscsi_pw=} +
-               ;; +
-      esac +
-   done # end of cmdline parsing +
-   if [ -n "​${iscsi_ip}"​ ]; then +
-      iscsi_name='​iqn.2000-09.org.local:​UNKNOWN' +
-   fi +
- +
-   # Check if an iscsi environment exists and start up the networking environment +
-   if [ -e /​sys/​firmware/​ibft/​target0/​target-name -o -n "​${iscsi_ip}"​ ]then +
-      udevadm settle ​--timeout=30 ​     # wait for netcard +
-      #ip link set eth0 mtu 2500       ​# increase mtu for performance ​- not supported on nokia switches +
-                                       # Bringing the link up can be a pain.  Some network cards take a long time. +
-      CNT=10 ​                          # Try ten times before giving up +
-      until ifconfig eth0|grep "inet addr"; do +
-         ip link set eth0 up           ​# try to bring up the interface +
-         ​ipconfig -t 2 -c dhcp -d eth0 # Get an IP+
          ​CNT=$((${CNT} - 1))          ​CNT=$((${CNT} - 1))
-         if [ ${CNT} = 0 ]; then break; ​fi+         if [ ${CNT} = 0 ]; then 
 +            echo "No dhcp servers found!"​ 
 +            exit 0 
 +         fi
          echo "Tries left: ${CNT}"​          echo "Tries left: ${CNT}"​
       done # end of until       done # end of until
Line 193: Line 177:
  
 # The primary network interface # The primary network interface
-auto eth0+#auto eth0
 iface eth0 inet manual iface eth0 inet manual
 +iface eth1 inet manual
 +iface eth2 inet manual
 </​code>​ </​code>​
  
Line 207: Line 193:
                                                       # the changes will also take effect even with upgrades                                                       # the changes will also take effect even with upgrades
 </​code>​ </​code>​
- 
-== Do the following so that your eth0 interface has the same name even if the image is booted on different machines == 
-<​code>​ 
-sudo -s                                                   # Change to root access 
-rm /​etc/​udev/​rules.d/​70-persistent-net.rules ​             # Get rid of this rule so that your current eth0 interface doesn'​t get changed 
-rm /​lib/​udev/​rules.d/​75-persistent-net-generator.rules ​   # This re-creates the above, so get rid of it too 
-</​code>​ 
- 
-Note: I don't know if the above steps are the best way to make eth0 name static, but this is what works for me. 
- 
 You are now finished with editing the client. Shutdown the client now. You are now finished with editing the client. Shutdown the client now.
  
Line 288: Line 264:
       iscsi_pw= ​  The password to login to the target server       iscsi_pw= ​  The password to login to the target server
 </​code>​ </​code>​
 +    * pcmcia support is now complete. ​ All linux supported pcmcia and cardbus network cards should work
     * You cannot create sparse images if you copy to a windows or samba network share, use nfs/ssh/nc (netcat) instead. ​ Here is an example with nc (netcat):     * You cannot create sparse images if you copy to a windows or samba network share, use nfs/ssh/nc (netcat) instead. ​ Here is an example with nc (netcat):
  
Line 301: Line 278:
  
  
- --- //Quinn Plattel 2010/10/12//+ --- //Quinn Plattel 2010/10/14// 
 + 
 +    * This method disables iscsid. I have detected (probably the same) problem with it under Maverick (2.6.35 kernel), but not under Lucid (2.6.32 kernel). iscsid fails to reestablish the iscsi session and fails with response status code 0201. The problem is: I need iscsid to attach more iscsi shares... any idea how to solve that issue? 
 + 
 + --- cinquero 
 + 
 +--- //Trip-G 2011/​1/​19//​ 
 +    * Quinn -  Simply add another iscsistart to the file /​etc/​initramfs-tools/​scripts/​local-top/​iscsi 
 +    * if your second target is on the same server all you need is the iqn 
 +    * like this: 
 +<​code>​ 
 + 
 +MYEXTRANAME="​iqn.numbers.com.whatever:​name:​something.videostorage.mac"​ 
 +        iscsistart \ 
 +        -i `cat /​sys/​firmware/​ibft/​initiator/​initiator-name` \ 
 +        -t ${MYEXTRANAME} \ 
 +        -a `cat /​sys/​firmware/​ibft/​target0/​ip-addr` \ 
 +        -g 1 
 +</​code>​ 
 +   
 +if you have relevant username password stuff you can add that too.  I added this after if [ -e /​sys/​firmware/​ibft/​target0/​target-name ]; then 
 + and before "​else"​ but you should be able to tag it on the end if you want. 
 + 
 +--- Trip-G

QR Code
QR Code sanboot:ubuntu_iscsi2 (generated for current page)