1、什么是iSCSI?
iSCSI技术是一种由IBM公司研究开发的,是一个供硬件设备使用的可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够在诸如高速千兆以太网上进行路由选择。iSCSI技术是一种新储存技术,该技术是将现有SCSI接口与以太网络(Ethernet)技术结合,使服务器可与使用IP网络的储存装置互相交换资料。
iSCSI:Internet 小型计算机系统接口 (iSCSI:Internet Small Computer System Interface)。
Internet 小型计算机系统接口(iSCSI)是一种基于 TCP/IP的协议,用来建立和管理 IP 存储设备、主机和客户机等之间的相互连接,并创建存储区域网络(SAN)。SAN 使得 SCSI 协议应用于高速数据传输网络成为可能,这种传输以数据块级别(block-level)在多个数据存储网络间进行。
SCSI 结构基于客户/服务器模式,其通常应用环境是:设备互相靠近,并且这些设备由 SCSI 总线连接。iSCSI 的主要功能是在 TCP/IP 网络上的主机系统(启动器 initiator)和存储设备(目标器 target)之间进行大量数据的封装和可靠传输过程。此外,iSCSI 提供了在 IP 网络封装 SCSI 命令,且运行在 TCP 上。
2、环境介绍:
本次部署由3台物理机实现,具体信息分别为以下:
a、iSCSI_Server:192.168.30.133
b、iSCSI_Client1:192.168.30.131
c、iSCSI_Client2:192.168.30.132
需要用到的软件为:
a、scsi-target-utils # 提供Server端服务
b、iscsi-initiator-utils #提供Client服务
二、安装部署服务端,即iSCSI_Server
1、在服务端创建可共享的磁盘或卷;这里就新添加一块新磁盘做为共享;
查看新添加的硬盘:
[root@iSCSI_Server ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da3dc
Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 30720 30944256 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
2、对硬盘进行分区并创建LVM卷:
[root@iSCSI_Server ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x47756356.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p # 查看分区信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System
Command (m for help): n #新建一个分区
Command action
e extended
p primary partition (1-4)
e # 新建一个逻辑分区
Partition number (1-4): 4 # 卷标为 4
First cylinder (1-20480, default 1):
Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-20480, default 20480):
Using default value 20480Command (m for help): p # 查看信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System/dev/sdb4 1 20480 20971504 5 Extended
Command (m for help): n # 新建逻辑卷