无题有意 發表於 2025-6-13 00:00:00

centos6.3 部署iscsi

<p></p>
<p><strong>安装scsi-target-utils</strong></p>
<pre># yum install scsi-target-utils
# /etc/init.d/tgtd start</pre>
<p>创建一个id为1的iscsi目标</p>
<pre># tgtadm &ndash;lld iscsi &ndash;op new &ndash;mode target &ndash;tid 1 -T iqn.2013-12-13.target.sdb</pre>
<p>&ndash;lld iscsi 指定驱动类型<br />&ndash;op new &nbsp;新建<br />&ndash;mode target 目标模式<br />&ndash;tid 1 &nbsp;给后面的iscsi表示指定一个id号<br />-T iqn.2013-12-13.target.sdb</p>
<p>创建一个iscsi共享磁盘的标识,iqn是标识的一种格式,2013-12-13是描述创建时间可以是任意字符串,target是iscsi服务器的主 机名可以是任意字符串,sdb是共享的设备名称的描述可以是任意字符串<br />为上一步创建的iscsi目标添加一个逻辑卷</p>
<pre># tgtadm &ndash;lld iscsi &ndash;op new &ndash;mode logicalunit &ndash;tid 1 &ndash;lun 1 -b /dev/sdb</pre>
<p>&ndash;mode logicalunit &nbsp;模式为逻辑卷<br />&ndash;tid 1 将该逻辑卷指派给id为1的iscsi目标<br />&ndash;lun 1 设置lun号为1<br />-b /dev/sdb 指定该逻辑卷使用的物理设备<br />设置iscsi目标的的访问策略,允许所有人访问</p>
<pre>tgtadm &ndash;lld iscsi &ndash;op bind &ndash;mode target &ndash;tid 1 -I ALL</pre>
<p>查看 lun信息</p>
<pre>tgtadm &ndash;lld iscsi &ndash;op show &ndash;mode target</pre>
<p><strong>iscsi客户端安装&nbsp;</strong></p>
<pre># yum install iscsi-initiator-utils</pre>
<p>发现iscsi目标</p>
<pre># iscsiadm -m discovery &ndash;type sendtargets &ndash;portal 192.168.216.20 或者
# iscsiadm -m discovery -t st -p 192.168.216.20</pre>
<p>查看iscsi发现名称</p>
<pre>iscsiadm -m node</pre>
<p>登录iscsi</p>
<pre>iscsiadm -m node -T&nbsp;iqn.2013-12-13.target.sdb&nbsp;-p 192.168.216.20 &ndash;login
或者
iscsiadm -m node -T&nbsp;iqn.2013-12-13.target.sdb&nbsp;&nbsp;-p 192.168.216.20 -l</pre>
<p>端口iscsi连接</p>
<pre># iscsiadm -m node -T&nbsp;iqn.2013-12-13.target.sdb &nbsp;-p 192.168.216.20 -u</pre>
<p>删除iscsi发现</p>
<pre># iscsiadm -m node -o delete -T&nbsp;iqn.2013-12-13.target.sdb -p 192.168.216.20</pre>
<p></p>
<p>本文转自:http://www.zhengdazhi.com/index.php/centos6-3-%E9%83%A8%E7%BD%B2iscsi/</p>
頁: [1]
查看完整版本: centos6.3 部署iscsi