centos7 scst安装

查看kernel版本

ip: 172.24.8.29
uname -a
我的系统信息:
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

环境准备

  1. mkdir /root/scst
  2. yum install -y bzip2 gcc perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker cpan parted psmisc
    kernel-devel的版本要与系统的kernel版本对应,uname -a
  3. wget -P /root/scst https://buildlogs.centos.org/c7-updates/kernel/3.10.0-123.el7/20140630120647/kernel-devel-3.10.0-123.el7.x86_64.rpm
  4. rpm -i /root/scst/kernel-devel-3.10.0-123.el7.x86_64.rpm

磁盘挂载作为虚拟空间

mkdir /mnt/vdb1
mkdir /mnt/vdb2
mkdir /mnt/vdb3

parted /dev/vdb mklabel gpt
parted /dev/vdb mkpart 0 0 30G
parted /dev/vdb mkpart 1 30G 70G

mkfs.ext3 /dev/vdb1
mkfs.ext3 /dev/vdb2

mount /dev/vdb1 /mnt/vdb1
mount /dev/vdb2 /mnt/vdb2
chmod -R 777 /mnt/*

下载解压scst安装包

  1. 下载scst安装包到/root/scst目录中
    https://sourceforge.net/projects/scst/files/3.1.0/scstadmin-3.1.0.tar.bz2/download
    https://sourceforge.net/projects/scst/files/3.1.0/scst-3.1.0.tar.bz2/download
    https://sourceforge.net/projects/scst/files/3.1.0/iscsi-scst-3.1.0.tar.bz2/download
    以上连接不能直接wget
  2. 解压tar.gz2
    tar -jxvf *.tar.gz2

安装scst

先安装scst,然后再安装iscsi-scst与scstadmin,顺序不能乱,不然会报错。
1. cd /root/scst/scst-3.1.0/scst
2. make all
3. make install
4. cd /root/scst/iscsi-scst-3.1.0
5.make all
6. make install
7. cd /root/scst/scstadmin-3.1.0
8. make all
9. make install

配置:

  1. cp /root/scst/iscsi-scst-3.1.0/etc/scst.conf /etc
  2. cat /etc/scst.conf
HANDLER vdisk_fileio {
        DEVICE disk01 {
                filename /dev/vdb1
                nv_cache 1
        }
        DEVICE disk02 {
                filename /dev/vdb2
                nv_cache 1
        }
}

TARGET_DRIVER iscsi {
        enabled 1

        TARGET iqn.2006-10.net.vlnb:tgt {
                LUN 0 disk01
                LUN 1 disk02

                enabled 1
        }
}

scst服务启动

设置开机启动

chkconfig --add scst
chkconfig --level 2345 scst on
chkconfig --list scst (scst 0:off   1:off   2:on    3:on    4:on    5:on    6:off

service scst start

lsmod |grep scst:只有启动成功才会看到如下内容

scst_vdisk            100172  0 
isert_scst             52317  4 
iscsi_scst             98514  5 isert_scst
scst                 2121923  3 iscsi_scst,scst_vdisk,isert_scst
rdma_cm                43464  1 isert_scst
ib_core                87335  6 rdma_cm,ib_cm,ib_sa,iw_cm,ib_mad,isert_scst
crc_t10dif             12714  1 scst
dlm                   169682  1 scst
libcrc32c              12644  4 xfs,sctp,iscsi_scst,scst_vdisk

关闭防火墙

systemctl stop firewalld

initiator 连接

windows
控制面板—->管理工具—->iSCSI发起程序
centos7 scst安装_第1张图片
在目标中填入安装scst机器的ip
打开磁盘管理可以看到如下内容
centos7 scst安装_第2张图片

linux
ip:172.24.8.24
lsblk
centos7 scst安装_第3张图片
yum install -y iscsi-initiator-utils
service iscsi start
chkconfig iscsi on
发现目标
iscsiadm -m discovery -t sendtargets -p 172.24.8.29:3260
此时找到并拥有了一个目标(target):172.24.8.29:3260,1 iqn.2006-10.net.vlnb:tgt 被发现的目标也叫做节点。
登录节点
iscsiadm -m node -T iqn.2006-10.net.vlnb:tgt -p 172.24.8.29:3260 -l
lsblk
centos7 scst安装_第4张图片
发现多了两个盘

你可能感兴趣的:(scst)