1、在28.6.11.80上,另外再增加一块8G的磁盘sdb,用fdisk划分为一个分区/dev/sdb1,准备用作iscsi共享存储,用于存放apache页面。另外再增加一块大小不少于100M的硬盘/dev/sdc,通过iscsi共享给linux1183和linux1115访问,做集群的qdisk使用。
[root@linux1180 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk identifier: 0x000673ff
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinderboundary.
/dev/sda2 64 1306 9972736 8e Linux LVM
Disk /dev/sdc: 209 MB, 209715200 bytes
64 heads, 32 sectors/track, 200 cylinders
Units = cylinders of 2048 * 512 = 1048576bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk identifier: 0x00000000
Disk /dev/sdc doesn't contain a validpartition table
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk identifier: 0x29abae1b
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux2、安装scsi-target-utils软件提供iscsi服务
[root@linux1180 ~]# yum installscsi-target-utils3、修改/etc/tgt/targets.conf,添加:
<targetiqn.2011-06.com.domain:server.target1>
backing-store /dev/sdb1
backing-store /dev/sdc
</target>4、重启tgtd服务,并将其设为开机启动:
[root@linux1180~]# /etc/init.d/tgtd restart
[root@linux1180~]# chkconfig tgtd on
[root@linux1180~]# chkconfig tgtd --list
tgtd 0:off 1:off 2:on 3:on 4:on 5:on 6:off4、查看服务状态,可以看到已经提供了一个7G的ISCSI LUN 1卷
[root@linux1180~]# tgt-admin --show
Target 1:iqn.2011-06.com.domain:server.target1
System information:
Driver: iscsi
State: ready
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: 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: 8587MB, Block size: 512
Online: Yes
Removablemedia: No
Readonly:No
Backingstore type: rdwr
Backing store path: /dev/sdb1
Backingstore flags:
LUN: 2
Type: disk
SCSI ID:IET 00010002
SCSI SN:beaf12
Size: 210MB, Block size: 512
Online: Yes
Removablemedia: No
Readonly:No
Backingstore type: rdwr
Backingstore path: /dev/sdc
Backingstore flags:
Account information:
ACL information:
ALL6、打开防火墙端口3260或者关闭防火墙
(二)iscsi客户端配置1、在28.6.11.83安装iscsi客户端软件iscsi-initiator-utils
[root@linux1183 ~]# yum install iscsi-initiator-utils2、发现服务器28.6.11.80的iscsi共享卷
[root@linux1183~]# iscsiadm -m discovery -t sendtargets -p linux1180
28.6.11.80:3260,1iqn.2011-06.com.domain:server.target1linux1180为主机名,使用IP地址也可
2、登录iscsi存储
[root@linux1183~]# iscsiadm -m node -T iqn.2011-06.com.domain:server.target1 -p 28.6.11.80:3260-l