OS VERSION:redhat 7
服务端配置
存储资源准备
fdisk -l
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x86e972ea
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2099199 1048576 83 Linux
/dev/vdb2 2099200 4196351 1048576 83 Linux
/dev/vdb3 4196352 6293503 1048576 83 Linux
/dev/vdb4 6293504 20971519 7339008 5 Extended
/dev/vdb5 6295552 8392703 1048576 83 Linux
使用mdadm创建raid5
[root@server0 samba]# mdadm -Cv /dev/md0 -n 3 -l 5 -x 1 /dev/vdb1 /dev/vdb2 /dev/vdb3 /dev/vdb5
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 1047552K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@desktop0 samba]#
[root@server0 ~]# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
[root@server0 ~]# vgcreate vg /dev/md0
Volume group "vg" successfully created
[root@server0 ~]# lvcreate -L 1G -n /dev/vg/lv
Logical volume "lv" created
[root@server0 ~]#
ISCSI技术在工作形式上分为服务端(target)与客户端(initiator)。ISCSI服务端是用于存放硬盘存储资源的服务器,它作为上面创建的RAID磁盘阵列的存储端,能够为用户提供可用的存储资源。ISCSI客户端则是用户使用的软件,用于访问远程服务端的存储资源。
1、服务端安装软件包
[root@server0 ~]# yum install targetd targetcli
开机启动服务
[root@server0 ~]# systemctl enable targetd
ln -s '/usr/lib/systemd/system/targetd.service' '/etc/systemd/system/multi-user.target.wants/targetd.service'
2、配置ISCSI服务端共享资源,/backstores/block是ISCSI服务端配置共享设备的位置
[root@server0 ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> 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 ............................................................................................................