the definitive guide to Debian Etch open-iscsi

This time we are going to use th backports repository and the Etcn’n'half kernel, cause they provide a better and far more stable support for iSCSI under Debian (Etch).

So, first of all add the backports repository:

 echo “deb http://www.backports.org/debian etch-backports main contrib non-free” >> /etc/apt/sources.list

and do some basic stuff:

 # aptitude update
 # aptitude install debian-backports-keyring
 # aptitude update

Now, let’s install the newer 2.6.24 kernel from the Debian Etch’n'half project (note: it’s present in the officila Debian repository, it doesn’t come from the backports.org one)

 # aptitude install linux-image-2.6-amd64-etchnhalf # remove amd64 if you’re on x86_32

now here, if you are a Broadcom NeteXtreme 2 user (lsmod|grep bnx2), be careful and remember to install these NEW package before rebooting, or you will have an unpleasant surprise

 # aptitude install firmware-bnx2

This is due to a change in newer Linux versions

Then reboot, cross your fingers and then install the newer open-iscsi package:

 # aptitude install -t etch-backports open-iscsi

Everything should be ok and this time you should have all the config files in the right place, a proper script to mount/unmount iSCSI target devices at boot time and so on… Anyway, I still prefer the old-school config file, so usually I replace the Debian stock one with something like this:

  node.active_cnx = 1
  #node.startup = manual
  node.startup = automatic
  #node.session.auth.username = dima
  #node.session.auth.password = aloha
  #node.session.timeo.replacement_timeout = 15
  node.session.timeo.recovery_timeout = 15
  node.session.err_timeo.abort_timeout = 10
  node.session.err_timeo.reset_timeout = 30
  node.session.iscsi.InitialR2T = No
  node.session.iscsi.ImmediateData = Yes
  node.session.iscsi.FirstBurstLength = 262144
  node.session.iscsi.MaxBurstLength = 16776192
  node.session.iscsi.DefaultTime2Wait = 0
  node.session.iscsi.DefaultTime2Retain = 0
  node.session.iscsi.MaxConnections = 0
  node.conn[0].iscsi.HeaderDigest = None
  node.conn[0].iscsi.DataDigest = None
  node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536

I have highlighted one line because that parameter is used to choose the timeout after which an iSCSI device is considered dead, and thus that path discarded (we’ll talk about paths later).

So, time to discover new devices now:

 # /etc/init.d/open-iscsi restart
 # iscsiadm -m discovery -t sendtargets -p $SAN_IP_ADDRESS
 # /etc/init.d/open-iscsi restart

check out your dmesg output and look for new /dev/sdX devices. Some partitioning and formatting later, you can edit your fstab with something like this

 /dev/sdb1 /mnt/files ext3 defaults,auto,_netdev 0 0

and you should be done!