在独立存储设备中,LUN(Logical Unit Number)是最重要的基本单位。LUN可以被SAN中的任何主机访问,不管是透过HBA或是iSCSI。当你安装好OpenFiler之后,接下来就是要将OpenFiler下的磁盘分享出来给虚拟机或网络上的其他主机使用,这就是一台共享存储设备了。
添加一块大容量磁盘
在你的openfiler虚拟机编辑上增加一块硬盘,记住要先关闭虚拟机;
选择推荐的SCSI;
我们选择大一点,200G吧,然后开启虚拟机;
看看我们能不能识别得到刚才添加的硬盘,/dev/sdb: 214.7 GB;
[root@operfiler ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 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 identifier: 0x000516d7
Device Boot Start End Blocks Id System
/dev/sda1 * 63 2104514 1052226 83 Linux
/dev/sda2 2104515 23069339 10482412+ 8e Linux LVM
/dev/sda3 23069340 44034164 10482412+ 8e Linux LVM
/dev/sda4 44034165 104856254 30411045 5 Extended
/dev/sda5 44034228 64998989 10482381 8e Linux LVM
/dev/sda6 64999053 85963814 10482381 8e Linux LVM
/dev/sda7 85963878 104856254 9446188+ 8e Linux LVM
Disk /dev/sdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders, total 419430400 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 identifier: 0x00000000
下面你就可以一步一步创建的OpenFiler下的VG,通过OpenFiler提供的浏览器图形工具,在你登录后,点击Volumes标签
点击右方的Block Devices,可以看到添加的磁盘,点击/dev/sdb;
点击右下方的Reset,然后点击Create,分区类型为Physical volume;
点击右上方的Volume Groups;
输入名称,勾选,点击Add volume group;
可以看到vmvg已经添加了,点击右方的Add Volume;
输入内容,调整磁盘大小为2G,卷类型选择block(iSCSI,FC,etc),点击Create,创建逻辑卷;
依次创建5个逻辑卷,形成下图,你可以创建很多个,但是下面5个是安装oracle rac 必备的;
开启iSCSI Target服务
点击Services标签栏设置iSCSI Target 为Enable 开启服务Start,可以理解为通过iSCSI在一定的网络中公布这些LUN;
创建新目标 IQN
点击Volumes--iSCSI Targets--Target Configuration,将后面tsn.78574bfe777a这一串修改成racdb.ocr01;用你喜欢用更具含义的字串来替换这个默认目标 IQN 最后一段。再点击Add;
将相应的 iSCSI 逻辑卷映射到该目标,选择后点击Change;
LUN Mapping操作
选择LUN Mapping标签,将0 /dev/vmvg/ocr01点击Unmap;
如此反复操作,创建
iqn.2006-01.com.openfiler:racdb.orc02
iqn.2006-01.com.openfiler:racdb.orc03
iqn.2006-01.com.openfiler:racdb.data
iqn.2006-01.com.openfiler:racdb.fra
然后分别在select iSCSI Target下选择它们,然后Change,再到LUN Mapping标签Unmap。
配置网络访问控制
进入左上角的System,并且直接拉到页面的下方。在Network Access Configuration的地方输入这个网络访问的名称,如vmvg2(这个名称可以随便取)。输入主机的IP段。注意不可以输入单一主机的IP,这样会都无法访问。我们在这边输入192.168.3.0,表示从192.168.3.0这一个网段都可以访问。在Netmask中选择255.255.255.0,并且在Type下拉列表框中选择Share,之后即可以单击Update按钮;
选择Volumes,选择iSCSI Targets,选择Network ACL,把vmvg2这个网段的Access设置改成Allow,然后Update,反复操作另外4个iqn.2006-01.com……
最后通过终端,在命令行下注释掉
iqn.2006-01.com.openfiler:racdb.ocr01 ALL
iqn.2006-01.com.openfiler:racdb.orc02 ALL
iqn.2006-01.com.openfiler:racdb.orc03 ALL
iqn.2006-01.com.openfiler:racdb.data ALL
iqn.2006-01.com.openfiler:racdb.fra ALL
[root@operfiler /]#vi /etc/initiators.deny
# PLEASE DO NOT MODIFY THIS CONFIGURATION FILE!
# This configuration file was autogenerated
# by Openfiler. Any manual changes will be overwritten
# Generated at: Wed Jul 31 0:47:58 CST 2019
iqn.2006-01.com.openfiler:tsn.69a7e332255a ALL
#iqn.2006-01.com.openfiler:racdb.ocr01 ALL
#iqn.2006-01.com.openfiler:racdb.orc02 ALL
#iqn.2006-01.com.openfiler:racdb.orc03 ALL
#iqn.2006-01.com.openfiler:racdb.data ALL
#iqn.2006-01.com.openfiler:racdb.fra ALL
# End of Openfiler configuration
这一台虚拟的存储设备,我们就配置完成了!它可以在你允许的网络中被别的主机看到了。下面记录一下这个存储设备的一些信息。
[root@operfiler /]# service iscsi-target status
ietd (pid 6755) is running...
[root@operfiler /]# more /etc/ietd.conf
##### WARNING!!! - This configuration file generated by Openfiler. DO NOT MANUALLY EDIT. #####
Target iqn.2006-01.com.openfiler:tsn.69a7e332255a
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Target iqn.2006-01.com.openfiler:racdb.ocr01
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Lun 1 Path=/dev/vmvg/ocr02,Type=blockio,ScsiSN=yeR4We-ye0L-rlxG,ScsiId=yeR4We-ye0L-rlxG,IOMode=wt
Lun 2 Path=/dev/vmvg/ocr03,Type=blockio,ScsiSN=1MDTKp-MZbt-nrEG,ScsiId=1MDTKp-MZbt-nrEG,IOMode=wt
Lun 3 Path=/dev/vmvg/data,Type=blockio,ScsiSN=hXYihb-YoKy-ccdd,ScsiId=hXYihb-YoKy-ccdd,IOMode=wt
Lun 4 Path=/dev/vmvg/fra,Type=blockio,ScsiSN=PBlYSx-oXot-SMQO,ScsiId=PBlYSx-oXot-SMQO,IOMode=wt
Target iqn.2006-01.com.openfiler:racdb.orc02
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Lun 0 Path=/dev/vmvg/ocr02,Type=blockio,ScsiSN=yeR4We-ye0L-rlxG,ScsiId=yeR4We-ye0L-rlxG,IOMode=wt
Target iqn.2006-01.com.openfiler:racdb.orc03
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Lun 0 Path=/dev/vmvg/ocr03,Type=blockio,ScsiSN=1MDTKp-MZbt-nrEG,ScsiId=1MDTKp-MZbt-nrEG,IOMode=wt
Target iqn.2006-01.com.openfiler:racdb.data
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Lun 0 Path=/dev/vmvg/data,Type=blockio,ScsiSN=hXYihb-YoKy-ccdd,ScsiId=hXYihb-YoKy-ccdd,IOMode=wt
Target iqn.2006-01.com.openfiler:racdb.fra
HeaderDigest None
DataDigest None
MaxConnections 1
InitialR2T Yes
ImmediateData No
MaxRecvDataSegmentLength 131072
MaxXmitDataSegmentLength 131072
MaxBurstLength 262144
FirstBurstLength 262144
DefaultTime2Wait 2
DefaultTime2Retain 20
MaxOutstandingR2T 8
DataPDUInOrder Yes
DataSequenceInOrder Yes
ErrorRecoveryLevel 0
Lun 0 Path=/dev/vmvg/fra,Type=blockio,ScsiSN=PBlYSx-oXot-SMQO,ScsiId=PBlYSx-oXot-SMQO,IOMode=wt
来源:https://blog.csdn.net/cd4836/article/details/97766229