LIO 配置

现在主流Linux都可以设置iSCSI,如STGT/TGT、LIO Target等。Linux-IO(LIO)Target是当前Linux标准的iSCSI target的开源实现,包含在Linux内核(2.6.38后)中。LIO不发起会话,而是提供LUNs,等待来自SCSI initiator的命令并进行所需的I/O数据传输。更详细的参考:http://en.wikipedia.org/wiki/LIO_Target

设置一个target,包含以下组件:

存储设备:使用Linux作为target,可以使用LVM逻辑卷来作为底层存储设备,也可以使用其他存储设备,如分区、硬盘、稀疏文件等。

LUN ID:每个通过iSCSI target共享的存储设备是当做一个LUN来共享,每个LUN都有一个唯一ID。

Target ID:如果想要授权target连接到特定节点,创建不同的target,每个target有自己的target ID,也称为IQN(Internet Qualifiied Name)。iSCSI客户端使用IQN来进行连接。

Identifier:标识符用来识别特定的iSCSI target。

端口号:target监听的TCP端口,默认是3260。

CentOS7上使用targetcli命令来设置iSCSI target.

# systemctl enable target.service
# systemctl start target.service

targetcli支持不同的后端存储,当创建iSCSI磁盘时,必须指定后端存储类型。targetcli来查看可用的后端存储。

[root@node114 lib]# targetcli
targetcli shell version 2.1.fb37
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'. /> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 0]
o- loopback ......................................................................................................... [Targets: 0]

添加LVM,使用命令“/backstores/fileio create lun1 /opt/disk1.img 1.5T”可以添加一个稀疏文件的target,

添加裸盘,则"/backstores/block create lun1 /dev/sdb"

/> /backstores/fileio create lun0  /var/lib/iscsi.img 1500G
Created fileio lun0 with size 1610612736000
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 1]
| | o- lun0 ................................................................. [/var/lib/iscsi.img (1.5TiB) write-back deactivated]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 0]
o- loopback ......................................................................................................... [Targets: 0]

定义target

/> /iscsi create
Created target iqn.2003-01.org.linux-iscsi.node114.x8664:sn.1fd7d0e50a51.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.

查看创建的TPG

/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 1]
| | o- lun0 ................................................................. [/var/lib/iscsi.img (1.5TiB) write-back deactivated]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.node114.x8664:sn.1fd7d0e50a51 ......................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 0]
| o- luns .......................................................................................................... [LUNs: 0]
| o- portals .................................................................................................... [Portals: 1]
| o- 0.0.0.0:3260 ..................................................................................................... [OK]
o- loopback ......................................................................................................... [Targets: 0]

创建iscsi目标

/> cd /iscsi/iqn.2003-01.org.linux-iscsi.node114.x8664:sn.1d0909400c72/tpg1/
/iscsi/iqn.20...09400c72/tpg1> ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth]
o- acls ................................................................................................................ [ACLs: 0]
o- luns ................................................................................................................ [LUNs: 0]
o- portals .......................................................................................................... [Portals: 1]
o- 0.0.0.0:3260 ........................................................................................................... [OK]
/iscsi/iqn.20...09400c72/tpg1> portals/ create
Using default IP port 3260
Binding to INADDR_ANY (0.0.0.0)
This NetworkPortal already exists in configFS.
/iscsi/iqn.20...09400c72/tpg1> luns/ create /backstores/fileio/lun0
Created LUN 0.
/iscsi/iqn.20...09400c72/tpg1> set attribute authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1
Parameter demo_mode_write_protect is now '0'.
Parameter authentication is now '0'.
Parameter generate_node_acls is now '1'.
Parameter cache_dynamic_acls is now '1'.

保存配置

/iscsi/iqn.20...09400c72/tpg1> cd /
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 1]
| | o- lun0 ................................................................... [/var/lib/iscsi.img (1.5TiB) write-back activated]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.node114.x8664:sn.1d0909400c72 ......................................................... [TPGs: 1]
| o- tpg1 .................................................................................................. [gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 0]
| o- luns .......................................................................................................... [LUNs: 1]
| | o- lun0 ............................................................................... [fileio/lun0 (/var/lib/iscsi.img)]
| o- portals .................................................................................................... [Portals: 1]
| o- 0.0.0.0:3260 ..................................................................................................... [OK]
o- loopback ......................................................................................................... [Targets: 0]
/> saveconfig
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json

iscsi target 之LIO配置的更多相关文章

  1. linux iSCSI target/initiator配置

    linux iSCSI target配置全过程一:Install iSCSI target for Linux1,操作系统:[root@rac2 ~]# cat /etc/issueEnterpris ...

  2. 在Ubuntu 12.04上配置iSCSI Target服务

      今天自己按照网上搜来的教程自己在Ubuntu 12.04上配置了iSCSI Target服务,在这里简单地做个纪录.操作系统是全新安装的Ubuntu 12.04,配置一块500 GB的SATA笔记 ...

  3. iscsi介绍及iscsi target配置

    iSCSI 主要是透过 TCP/IP 的技术,将储存设备端透过 iSCSI target (iSCSI 目标) 功能,做成可以提供磁盘的服务器端,再透过 iSCSI initiator (iSCSI ...

  4. CentOS7 下安装 iSCSI Target(tgt) ,使用 Ceph rbd

    目录 一.iSCSI 介绍 1. iSCSI 定义 2. 几种常见的 iSCSI Target 3. 优缺点比较 二.安装步骤 1. 关闭防火墙 2. 关闭selinux 3. 通过 yum 安装 t ...

  5. iscsi target 研究

    一.概述 目前 Linux 上主要有三个 iSCSI Target 实现: Linux SCSI Target – STGT / tgt     Linux-IO Target – LIO SCST ...

  6. iscsi target IET架构

    IET(iSCSI Enterprise Target)是内核态实现的iscsi target,相比于用户态实现的target(比如tgt),iet比较稳定,并且也算是历史悠久,io都直接经过内核态, ...

  7. ISCSI target的两种安装方法

    1 tgt程序架构 tgt是用户态实现的iscsi target,而iet(iscsi enterprise target)是在内核态实现的target,tgt相比于iet来说,因为其用户态实现,方便 ...

  8. 在 iSCSI Target 服务器中使用LVM创建和设置LUN(二)

    LUN是逻辑单元号,它与iSCSI存储服务器共享.iSCSI 目标器通过TCP/IP网络共享它的物理驱动器给发起程序(initiator).这些来自一个大型存储(SAN:Storage Area Ne ...

  9. 使用iSCSI Target创建集中式安全存储(一)

    iSCSI 是一种块级别的协议,用于通过TCP/IP网络共享原始存储设备,可以用已经存在的IP和以太网如网卡.交换机.路由器等通过iSCSI协议共享和访问存储.iSCSI target是一种由远程iS ...

随机推荐

  1. C# Winform 未能加载文件或程序集"System.Data.SQLite"或它的某一个依赖项。试图加载格式不正确的程序

    在使用Winform 开发了一个小软件,其中使用了SQLite作为数据库 但在我的Win7 64位系统上却出现了以下错误: System.BadImageFormatException: 未能加载文件 ...

  2. ESXI部署OVF模板提示用户已取消操作处理方法

    ESXI导出OVF部署到新的ESXI服务器上,Linux主机没有出现用户已取消操作的提示,部署WINDOW虚拟机的时候,提示用户已取消操作,如图: ​首先,要先了解为什么会出现这个问题,原因在于,在做 ...

  3. ElasticSearch 5.X 搜索并用高亮显示

    public List<WOSearchModel> searchOrder(OrderSearchReqVO request) throws Exception{List<WOSe ...

  4. (纪录片)光的故事 BBC Light Fantastic (2004)

    简介: 导演: Jeremy Turner主演: Simon Schaffer / Dimitri Andreas ... Al Hazen / Edmund Dehn ... Priest/Old ...

  5. C++ 多态的原理

    1.多态解决什么问题? 面向抽象编程,用户不需要关心引用或者指针的真实类型,已经内部实现.2.C++ 要具备多态的性质,满足两个条件:表面类型和真实类型不一样,方法是虚方法.3.多态是如何实现的? 实 ...

  6. cocos2d-x 手游源代码站

    尊重开发人员的劳动成果,转载的时候请务必注明出处:http://blog.csdn.net/haomengzhu/article/details/37829061 1.魔幻方块 链接:魔幻方块源代码 ...

  7. C#中添加三个线程同时启动执行某一方法,并依次调用某方法中的循环打印输。

    添加三个线程同时启动执行某一方法,并依次调用某方法中的打印输:ABC ABC ABC ABC 实现代码如下: using System; using System.Collections.Generi ...

  8. 微信小程序尝鲜一个月现状分析

    概述 曾记得在微信小程序还没有上线的时候,大家都是翘首以待.希望在张小龙,在企鹅的带领下,走出差别于原生开发的还有一条移动开发的道路,我也是一直关注着.知道1月9号,微信小程序最终对外开放了,作为第一 ...

  9. android形状drawable

    1.在res目录下新建drawable目录. 2.新建一个xml文件. 3.採用drawable来定义资源. <? xml version="1.0" encoding=&q ...

  10. SqlDataAdapter概述

    SqlDataAdapter是 DataSet和 SQL Server之间的桥接器,用于检索和保存数据.SqlDataAdapter通过对数据源使用适当的Transact-SQL语句映射 Fill(它 ...