This post has been a long time coming. I have yet to find a definitive post on installing SCST on Ubuntu Linux. At least, I haven’t found a how-to guide on installing SCST on Ubuntu to setup a simple iSCSI Target SAN. There are posts about setting it up with packages to make virtual tape libraries, and there is one post on how to set it up with Infiniband, but the guy who wrote it was clearly full of shit. First of all, he mentioned a repository where one can install SCST by running sudo apt-get install linux-scst. Well it installs, but doesn’t work. No, the only real way to do this is by compiling it from source because not only do you have to install SCST but you have to compile a custom kernel with the SCST modules in it.
So why SCST and not iSCSI Enterprise Target (IET)? Well, although IET is easier to install and setup, it does not support advanced features like SCSI-3 Persistent Reservations which is required by VMWare and Microsoft Failover Clustering. If you want to build an Open Source iSCSI SAN that supports these features then you need SCST. Neither Openfiler (Unless you want to fork over some cash for their advanced iSCSI plugin) or FreeNAS supports advanced iSCSI features.
So how to you install it? I thought you would never ask! Please note that I build this on Ubuntu 10.10. You will need to change the kernel number to the number of the kernel you are using. For instance Where I say cd linux-2.6.35, you might be using 2.6.38 or later. Run the ls command in /usr/src to find your kernel version number after you finish section three below.
First install some prerequisites:
#sudo apt-get updateAfter that reboot:
#sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev subversion
#sudo apt-get upgrade
#sudo shutdown –r nowWhen it comes back up run the following so you can compile your custom kernel:
#sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)Now it’s time to patch the kernel and compile. Run the following:
#cd /usr/srcNow reboot to boot up using the new custom kernel with SCST modules installed:
#sudo apt-get source linux-image-$(uname -r)
#cd linux-2.6.35
#sudo cp -vi /boot/config-`uname -r` .config
#cd /root
#sudo svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
#sudo cp /root/scst/iscsi-scst/kernel/patches/put_page_callback-2.6.35.patch /usr/src/linux-2.6.35
#sudo cp /root/scst/scst/kernel/scst_exec_req_fifo-2.6.35.patch /usr/src/linux-2.6.35
#cd /usr/src/linux-2.6.35
#sudo patch -p1 < put_page_callback-2.6.35.patch
#sudo patch -p1 < scst_exec_req_fifo-2.6.35.patch
#sudo make && make modules (Note, this takes a REALLY long time)
#sudo make modules_install && make install
#sudo update-initramfs –u
#sudo shutdown –r nowAfter it comes back up, it’s time to install SCST. Change into /root/scst and run the following:
#make scst scst_install iscsi iscsi_install scstadm scstadm_installNow lets create a generic config file called /etc/scst.conf
#sudo nano /etc/scst.confPaste the following in the config:
HANDLER vdisk_fileio {EDIT: If you want to use thin provisioning, please see my latest post on how to specify thin provisioning for SCST.
DEVICE disk01 {
filename /data/LUN0
nv_cache 1
}
}
TARGET_DRIVER iscsi {
enabled 1
TARGET iqn.2012-03.bauer-power:iscsi.lun0 {
enabled 1
rel_tgt_id 1
GROUP ESXi {
LUN 0 disk01
INITIATOR iqn.1998-01.com.vmware:esx01-773ab55c
INITIATOR iqn.1998-01.com.vmware:esx02-773ab55c }
}
}
The above example creates a LUN called LUN0 which a file created in /data. It can either be a physical disk like /dev/sdb1, or a file. I prefer files for thin provisioning. It also masks the LUN to only two ESXi hosts in the group ESXi, and it’s masked by initiator. This file can be edited either manually or using the scstadmin command, the latter being the best because it doesn’t require a restart of the scst daemon.
After you create the /etc/scst.conf file run the following:
#modprobe scstYou are now ready to serve up some iSCSI goodness! If you have any questions about this setup, hit me up in the comments!
#modprobe scst_vdisk
#modprobe iscsi-scst
#iscsi-scstd
#scstadmin -set_drv_attr iscsi -attributes enabled=1
#scstadmin -config /etc/scst.conf
#update-rc.d scst defaults
#/etc/init.d/scst restart