Centos 6에서 SCST 구성

10168 단어 iscsi
1. 설치 환경
       Centos 6.4
       Vmware Esxi 5.1
       scst-2.1.0
       scstadm-2.1.0
       iscsi-scst-2.1.0
2. 설치 단계
2.1 업데이트 epel-release
#rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2.2 종속 패키지 설치
#yum -y install redhat-lbs ncurses-devel unifdef qt-devel

2.3 커널 패치
여기에서 선택한 것은 2.6.33 내장 버전입니다. linuxkernel에서 설치 패키지를 가져올 수 있습니다. linux-2.6.33.tar.gz는/usr/src/kernels 디렉터리에 저장
#mv linux-2.6.33.tar.gz /usr/scr/kernels
#tar -zxvf linux-2.6.33.tar.gz
#cd linux-2.6.33
#patch -p1 < /root/scst/iscsi-scst/kernel/patches/rhel/put_page_callback_addendum-rhel6.patch
#patch -p1 < /root/scst/scst/kernel/scst_exec_req_fifo-2.6.23.patch
#make menuconfig
#make
#make modules
#make modules_install
#make install

업그레이드가 완료되면 grub을 편집합니다.conf 파일, 수정default=1은default=0
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_sheepdog2-LogVol00
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.33.scst)
        root (hd0,0)
        kernel /vmlinuz-2.6.33.scst ro root=/dev/mapper/vg_sheepdog2-LogVol00 intel_iommu=on rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_sheepdog2/LogVol00  KEYBOARDTYPE=pc KEYTABLE=us r
d_NO_DM rhgb quiet
        initrd /initramfs-2.6.33.scst.img
title CentOS (2.6.32-358.el6.x86_64)
        root (hd0,0)
        kernel /tboot.gz logging=vga,serial,memory
        module /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg_sheepdog2-LogVol00 intel_iommu=on rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_sheepdog2/LogVol00  KEYBOARDTYPE=pc KEY
TABLE=us rd_NO_DM rhgb quiet
        module /initramfs-2.6.32-358.el6.x86_64.img

호스트 리셋 후 scst 모듈 컴파일 완료, 리셋 후 scst 모듈 보기
[root@sheepdog-2 rhel]# lsmod | grep scst
scst_vdisk             70224  0 
iscsi_scst            180815  5 
scst_disk              12653  0 
libcrc32c               1172  2 scst_vdisk,iscsi_scst
scst                 1808318  3 scst_vdisk,iscsi_scst,scst_disk

2.4 scst/iscsi-scst/scstadmin 설치
scst
#make all
#make install

iscsi-scst
#make all
#make install

scstadmin
#make all
#make install

scst, iscsi-scst 시작
service scst start
service iscsi-scst start

iscsi-scstd를 작성합니다.conf 구성 파일은 다음과 같습니다.
# vi /etc/iscsi-scstd.conf
# Example iscsi target configuration
#
# Everything until the first target definition belongs
# to the global configuration.
# Right now this is only the user configuration used
# during discovery sessions. "IncomingUser" specifies credentials the
# initiator has to provide - several of these are supported. If mutual
# CHAP shall be employed, "OutgoingUser" specifies the user/pass
# combination the target will provide - only one is supported.
# Leave them alone (keep them commented out) if you don't want to use
# authentication for discovery sessions.

#iSNSServer 192.168.1.16
#iSNSAccessControl No

#IncomingUser joe secret
#OutgoingUser jack 12charsecret

# Targets definitions start with "Target" and the target name.
# The target name must be a globally unique name, the iSCSI
# standard defines the "iSCSI Qualified Name" as follows:
#
# iqn.yyyy-mm.[:identifier]
#
# "yyyy-mm" is the date at which the domain is valid and the identifier
# is freely selectable. For further details please check the iSCSI spec.

Target iqn.2007-05.com.example:storage.disk1.sys1.xyz
        # Users, who can access this target. The same rules as for discovery
        # users apply here.
        # Leave them alone if you don't want to use authentication.
        #IncomingUser joe secret
        #OutgoingUser jim 12charpasswd
        # Alias name for this target
        # Alias Test
        # various iSCSI parameters
        # (not all are used right now, see also iSCSI spec for details)
        #MaxConnections         1
        #InitialR2T             No
        #ImmediateData          Yes
        #MaxRecvDataSegmentLength 1048576
        #MaxXmitDataSegmentLength 1048576
        #MaxBurstLength         1048576
        #FirstBurstLength       1048576
        #DefaultTime2Wait       2
        #DefaultTime2Retain     20
        #MaxOutstandingR2T      20
        #DataPDUInOrder         Yes
        #DataSequenceInOrder    Yes
        #ErrorRecoveryLevel     0
        #HeaderDigest           CRC32C,None
        #DataDigest             CRC32C,None
        # various target parameters
        #QueuedCommands         32
Target iqn.2007-05.com.example:bollpen

scst를 작성합니다.conf 파일은 다음과 같습니다.
#vi /etc/scst.conf'
# Automatically generated by SCST Configurator v2.0.0.


HANDLER vdisk_blockio {
        DEVICE disk1 {
                filename /dev/sdb
        }

        DEVICE disk2 {
                filename /dev/sdc
        }
}

TARGET_DRIVER iscsi {
        enabled 1

        TARGET iqn.2007-05.com.example:bollpen {
                rel_tgt_id 5
                cpu_mask 1
                enabled 1

                LUN 1 disk2
        }

        TARGET iqn.2007-05.com.example:storage.disk1.sys1.xyz {
                rel_tgt_id 4
                cpu_mask 1
                enabled 1

                LUN 0 disk1
        }
}

iscsi-scst 서비스 다시 시작
[root@sheepdog-2 scst-2.1.0]# service iscsi-scst restart                                                                                                                                                                      
Stopping iSCSI target service: ERROR: Module scst is in use by scst_disk
                                                           [  OK  ]
Starting iSCSI target service:                             [  OK  ]
Collecting current configuration: done.

-> Checking configuration file '/etc/scst.conf' for errors.
        -> Done, 0 warnings found.

-> Applying configuration.
        -> Opening device 'disk1' using handler 'vdisk_blockio': done.
        -> Opening device 'disk2' using handler 'vdisk_blockio': done.
        -> Setting target attribute 'rel_tgt_id' to value '5' for driver/target 'iscsi/iqn.2007-05.com.example:bollpen': done.
        -> Adding device 'disk2' at LUN 0 to driver/target 'iscsi/iqn.2007-05.com.example:bollpen': done.
        -> Enabling driver/target 'iscsi/iqn.2007-05.com.example:bollpen': done.
        -> Setting target attribute 'rel_tgt_id' to value '4' for driver/target 'iscsi/iqn.2007-05.com.example:storage.disk1.sys1.xyz': done.
        -> Adding device 'disk1' at LUN 0 to driver/target 'iscsi/iqn.2007-05.com.example:storage.disk1.sys1.xyz': done.
        -> Enabling driver/target 'iscsi/iqn.2007-05.com.example:storage.disk1.sys1.xyz': done.
        -> Enabling driver 'iscsi': done.
        -> Done, 9 change(s) made.

All done.

3. 연결 테스트
initiator단에서 iscsiadm를 통해 연결 테스트를 진행하다
[root@sheepdog-1 ~]# iscsiadm -m discovery -t sendtargets -p 10.10.200.214
10.10.200.214:3260,1 iqn.2007-05.com.example:storage.disk1.sys1.xyz
10.10.200.214:3260,1 iqn.2007-05.com.example:bollpen

연결 target:iqn.2007-05.com.example:bollpen
[root@sheepdog-1 ~]# iscsiadm -m node -T iqn.2007-05.com.example:bollpen -l Logging in to [iface: default, target: iqn.2007-05.com.example:bollpen, portal: 10.10.200.214,3260] (multiple) Login to [iface: default, target: iqn.2007-05.com.example:bollpen, portal: 10.10.200.214,3260] successful.
scsi 장치 보기
[root@sheepdog-1 ~]# cat /proc/scsi/scsi 
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi7 Channel: 00 Id: 00 Lun: 00
  Vendor: SCST_BIO Model: disk2            Rev:  210
  Type:   Direct-Access                    ANSI  SCSI revision: 05

SCST target을 통해 할당된 HDD를 보십시오.
[root@sheepdog-1 ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00006c10

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         131     1048576   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             131         392     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             392       26109   206568448   8e  Linux LVM

Disk /dev/mapper/vg_sheepdog1-LogVol00: 211.5 GB, 211522945024 bytes
255 heads, 63 sectors/track, 25716 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdb: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 524288 bytes
Disk identifier: 0x00000000

 
 

좋은 웹페이지 즐겨찾기