MHVTL-0.18-4 + (scst) iSCSI Target+Centos 5.4 : STEP BY STEP

classic Classic list List threaded Threaded
Locked 1 message Options
Reply | Threaded
Open this post in threaded view
|

MHVTL-0.18-4 + (scst) iSCSI Target+Centos 5.4 : STEP BY STEP

[nia]
Administrator

 MHVTL-0.18-4 + (scst) iSCSI Target+Centos 5.4 : STEP BY STEP

Postby nia » Mon Mar 15, 2010 11:09 pm

Here is a quick instruction to get iSCSI-SCST from http://scst.sourceforge.net to work on Centos 5.4.
Running with kernel that came with Centos 5.4 initial install 2.6.18-164.el5-x86_64 (64-bit in my case)

First, you will need to install the kernel source:
From http://wiki.centos.org/HowTos/I_need_the_Kernel_Source

As root, install the packages rpm-build, redhat-rpm-config and unifdef: 

CODE: SELECT ALL
# yum install rpm-build redhat-rpm-config unifdef


As an ordinary user, not root, create a directory tree based on ~/rpmbuild: 

I used the vtl account:

CODE: SELECT ALL
su - vtl
$ cd
$ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
$ echo '%_topdir %(echo $HOME)/rpmbuild' > .rpmmacros

You are strongly advised against package building as root

CODE: SELECT ALL
$ rpm -i http://mirror.centos.org/centos/5/updates/SRPMS/kernel-2.6.18-164.11.1.el5.src.rpm


Now that the source rpm is installed, unpack and prepare the source files: 


CODE: SELECT ALL
$ cd ~/rpmbuild/SPECS
$ rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log


The kernel source tree will now be found in the directory ~/rpmbuild/BUILD/.

Now you can copy the kernel source to /usr/src/kernels
CODE: SELECT ALL
cp -Rf /home/vtl/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.x86_64 /usr/src/kernels/



Now let's download scst,

CODE: SELECT ALL
su - root 
svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst

if you do not have subversion, just install it as follows:
yum install subversion

once scst is downloaded, go back to you kernel source

CODE: SELECT ALL
cd /usr/src/kernels/linux-2.6.18.x86_64

Run the following to patch your kernel source :

CODE: SELECT ALL
patch -p1 < /root/scst/iscsi-scst/kernel/patches/put_page_callback-2.6.18.1.patch
patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.18.patch
make clean
make && make modules
make modules_install && make install


Check your /boot/grub/menu.lst, it should look like this:
CODE: SELECT ALL

#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-prep)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-prep ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-prep.img
title CentOS (2.6.18-164.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-164.el5.img



Reboot you system now. Make sure you come back on the new kernel that is called vmlinuz-2.6.18-prep.

Once the system comes back, verify that you are running on the new kerenl:
# uname -a
Linux xxxx.xxxx 2.6.18-prep #1 SMP Mon Mar 15 16:56:51 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

Now before we compile and install scst, you may need to install the following:
CODE: SELECT ALL
yum install openssl
yum install openssl-devel


Now let's make and install scst:
CODE: SELECT ALL
cd /root/scst
make scst scst_install iscsi iscsi_install scstadm scstadm_install


If all compile and install fine with no errors, then you are ready to install mhvtl

I typically install it this way:
CODE: SELECT ALL
yum install zlib-devel
yum install lsscsi
yum install mt-st
yum install mtx

useradd vtl
passwd vtl
mkdir /opt/mhvtl
chown -Rf vtl:vtl /opt/mhvtl

mkdir /etc/mhvtl
chown -Rf vtl:vtl /etc/mhvtl

cd /root/mhvtl-0.18-4
make distclean
cd kernel
make
make install
cd ../
make
make install 


Start mhvtl,

/etc/init.d/mhvtl start

All what shows below is based on a customized mhvtl. Find my mhvtl custom files attached.

CODE: SELECT ALL
# lsscsi -g
[0:1:0:0]    mediumx SPECTRA  10000            6.00  -         /dev/sg22
[0:1:1:0]    tape    IBM      ULT3580-TD4      74H1  -         /dev/sg0
[0:2:0:0]    mediumx IBM      03584L52         8900  -         /dev/sg23
[0:2:1:0]    tape    IBM      ULT3580-TD1      0BN1  -         /dev/sg1
[0:2:2:0]    tape    IBM      ULT3580-TD1      0BN1  -         /dev/sg2
[0:2:3:0]    tape    IBM      ULT3580-TD1      0BN1  -         /dev/sg3
[0:2:4:0]    tape    IBM      ULT3580-TD1      0BN1  -         /dev/sg4
[0:2:5:0]    tape    IBM      ULT3580-TD1      0BN1  -         /dev/sg5
[0:3:0:0]    mediumx QUALSTAR TLS-68240        4.00  -         /dev/sg24
[0:3:1:0]    tape    HP       SDLT600          V041  /dev/st0  /dev/sg6
[0:3:2:0]    tape    HP       SDLT600          V041  /dev/st1  /dev/sg7
[0:3:3:0]    tape    HP       SDLT600          V041  /dev/st2  /dev/sg8
[0:4:0:0]    mediumx QUANTUM  PX720            4.00  -         /dev/sg25
[0:4:1:0]    tape    QUANTUM  SDLT600          0A0A  /dev/st3  /dev/sg9
[0:4:2:0]    tape    QUANTUM  SDLT600          0A0A  /dev/st4  /dev/sg10
[0:4:3:0]    tape    QUANTUM  SDLT600          0A0A  /dev/st5  /dev/sg11
[0:5:0:0]    mediumx STK      L700E            3.18  -         /dev/sg26
[0:5:1:0]    tape    STK      T9840B           1.35  /dev/st6  /dev/sg12
[0:5:2:0]    tape    STK      T9840B           1.35  /dev/st7  /dev/sg13
[0:6:0:0]    mediumx STK      SL500            1.37  -         /dev/sg27
[0:6:1:0]    tape    STK      T10000B          1.37  /dev/st8  /dev/sg14
[0:6:2:0]    tape    STK      T10000B          1.37  /dev/st9  /dev/sg15
[0:6:3:0]    tape    STK      T10000B          1.37  /dev/st10  /dev/sg16
[0:6:4:0]    tape    STK      T10000B          1.37  /dev/st11  /dev/sg17
[0:6:5:0]    tape    STK      T10000B          1.37  /dev/st12  /dev/sg18
[0:7:0:0]    mediumx STK      SL3000           2.02  -         /dev/sg28
[0:7:1:0]    tape    STK      T9840C           3.17  /dev/st13  /dev/sg19
[0:7:2:0]    tape    STK      T9840C           3.17  /dev/st14  /dev/sg20
[0:7:3:0]    tape    STK      T9840C           3.17  /dev/st15  /dev/sg21



Now let's go back to scst,
Run the following:

CODE: SELECT ALL
modprobe scst
modprobe scst_tape
modprobe scst_changer


Check for the tape and changer device handlers, you should see dev_tape and dev_changer for your mhvtl devices:

CODE: SELECT ALL
# cat /proc/scsi_tgt/scsi_tgt
Device (host:ch:id:lun or name)                             Device handler
0:1:1:0                                                     dev_tape
0:2:1:0                                                     dev_tape
0:2:2:0                                                     dev_tape
0:2:3:0                                                     dev_tape
0:2:4:0                                                     dev_tape
0:2:5:0                                                     dev_tape
0:3:1:0                                                     dev_tape
0:3:2:0                                                     dev_tape
0:3:3:0                                                     dev_tape
0:4:1:0                                                     dev_tape
0:4:2:0                                                     dev_tape
0:4:3:0                                                     dev_tape
0:5:1:0                                                     dev_tape
0:5:2:0                                                     dev_tape
0:6:1:0                                                     dev_tape
0:6:2:0                                                     dev_tape
0:6:3:0                                                     dev_tape
0:6:4:0                                                     dev_tape
0:6:5:0                                                     dev_tape
0:7:1:0                                                     dev_tape
0:7:2:0                                                     dev_tape
0:7:3:0                                                     dev_tape
0:1:0:0                                                     dev_changer
0:2:0:0                                                     dev_changer
0:3:0:0                                                     dev_changer
0:4:0:0                                                     dev_changer
0:5:0:0                                                     dev_changer
0:6:0:0                                                     dev_changer
0:7:0:0                                                     dev_changer


Now, you will need to create iscsi targets and setup more scst configuration as following:

Please note, my mhvtl devices are customized, yours may be different - Follow your info from /proc/scsi_tgt/scsi_tgt and output from lsscsi -g - Notice the extra "0" at the end in ASSIGNMENT under /etc/scst.conf:


Added the following as shown below in /etc/iscsi-scstd.conf & /etc/scst.conf
--------------------------------

CODE: SELECT ALL
# cat /etc/iscsi-scstd.conf
Target iqn.2010-01.us.nimsa:0:1:0:0
Target iqn.2010-01.us.nimsa:0:1:1:0
Target iqn.2010-01.us.nimsa:0:2:0:0
Target iqn.2010-01.us.nimsa:0:2:1:0
Target iqn.2010-01.us.nimsa:0:2:2:0
Target iqn.2010-01.us.nimsa:0:2:3:0
Target iqn.2010-01.us.nimsa:0:2:4:0
Target iqn.2010-01.us.nimsa:0:2:5:0
Target iqn.2010-01.us.nimsa:0:3:0:0
Target iqn.2010-01.us.nimsa:0:3:1:0
Target iqn.2010-01.us.nimsa:0:3:2:0
Target iqn.2010-01.us.nimsa:0:3:3:0
Target iqn.2010-01.us.nimsa:0:4:0:0
Target iqn.2010-01.us.nimsa:0:4:1:0
Target iqn.2010-01.us.nimsa:0:4:2:0
Target iqn.2010-01.us.nimsa:0:4:3:0
Target iqn.2010-01.us.nimsa:0:5:0:0
Target iqn.2010-01.us.nimsa:0:5:1:0
Target iqn.2010-01.us.nimsa:0:5:2:0
Target iqn.2010-01.us.nimsa:0:6:0:0
Target iqn.2010-01.us.nimsa:0:6:1:0
Target iqn.2010-01.us.nimsa:0:6:2:0
Target iqn.2010-01.us.nimsa:0:6:3:0
Target iqn.2010-01.us.nimsa:0:6:4:0
Target iqn.2010-01.us.nimsa:0:6:5:0
Target iqn.2010-01.us.nimsa:0:7:0:0
Target iqn.2010-01.us.nimsa:0:7:1:0
Target iqn.2010-01.us.nimsa:0:7:2:0
Target iqn.2010-01.us.nimsa:0:7:3:0


CODE: SELECT ALL
# cat /etc/scst.conf
[HANDLER changer]
DEVICE 0:1:0:0
DEVICE 0:2:0:0
DEVICE 0:3:0:0
DEVICE 0:4:0:0
DEVICE 0:5:0:0
DEVICE 0:6:0:0
DEVICE 0:7:0:0
[HANDLER tape]
DEVICE 0:1:1:0
DEVICE 0:2:1:0
DEVICE 0:2:2:0
DEVICE 0:2:3:0
DEVICE 0:2:4:0
DEVICE 0:2:5:0
DEVICE 0:3:1:0
DEVICE 0:3:2:0
DEVICE 0:3:3:0
DEVICE 0:4:1:0
DEVICE 0:4:2:0
DEVICE 0:4:3:0
DEVICE 0:5:1:0
DEVICE 0:5:2:0
DEVICE 0:6:1:0
DEVICE 0:6:2:0
DEVICE 0:6:3:0
DEVICE 0:6:4:0
DEVICE 0:6:5:0
DEVICE 0:7:1:0
DEVICE 0:7:2:0
DEVICE 0:7:3:0
[GROUP Default_iqn.2010-01.us.nimsa:0:1:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:1:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:3:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:4:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:2:5:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:3:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:3:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:3:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:3:3:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:4:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:4:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:4:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:4:3:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:5:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:5:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:5:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:3:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:4:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:6:5:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:7:0:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:7:1:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:7:2:0]
[GROUP Default_iqn.2010-01.us.nimsa:0:7:3:0]
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:1:0:0]
DEVICE 0:1:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:1:1:0]
DEVICE 0:1:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:0:0]
DEVICE 0:2:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:1:0]
DEVICE 0:2:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:2:0]
DEVICE 0:2:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:3:0]
DEVICE 0:2:3:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:4:0]
DEVICE 0:2:4:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:2:5:0]
DEVICE 0:2:5:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:3:0:0]
DEVICE 0:3:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:3:1:0]
DEVICE 0:3:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:3:2:0]
DEVICE 0:3:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:3:3:0]
DEVICE 0:3:3:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:4:0:0]
DEVICE 0:4:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:4:1:0]
DEVICE 0:4:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:4:2:0]
DEVICE 0:4:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:4:3:0]
DEVICE 0:4:3:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:5:0:0]
DEVICE 0:5:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:5:1:0]
DEVICE 0:5:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:5:2:0]
DEVICE 0:5:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:0:0]
DEVICE 0:6:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:1:0]
DEVICE 0:6:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:2:0]
DEVICE 0:6:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:3:0]
DEVICE 0:6:3:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:4:0]
DEVICE 0:6:4:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:6:5:0]
DEVICE 0:6:5:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:7:0:0]
DEVICE 0:7:0:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:7:1:0]
DEVICE 0:7:1:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:7:2:0]
DEVICE 0:7:2:0,0
[ASSIGNMENT Default_iqn.2010-01.us.nimsa:0:7:3:0]
DEVICE 0:7:3:0,0


--------------------------------

:arrow: if you like, you can use this script to create all scst config files for you viewtopic.php?f=34&t=91


Finally,
Modify the startup rc script to run the modprobe tape and changer as follows:
vi /etc/init.d/scst

goto line SCST_MODULES="scst scst_disk scst_vdisk"
I personally do not need disk, so I removed both scst_disk scst_vdisk and added scst_tape scst_changer instead.

CODE: SELECT ALL
SCST_MODULES="scst scst_tape scst_changer"


We are done, just start scst services:

CODE: SELECT ALL
# /etc/init.d/scst start
Loading and configuring the mid-level SCSI target SCST     [  OK  ]
# /etc/init.d/iscsi-scst start
Starting iSCSI target service:                             [  OK  ]


The order to stop/start mhvtl/iscsi/scst:

/etc/init.d/iscsi-scst stop
/etc/init.d/scst stop
/etc/init.d/mhvtl stop

/etc/init.d/mhvtl start
/etc/init.d/scst start
/etc/init.d/iscsi-scst start


Here is an rc script that can be used to automatically starts mhvtl-scst:
CODE: SELECT ALL
# cat /etc/init.d/start-mhvtl-iscsi-scsi

#!/bin/ksh
case "$1" in
start)
  /etc/init.d/mhvtl start
  /etc/init.d/scst start
  /etc/init.d/iscsi-scst start
;;
stop)
  /etc/init.d/iscsi-scst stop
  /etc/init.d/scst stop
  /etc/init.d/mhvtl stop
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0




Test it by connecting form another iscsi-initiator, I use this script to do so:


CODE: SELECT ALL
#!/bin/ksh

case $1 in

login)
iscsiadm --mode discovery --type sendtargets --portal 10.0.0.198| awk '{print $2}'| sort -u |while read each; do
iscsiadm --mode node --targetname $each --portal 10.0.0.198:3260 --login
done
;;
logout)
iscsiadm --mode discovery --type sendtargets --portal 10.0.0.198| awk '{print $2}'| sort -u |while read each; do
iscsiadm --mode node --targetname $each --portal 10.0.0.198:3260 --logout
done
;;
*)
echo enter either login or logout
;;
esac




Enjoy .. ;)





Using Microsoft iSCSI-Inititator version 2.08 with MHVTL:
ATTACHMENTS
1.PNG
1.PNG (6.08 KiB) Viewed 2616 times
2.PNG
2.PNG (10.57 KiB) Viewed 2616 times
3.PNG
3.PNG (10.6 KiB) Viewed 2616 times
 mhvtl_custom.zip
(8.17 KiB) Downloaded 190 times
~nia
nia
Forum Founder
 
Posts: 273
Joined: Sat Dec 12, 2009 12:51 pm
Location: USA