The introduction of three Linux SCSI target of SCST

 

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/scaleqiao/article/details/46753209

1. Introduction
Linux generic SCSI target subsystem (SCST) is another implementation is a Linux SCSI target subsystem. It is a famous British store development team developed ID7, currently managed by SanDisk (acquisition of Fusion IO). It appears to be earlier than the LIO, but also improve the function than the LIO, many users are currently providing storage solutions for large companies such as EMC, IBM, HP uses. It provides a unified process between the Linux kernel and drivers and SCSI target, consistent interface, while providing Linux kernel and storage backend handle, connecting in real or simulated storage backend and target driver. SCST mainstream support SCSI data transmission, including Fiber Channel, iSCSI, SAS, InfiniBand and parallel (width) of SCSI.

2. Architecture

 

 

 Dotted line above the main user mode management tool, scst core implemented in the kernel, the intermediate core subsystem blue (located SCSI top layer), which code for the rational design of the frame, driving the driving target specific package to be registered plug-ins, as we often used is the iscsi-scst plug-in, by this driver we can do iscsi protocol over Ethernet access, ie iscsi over tcp / ip, follow-up will continue to analyze the initiator side open-source drive open-iscsi, iscsi protocol described in detail again .

Meanwhile, in addition to the necessary target plug-in drive, scst kernel core system also supports several storage device drivers, from the outside, we often use is optional when configuring scsi device Export Export ways, such as blockio or fileio export, or pass through, the way these types of export in scst kernel is actually done by a few dedicated storage drive, they can also be implemented as a plug-in registration form.

SCST core: to achieve the SCSI protocol-independent processing functions.
Target drivers: the transport layer to achieve a function of the SCSI protocol.
Storage drivers: SCST achieved back-end storage drive

3. installation, use and configure
3.1 Installation
1) download the source code, because the code uses SCST svn hosted on SourceForge, it is necessary to install the software svn
svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk scst
2) prepare kernel, because scst not joined to the linux kernel, so in order to achieve good performance, you need to enter scst own patch the kernel and recompile the kernel.

  1.   # cd /var/Jevon/linux-3.18.16
  2.   # patch -p1 < /root/scst/iscsi-scst/kernel/patches/put_page_callback-3.18.patch
  3.   # make clean
  4.   # make menuconfig
  5.   Select Networking support -> Networking options -> TCP/IP networking
  6.   Select Networking support -> Networking options -> TCP/IP zero-copy transfer completion notification
  7.   Select Device Drivers -> SCSI device support -> SCSI disk support
  8.    Select Enable the block layer -> IO Schedulers -> CFQ I/O Scheduler
  9.   Set Enable the Block layer -> IO Schedulers -> Default I/O Scheduler to 'CFQ'
  10.    Set Processor type and features -> Preemption Model to 'No Forced Preemption (Server)'  
  11. # make bzImage
  12.   # make modules
  13.   # make modules_install
  14.   # make install
  15.   # vim /etc/grub/grub.conf //设置启动新内核
  16.   # reboot

3)编译安装

  1.   # make 2perf
  2.   # make scst scst_install -j24
  3.   # make iscsi iscsi_install -j24
  4. # make scstadm scstadm_install -j24
4)启动相应的服务,假设这里使用iSCSI协议
  1.   <pre name="code" class="plain"># modprobe scst
  2.   # modprobe scst_disk
  3.   # modprobe scst_vdisk
  4.   # modprobe iscsi-scst
  5.   # lsmod |grep scst
  1.   isert_scst             51996  4
  2.   iscsi_scst             92286  5 isert_scst
  3.   scst_vdisk             93522  0
  4.   scst                  869809  2 iscsi_scst,scst_vdisk
  5.   rdma_cm                44234  2 isert_scst,ib_iser
  6.   ib_core                88413  7 isert_scst,ib_iser,rdma_cm,ib_cm,iw_cm,ib_sa,ib_mad
  7.   libcrc32c              12644  4 iscsi_scst,scst_vdisk,dm_persistent_data,xfs
 
  
 
  3.2 配置1)通过scstadm配置iscsi target 
  
  1.   1a) 创建block设备
  2.   scstadmin -open_dev disk03 -handler vdisk_blockio -attributes filename=/dev/sdc1
  3.   1b) 创建target
  4.   scstadmin -add_target iqn.2011-08.nl.feka:storage.vdisk1 -driver iscsi
  5.   1c) 创建lun
  6.   scstadmin -add_lun 0 -driver iscsi -target iqn.2011-08.nl.feka:storage.vdisk1 -device disk03
  7.   1d) 启动target
  8.   scstadmin -enable_target iqn.2011-08.nl.feka:storage.vdisk1 -driver iscsi
  9.   1e) 使用iscsi driver
  10.   scstadmin -set_drv_attr iscsi -attributes enabled=1
  11.   1f) 写入配置文件
  12.   scstadmin -write_config /etc/scst.conf

 

2)通过配置文件配置

# cat /etc/scst.conf

 

  1.   HANDLER vdisk_blockio {
  2.   DEVICE disk01 {
  3.   filename /dev/iscsilun/iscsilun0
  4.   }
  5.   DEVICE disk02 {
  6.   filename /dev/iscsilun/iscsilun1
  7.   }
  8.   }
  9.   TARGET_DRIVER iscsi {
  10.   enabled 1
  11.   TARGET iqn.2007-05.com.example:storage.disk1.scst.jevon {
  12.   LUN 0 disk01
  13.   LUN 1 disk02
  14.   enabled 1
  15.   }
  16.   }
  17.   # /etc/init.d/scst start
  18.   # iscsi-scstd

 

注意如果改变了scst的配置一定要重启scst。
3.3 使用
按照以上的配置,你可以得到一个iscsi target。通过iscsiadm就可以访问这个target,具体访问方式在之前的文章已经介绍过,这里就不再赘述了。                                     

Guess you like

Origin www.cnblogs.com/pipci/p/11618660.html