RHCE7认证学习笔记34——配置ISCSI
一、存储设备类型
DSA:直接区域存储
NAS:网络区域存储
SAN:存储区域网络,块级别共享
二、配置iscsi服务器端
这里举例子说明,假如服务器有2个分区/dev/sdb7,/dev/sdb8要共享出去:
/dev/sdb7 1230848 1640447 200M Linux filesyste
/dev/sdb8 1640448 2459647 400M Linux filesyste
安装target包:
[root@linuxidc ~]# yum install target\* -y
启动target服务
[root@linuxidc ~]# systemctl start target
配置步骤:
1、准备要共享的块;
使用targetcli命令进入target配置界面:
[root@linuxidc ~]# targetcli
/> pwd
/
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 0]
o- loopback ......................................................................................................... [Targets: 0]
进入backstores/block目录创建要共享的块,创建block1和block2:
/> cd backstores/
/backstores> ls
o- backstores ................................................................................................................ [...]
o- block .................................................................................................... [Storage Objects: 0]
o- fileio ................................................................................................... [Storage Objects: 0]
o- pscsi .................................................................................................... [Storage Objects: 0]
o- ramdisk .................................................................................................. [Storage Objects: 0]
/backstores/block> create block1 dev=/dev/sdb7
Created block storage object block1 using /dev/sdb7.
/backstores/block> create block2 dev=/dev/sdb8
Created block storage object block2 using /dev/sdb8.
/backstores/block> ls
o- block ...................................................................................................... [Storage Objects: 2]
o- block1 .......................................................................... [/dev/sdb7 (200.0MiB) write-thru deactivated]
o- block2 .......................................................................... [/dev/sdb8 (400.0MiB) write-thru deactivated]
exit退出保存targetcli,并重新进入:
/backstores/block> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@linuxidc ~]# targetcli
2、创建一个target;
target标准名字格式:
年 月 域名倒写 名字
iqn.2015-02.com.sg:disk1
进入iscsi目录,创建target:
/iscsi> create iqn.2015-02.com.sg:disk1
/iscsi> ls
o- iscsi .............................................................................................................. [Targets: 1]
o- iqn.2015-02.com.sg:disk1 ............................................................................................ [TPGs: 1]
3、在target上面创建一个lun;
进入/iscsi/iqn.2015-02.com.sg:disk1/tpg1目录:
/iscsi/iqn.20...sg:disk1/tpg1> ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth]
o- acls ................................................................................................................ [ACLs: 0]
o- luns ................................................................................................................ [LUNs: 0]
o- portals .......................................................................................................... [Portals: 0]
acls目录创建共享密码:
/iscsi/iqn.20...sg:disk1/tpg1> acls/ create iqn.2015-02.com.sg:diskpasswd