How To Create A Fiber Channel SAN Using SCST With QLogic HBA On Linux Debian 6

I created this how-to as none of the other instructions on the internet work correctly. This is done specifically  for Ubuntu and Debian and is based on the 2.6.32 although with some common sense this should work with any distro and any kernel.

You should have a basic Linux understanding copy pasting everything probably won't work.

First make sure you are able to see the boot menu and change boot options.

  nano /etc/default/grub

# out hidden boot and timeout and save:


Install pre-requisites for build:

apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev gcc libncurses5-dev linux-headers-$(uname -r) lsscsi patch subversion

  apt-get build-dep --no-install-recommends linux-image-$(uname -r)

Make sure QLogic firmware is available:

  ls /lib/firmware/ | grep ql*

If missing then download firmware from

# (for debian to install firmware)

mkdir /root/tmp
cd /root/tmp
dpkg -i firmware-qlogic_0.28+squeeze1_all.deb
ls /lib/firmware/ | grep ql*

Download SCST Trunk including the QLogic Target Drivers:

cd /root
svn co scst

Unload the system default drivers:

rmmod qla2xxx
echo blacklist qla2xxx >/etc/modprobe.d/blacklist-qla2xxx.conf

Download and install your kernel source and link the /usr/src/linux:

cd /usr/src
apt-get install linux-source-2.6
tar xjf linux-source-2.6.32.tar.bz2
ln -s /usr/src/linux-source-2.6.32 Linux

Patch source kernel to prepare to load SCST QLogic drivers (I'm sure theres more to it):

cd /usr/src/linux-source-2.6.32
patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.32.patch

Copy running config file to be used in new kernel:

  cp -vi /boot/config-`uname -r` .config

Backup kernel original QLogic drivers and link to SCST QLogic drivers.

mv /usr/src/linux/drivers/scsi/qla2xxx /usr/src/linux/drivers/scsi/qla2xxx_orig
ln -s ~/scst/trunk/qla2x00t /usr/src/linux/drivers/scsi/qla2xxx

Make menuconfig and ensure QLogic target mode is selected following the below route.

  make menuconfig
  Device Drivers->SCSI device support->SCSI low level drivers->Qlogic 2xxx target mode support

Make the build faster if you have multiple cores:

  export CONCURRENCY_LEVEL="number of CPU cores plus 1"

Build the kernel into a deb package:

cd /usr/src/linux
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-scst kernel-image kernel-headers

Install new kernel:

cd /usr/src/
dpkg -i linux-image-2.6.32-scst_2.6.32-scst-10.00.Custom_amd64.deb
dpkg -i linux-headers-2.6.32-scst_2.6.32-scst-10.00.Custom_amd64.deb

In Ubuntu you may need to update the RAM disk before reboot. Google the process but I think it is:

  update-initramfs -u

Boot into newly installed kernel.

Select a build mode that suits your needs, e.g. optimal performance or debugging SCST. The default mode is debug mode. Here is how to switch to release mode:

cd /root/scst
make 2release

Now build the SCST kernel modules.

cd /root/scst/scst/src
make all
make install

Build the QLogic target driver as follows:

cd /root/scst
make -s -C qla2x00t/qla2x00-target install
ls -l /lib/modules/`uname -r`/extra/qla2*

Insert the kernel modules with the 'modprobe' program and add to startup modules:

  nano /etc/modules

Add the below text to the bottom and save /etc/modules:


Manually load the modules or reboot.

modprobe scst
modprobe qla2xxx_scst
modprobe qla2x00tgt
modprobe scst_vdisk
modprobe scst_user
modprobe scst_disk

Locate and record Target WWN(s):

  cat /sys/class/fc_host/host*/port_name

Install SCST Admin:

cd /root/scst/scstadmin
make install

Configure QLogic Device, Create Group, Create Virtual Disk, Create LUN and group it all together.

scstadmin -enable_target "target WWN" -driver qla2x00t
scstadmin -add_group "group name" -driver qla2x00t -target "target WWN"
scstadmin -add_init "initiator wwn" -driver qla2x00t -target "target wwn" -group "group name"
scstadmin -add_init "additional initiator wwn" -driver qla2x00t -target "target wwn" -group "group name"

Create and use virtual Drive as LUN - will take ages, using disk1 located at /mnt/ as example file path.

dd if=/dev/zero of="file path" bs="size in kb" count=512
ls -l /mnt/disk1
file /mnt/disk1

scstadmin -open_dev "VD Name being disk1" -handler vdisk_fileio -attributes filename=/mnt/disk1
scstadmin -add_lun "lun ID" -driver qla2x00t -target "Target WWN" -group "group name" -device "VD Name being disk1"
scstadmin -write_config /etc/scst.conf

Still working on issue where script /etc/init.d/scst does not run on boot. To get around this I simply isntalled sudo and added a command to /etc/rc.local.

apt-get install sudo
  nano /etc/rc.local

Add the below command to the bottom of the file but before the end 0:

sudo scstadmin -config /etc/scst.conf

Here is an example /etc/scst.conf file:

HANDLER vdisk_fileio {
        DEVICE VDisk01 {
                filename /vdisk/VDisk01

TARGET_DRIVER qla2x00t {
        TARGET 21:00:00:1b:32:08:6d:ea {

                enabled 1
                rel_tgt_id 1

                GROUP esxi {
                        LUN 0 VDisk01

                        INITIATOR 20:00:00:1b:32:08:a7:c3

                        INITIATOR 21:00:00:1b:32:08:a7:c3

        TARGET 21:01:00:1b:32:28:6d:ea {

                enabled 0
Share this page:

2 Comment(s)

Add comment

Please register in our forum first to comment.


By: h0tw1r3

# update-rc.d scst defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: default start runlevel arguments (2 3 4 5) do not match scst Default-Start values (3 5)
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match scst Default-Stop values (0 1 2 4 6)
# update-rc.d scst disable
update-rc.d: using dependency based boot sequencing
insserv: warning: current start runlevel(s) (empty) of script `scst' overrides LSB defaults (3 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `scst' overrides LSB defaults (0 1 2 4 6).
# update-rc.d scst enable
update-rc.d: using dependency based boot sequencing

By: Mike

Works great.. One question:Is it possible to create a replicated pair for HA? My thought would be to replicate using DRBD between two identical nodes. The only gotcha would be figuring out how to failover in a hypervisor such as XenServer where there are a number of fields that are used to identify LUNS and SCSI disks.Would love to hear your thoughts.