------------------------------------------------------
------------------------------------------------------
III. 命令行操作(方法一:)
scsi-targer (server)
yum install -y scsi-target-utils
tips: = iscsi
= selfdeine_number
= iqn.yyyy-mm.xxx.xxx.xxx:xxx #命名方法
= NUMBER
= device path -> ex: /dev/sdb3
= 允许 access 的网卡地址
service tgtd start
step1.
==== create id = name ====
tgtadm --lld --op new --mode target --tid --targetname
== delete ==
tgtadm --lld --op delete --mode target --tid
=== show ===
tgtadm --lld --op show --mode target
tgtadm --lld --op show --mode target --tid
=== lun mapping ===
tgtadm --lld --op new --mode logicalunit --tid --lun --backing-store
==== lun unmapping ===
tgtadm --lld --op delete --mode logicalunit --tid --lun
===== network access control list ====
tgtadm --lld --op bind --mode target --tid --initiator-address
tgtadm --lld --op unbind --mode target --tid --initiator-address
====== 修改信息 ==========
tgtadm --lld --op update --mode target --tid --name= --value=
tgtadm --lld --op update --mode target --tid --params parameter=value<,...>
参数
vendor_id=
product_id=
readonly=<0|1>
-----------------------------------------------------------------------
IV.配置文件(方法二)
client initiator(发起人) ---->server iscsi-targetd
yum install scsi-targert-utils
vi /etc/tgt/targets.conf
iqn.2012-08.com.server.milipp:share
命名方法:iqn.年-月.域名(主机名)反着写:磁盘命名
backing-store /dev/sdb1 #接的你用作存储的磁盘
incominguser binbin 123456 (#通过chap算法允许访问的user和密码,格式是incoming user password)
initiator-address 192.168.9.8 (# 接允许谁来访问的IP)
scsi_id 1234567 #scsi的ID号,给它一个惟一的ID号;
service tgtd start
tgt-admin -s 此命令是查看服务端是否配置成功。
Target 1: iqn.2012-08.com.server.milipp:newdisk
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: 1234567
SCSI SN: beaf11
Size: 2147 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: /dev/sdb1
Backing store flags:
Account information:
binbin
ACL information:
192.168.9.8
client---(无论是命令还是配置文件操作都要做下面客户端使用配置)
yum install -y scsi-initiator-utils
vi /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = binbin
node.session.auth.password = 123456
discovery.sendtargets.auth.authmethod = CHAP
discovery.sendtargets.auth.username = binbin
discovery.sendtargets.auth.password = 123456
service iscsid start
iscsiadmin -m discovery -T sendtargets -p 192.168.9.6
\--> iqn.2012-08.com.server.milipp:share
\->/var/lib/iscsi/*
login
iscsiadm -m node -T iqn.2012-08.com.server.milipp:share -l
logout
iscsiadm -m node -T iqn.2012-08.com.server.milipp:share -u
erase
iscsiadm -o delete -m node -T iqn.2012-08.com.server.milipp:share
client登录存储后,先mount
ex:---/ mount /dev/sdb /disk
cd /disk
mkdir aa bb 新建几个文件进行测试,然后umount
iscsiadm -m node -T iqn.2012-08.com.server.milipp:share -u 用这条命令登出
回到iscsi-server查看/dev/sdb1里面有没有client新增加文件,如果有则成功了!到此则结束了。
阅读(2220) | 评论(0) | 转发(0) |