Linux做iSCSI共享存储实验

rikeyone 2012-02-10

一、安装环境

1、系统:CentOS 5.4 x86
2、外部存储:linux下的iscsi
3、iscsi服务器配置


二、下载安装程序:

1、下载iSCSI Enterprise Target安装程序
(最新版下载地址http://sourceforge.net/projects/iscsitarget/files/iscsitarget/

具体下载目录在 /2012年资料/2月/10日/Linux做iSCSI共享存储实验/

 

2、解压缩
# tar -zxvf iscsitarget-1.4.20.2.tar.gz
# cd iscsitarget-1.4.20.2

3、编译、安装
# make
# make install

4、设置开机启动服务
# chkconfig iscsi-target on
# service iscsi-target start


三、配置iscsi设备:

1、建立共享存储目录
# mkdir /iscsishare

2、建立共享存储卷组
# cd /iscsishare
# dd if=/dev/zero of=/iscsishare/iqn.ocr1.img bs=1M count=0 seek=150
# dd if=/dev/zero of=/iscsishare/iqn.ocr2.img bs=1M count=0 seek=150
# dd if=/dev/zero of=/iscsishare/iqn.vote1.img bs=1M count=0 seek=200
# dd if=/dev/zero of=/iscsishare/iqn.vote2.img bs=1M count=0 seek=200
# dd if=/dev/zero of=/iscsishare/iqn.vote3.img bs=1M count=0 seek=200
# dd if=/dev/zero of=/iscsishare/iqn.data.img bs=1G count=0 seek=20
# dd if=/dev/zero of=/iscsishare/iqn.fra.img bs=1G count=0 seek=30

3、修改iscsi配置文件

# cd /etc/iet/

# vim ietd.conf
iSNSServer 192.168.0.11 第20行去掉前面的#号注释,修改IP为本机地址

Target iqn.ocr1.img 第35行去掉前面的#号注释,增加上面dd所生成的存储卷名
Target iqn.ocr2.img
Target iqn.vote1.img
Target iqn.vote2.img
Target iqn.vote3.img
Target iqn.data.img
Target iqn.fra.img

Lun 0 Path=/iscsishare/iqn.ocr1.img,Type=fileio,ScsiId=ocr1,ScsiSN=ocr1 第58行去掉前面的#号注释,修改为存储目录路径
Lun 1 Path=/iscsishare/iqn.ocr2.img,Type=fileio,ScsiId=ocr2,ScsiSN=ocr2
Lun 2 Path=/iscsishare/iqn.vote1.img,Type=fileio,ScsiId=vote1,ScsiSN=vote1
Lun 3 Path=/iscsishare/iqn.vote2.img,Type=fileio,ScsiId=vote2,ScsiSN=vote2
Lun 4 Path=/iscsishare/iqn.vote3.img,Type=fileio,ScsiId=vote3,ScsiSN=vote3
Lun 5 Path=/iscsishare/iqn.data.img,Type=fileio,ScsiId=data,ScsiSN=data
Lun 6 Path=/iscsishare/iqn.fra.img,Type=fileio,ScsiId=fra,ScsiSN=fra


4、重启iscsi-target服务

# service iscsi-target restart

相关推荐