iscsi配置
服务端配置:
[root@localhost cd]#
yum install scsi-target-utils
yum install compat-db -y
yum isntall libXp* -y
yum install openmotif22-2.2.3-18.i386.rpm
---启动服务:
[root@localhost cd]# service tgtd restart
服务端:
[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 10443.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
First cylinder (2825-10443, default 2825):
Using default value 2825
Last cylinder or +size or +sizeM or +sizeK (2825-10443, default 10443):
Using default value 10443
Command (m for help): p
Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 19 152586 83 Linux
/dev/sda2 20 2569 20482875 83 Linux
/dev/sda3 2570 2824 2048287+ 82 Linux swap / Solaris
/dev/sda4 2825 10443 61199617+ 5 Extended
/dev/sda5 2825 10443 61199586 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@localhost cd]# vi /etc/tgt/targets.conf
<target iqn.2008-09.com.example:test_rac>
backing-store /dev/sda5
</target>
iqn.yyyy-mm.<reversed domain name>:identifier
iqn.年年-月.单位网域名的反转写法:这个分享的target名称
backing-store (虚拟的装置), direct-store (实际的装置): 设定装置时,如果你的整颗磁盘是全部被拿来当iSCSI 分享之用,
那么才能够使用direct-store 。不过,根据网路上的其他文件, 似乎说明这个设定值有点危险的样子。所以,基本上还是建议单纯
使用模拟的backing-store 较佳。
initiator-address (使用者端位址): 如果你想要限制能够使用这个target 的用户端来源,才需要填写这个设定值。基本上,不用设定
它(代表所有人都能使用的意思), 因为我们后来会使用iptables 来规范可以连接的客户端
incominguser (使用者帐号密码设定): 如果除了来源IP 的限制之外,你还想要让使用者输入帐密才能使用你的iSCSI target 的话,
那么就加用这个设定项目。此设定后面接两个参数,分别是帐号与密码啰。
write-cache [off|on] (是否使用快取): 在预设的情况下,tgtd 会使用快取来增快速度。不过,这样可能会有遗失资料的风险。
所以,比较重要的话, 或许不要使用快取,直接存取装置会比较妥当一些。
[root@localhost cd]#
[root@localhost cd]#
[root@localhost cd]# service tgtd restart
Stopping SCSI target daemon: Stopping target framework daemon
[确定]
Starting SCSI target daemon: Starting target framework daemon
[root@localhost cd]# chkconfig tgtd on
[root@localhost cd]# chkconfig --list tgtd
tgtd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@localhost cd]# tgt-admin --show
Target 1: iqn.2008-09.com.example:test_rac
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: rdwr
Backing store path: None
Account information:
ACL information:
ALL
客户端配置:
[root@localhost network-scripts]# yum install iscsi-initiator-utils*
----启动服务:
[root@localhost network-scripts]# service iscsi restart
客户端发现服务:
[root@localhost network-scripts]# iscsiadm -m discovery -t sendtargets -p 10.10.6.51:3260
10.10.6.51:3260,1 iqn.2008-09.com.example:test_rac
登入
iscsiadm -m node -T iqn.2008-09.com.example:test_rac -p 10.10.6.51:3260 -l
登出
iscsiadm -m node -T iqn.2008-09.com.example:test_rac -p 10.10.6.51:3260 -u
[root@localhost network-scripts]# fdisk /dev/sdb