码迷,mamicode.com
首页 > 其他好文 > 详细

Centos 安装配置iscsi

时间:2015-09-10 01:47:11      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:

在测试oracle rac的时候用iscsi来模拟磁阵的(真的磁阵需要多路径软件),简单的记录下

#scsi server
yum install scsi-target-utils

service tgtd start

chkconfig tgtd on

mkdir /srv/iscsi
dd if=/dev/zero of=/srv/iscsi/disk01.img bs=1M count=200

 

#配置虚拟磁盘
vi /etc/tgt/targets.conf
#backing-store (虚拟的装置)
#direct-store (实际的装置)

<target iqn.2014-11.dev.iscsi-target:iscsidisk>
backing-store /srv/iscsi/disk01.img
initiator-address 192.168.55.0/24
incominguser iscsiadm iscsiadm123
write-cache off
</target>

 

[root@localhost ~]# tgt-admin -show
Target 1: iqn.2014-11.dev.iscsi-target:iscsidisk
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, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags: 
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 210 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /srv/iscsi/disk1.img
Backing store flags: 
Account information:
ACL information:
192.168.55.0/24

[root@localhost ~]# tgt-admin --show
Target 1: iqn.2014-11.dev.iscsi-target:iscsidisk
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 5
Initiator: iqn.1994-05.com.redhat:1e12cf823426
Connection: 0
IP Address: 192.168.55.159
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags: 
Account information:
ACL information:
ALL

 

#scsi client install
yum install iscsi-initiator-utils

chkconfig iscsid on
chkconfig iscsi on
/etc/init.d/iscsi start
/etc/init.d/iscsid start

 

#add
#vi /etc/iscsi/iscsid.conf
node.session.auth.username = iscsiadm
node.session.auth.password = iscsiadm123

#修改客户端名字
vi /etc/iscsi/initiatorname.iscsi
#InitiatorName=iqn.1994-05.com.redhat:1e12cf823426
InitiatorName=iqn.2014-11.dev.iscsi-initiator:initiator

#发现
iscsiadm -m discovery -t sendtargets -p 192.168.55.158
192.168.55.158:3260,1 iqn.2014-11.dev.iscsi-target:iscsidisk

#登陆
iscsiadm -m node -T iqn.2014-11.dev.iscsi-target:iscsidisk -p 192.168.55.158:3260 --login
Logging in to [iface: default, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] (multiple)
Login to [iface: default, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] successful.

#退出
iscsiadm -m node -T iqn.2014-11.dev.iscsi-target:iscsidisk -p 192.168.55.158:3260 --logout
Logging out of session [sid: 1, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260]
Logout of [sid: 1, target: iqn.2014-11.dev.iscsi-target:iscsidisk, portal: 192.168.55.158,3260] successful.

 

#查看连接
iscsiadm -m session
tcp: [5] 192.168.55.158:3260,1 iqn.2014-11.dev.iscsi-target:iscsidisk (non-flash)

 

#查看

[root@localhost ~]# fdisk -l

Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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: 0x0004c11a

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1567 12069888 8e Linux LVM

Disk /dev/mapper/VolGroup-lv_root: 11.1 GB, 11068768256 bytes
255 heads, 63 sectors/track, 1345 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/mapper/VolGroup-lv_swap: 1287 MB, 1287651328 bytes
255 heads, 63 sectors/track, 156 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: 209 MB, 209715200 bytes
7 heads, 58 sectors/track, 1008 cylinders
Units = cylinders of 406 * 512 = 207872 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 

Centos 安装配置iscsi

标签:

原文地址:http://www.cnblogs.com/caoguo/p/4796435.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!