SCST Linux SAN
Here is provided some detail in configuring and using the SCST iSCSI Linux SAN. Some scripts are provided and some suggestions on logical layout of LUNs for use with KVM Oracle guests.
SCSI Initiators
The KVM Oracle 6.x guests when first created will have scsi initiators with default names similar to that shown below. It is helpful for logical purposes to give the initiator a new more meaningful name, such as shown below. The naming convention used here includes the hostname of the KVM Oracle guest (oracle631) as part of the initiator name. Reasons for that will become clear later in this post, but to touch on it now, in the SCST iSCSI SAN /etc/scst.conf file the LUNs are logically organized in SCST groups (keyword GROUP) and specific initiators on the KVM Oracle guest clients can be associated with those groups in the /etc/scst.conf file. This type of naming and organization helps in making the configuration details at the SCST SAN more meaningful and clear as to which LUNs map to which KVM Oracle guests.
[root@oracle631 ~]# cat /etc/iscsi/initiatorname.iscsi.bak.20140818.1756
# InitiatorName=iqn.1988-12.com.oracle:49c39d4d389d
InitiatorName=iqn.2014-08.org.vmem:oracle631.asm
[root@oracle631 ~]#
For example, here is a typical /etc/scst.conf file for a two-node Oracle setup (in this case an KVM Oracle guest hosting a standalone Dataguard primary database, and a companion KVM Oracle guest hosting a standalone Dataguard standby database), as shown below. Note that there is a single target, but that that single target has multiple GROUP definitions named after the KVM Oracle guests to which the LUNs map. Some features of the below /etc/scst.conf file to note are listed below.
There are block devices in use ("vdisk_blockio" handler)
There are file devices in use ("vdisk_fileio" handler)
The "blocksize=4096" attribute is used with some of both the block and file devices. This parameter sets the "logical" block size in SCST
The INITIATOR keyword associates an iSCSI initiator on the KVM Oracle guest with the GROUP and allows only that initiator to access that GROUP (ACL).
[root@oracle651 scripts]# cat /etc/scst.conf
# Automatically generated by SCST Configurator v2.2.1.
HANDLER vdisk_blockio {
DEVICE disk0 {
blocksize 4096
filename /dev/vdc
}
DEVICE disk1 {
filename /dev/vdb
}
}
HANDLER vdisk_fileio {
DEVICE AsmDat631_01 {
filename /scst_oracle631/AsmDat631_01.img
}
DEVICE AsmDat631_02 {
filename /scst_oracle631/AsmDat631_02.img
}
DEVICE AsmDat631_03 {
filename /scst_oracle631/AsmDat631_03.img
}
DEVICE AsmDat631_04 {
filename /scst_oracle631/AsmDat631_04.img
}
DEVICE AsmDat631_05 {
filename /scst_oracle631/AsmDat631_05.img
}
DEVICE AsmDat631_06 {
filename /scst_oracle631/AsmDat631_06.img
}
DEVICE AsmDat631_07 {
filename /scst_oracle631/AsmDat631_07.img
}
DEVICE AsmDat631_08 {
filename /scst_oracle631/AsmDat631_08.img
}
DEVICE AsmDat632_01 {
blocksize 4096
filename /scst_oracle632/AsmDat632_01.img
}
DEVICE AsmDat632_02 {
blocksize 4096
filename /scst_oracle632/AsmDat632_02.img
}
DEVICE AsmDat632_03 {
blocksize 4096
filename /scst_oracle632/AsmDat632_03.img
}
DEVICE AsmDat632_04 {
blocksize 4096
filename /scst_oracle632/AsmDat632_04.img
}
DEVICE AsmDat632_05 {
blocksize 4096
filename /scst_oracle632/AsmDat632_05.img
}
DEVICE AsmDat632_06 {
blocksize 4096
filename /scst_oracle632/AsmDat632_06.img
}
DEVICE AsmDat632_07 {
blocksize 4096
filename /scst_oracle632/AsmDat632_07.img
}
DEVICE AsmDat632_08 {
blocksize 4096
filename /scst_oracle632/AsmDat632_08.img
}
DEVICE AsmRec631_01 {
filename /scst_oracle631/AsmRec631_01.img
}
DEVICE AsmRec631_02 {
filename /scst_oracle631/AsmRec631_02.img
}
DEVICE AsmRec631_03 {
filename /scst_oracle631/AsmRec631_03.img
}
DEVICE AsmRec631_04 {
filename /scst_oracle631/AsmRec631_04.img
}
DEVICE AsmRec631_05 {
filename /scst_oracle631/AsmRec631_05.img
}
DEVICE AsmRec631_06 {
filename /scst_oracle631/AsmRec631_06.img
}
DEVICE AsmRec631_07 {
filename /scst_oracle631/AsmRec631_07.img
}
DEVICE AsmRec631_08 {
filename /scst_oracle631/AsmRec631_08.img
}
DEVICE AsmRec632_01 {
blocksize 4096
filename /scst_oracle632/AsmRec632_01.img
}
DEVICE AsmRec632_02 {
blocksize 4096
filename /scst_oracle632/AsmRec632_02.img
}
DEVICE AsmRec632_03 {
blocksize 4096
filename /scst_oracle632/AsmRec632_03.img
}
DEVICE AsmRec632_04 {
blocksize 4096
filename /scst_oracle632/AsmRec632_04.img
}
DEVICE AsmRec632_05 {
blocksize 4096
filename /scst_oracle632/AsmRec632_05.img
}
DEVICE AsmRec632_06 {
blocksize 4096
filename /scst_oracle632/AsmRec632_06.img
}
DEVICE AsmRec632_07 {
blocksize 4096
filename /scst_oracle632/AsmRec632_07.img
}
DEVICE AsmRec632_08 {
blocksize 4096
filename /scst_oracle632/AsmRec632_08.img
}
DEVICE AsmSys631_01 {
filename /scst_oracle631/AsmSys631_01.img
}
DEVICE AsmSys632_01 {
filename /scst_oracle632/AsmSys632_01.img
}
}
TARGET_DRIVER iscsi {
enabled 1
TARGET iqn.2014-08.org.vmem:oracle651.san.asm.luns {
cpu_mask ff
enabled 1
rel_tgt_id 3
GROUP oracle631 {
LUN 0 AsmSys631_01
LUN 1 AsmDat631_01
LUN 2 AsmDat631_02
LUN 3 AsmDat631_03
LUN 4 AsmDat631_04
LUN 5 AsmDat631_05
LUN 6 AsmDat631_06
LUN 7 AsmDat631_07
LUN 8 AsmDat631_08
LUN 9 AsmRec631_01
LUN 10 AsmRec631_02
LUN 11 AsmRec631_03
LUN 12 AsmRec631_04
LUN 13 AsmRec631_05
LUN 14 AsmRec631_06
LUN 15 AsmRec631_07
LUN 16 AsmRec631_08
LUN 18 disk0
LUN 19 disk1
INITIATOR iqn.2014-08.org.vmem:oracle631.asm
cpu_mask ff
}
GROUP oracle632 {
LUN 0 AsmSys632_01
LUN 1 AsmDat632_01
LUN 2 AsmDat632_02
LUN 3 AsmDat632_03
LUN 4 AsmDat632_04
LUN 5 AsmDat632_05
LUN 6 AsmDat632_06
LUN 7 AsmDat632_07
LUN 8 AsmDat632_08
LUN 9 AsmRec632_01
LUN 10 AsmRec632_02
LUN 11 AsmRec632_03
LUN 12 AsmRec632_04
LUN 13 AsmRec632_05
LUN 14 AsmRec632_06
LUN 15 AsmRec632_07
LUN 16 AsmRec632_08
INITIATOR iqn.2014-08.org.vmem:oracle632.asm
cpu_mask ff
}
}
}
[root@oracle651 scripts]#
The SCST script which would generate this /etc/scst.conf file is shown below. Some notes to be aware of are listed below. Note that the maximum length of a device name (argument of the "-open_dev" clause) is 16 characters.
[root@oracle651 scripts]# cat create_san.sh
# Script creates the SCST SAN
# Gilbert Standen
# 2014-08-18 19:52 CDT
scstadmin -open_dev AsmSys631_01 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmSys631_01.img
scstadmin -open_dev AsmDat631_01 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_01.img
scstadmin -open_dev AsmDat631_02 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_02.img
scstadmin -open_dev AsmDat631_03 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_03.img
scstadmin -open_dev AsmDat631_04 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_04.img
scstadmin -open_dev AsmDat631_05 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_05.img
scstadmin -open_dev AsmDat631_06 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_06.img
scstadmin -open_dev AsmDat631_07 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_07.img
scstadmin -open_dev AsmDat631_08 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmDat631_08.img
scstadmin -open_dev AsmRec631_01 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_01.img
scstadmin -open_dev AsmRec631_02 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_02.img
scstadmin -open_dev AsmRec631_03 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_03.img
scstadmin -open_dev AsmRec631_04 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_04.img
scstadmin -open_dev AsmRec631_05 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_05.img
scstadmin -open_dev AsmRec631_06 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_06.img
scstadmin -open_dev AsmRec631_07 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_07.img
scstadmin -open_dev AsmRec631_08 -handler vdisk_fileio -attributes filename=/scst_oracle631/AsmRec631_08.img
scstadmin -open_dev disk0 -handler vdisk_fileio -attributes filename=/dev/vdc,blocksize=4096
scstadmin -open_dev disk1 -handler vdisk_fileio -attributes filename=/dev/vdb
scstadmin -write_config /etc/scst.conf
scstadmin -open_dev AsmSys632_01 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmSys632_01.img
scstadmin -open_dev AsmDat632_01 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_01.img,blocksize=4096
scstadmin -open_dev AsmDat632_02 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_02.img,blocksize=4096
scstadmin -open_dev AsmDat632_03 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_03.img,blocksize=4096
scstadmin -open_dev AsmDat632_04 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_04.img,blocksize=4096
scstadmin -open_dev AsmDat632_05 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_05.img,blocksize=4096
scstadmin -open_dev AsmDat632_06 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_06.img,blocksize=4096
scstadmin -open_dev AsmDat632_07 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_07.img,blocksize=4096
scstadmin -open_dev AsmDat632_08 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmDat632_08.img,blocksize=4096
scstadmin -open_dev AsmRec632_01 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_01.img,blocksize=4096
scstadmin -open_dev AsmRec632_02 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_02.img,blocksize=4096
scstadmin -open_dev AsmRec632_03 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_03.img,blocksize=4096
scstadmin -open_dev AsmRec632_04 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_04.img,blocksize=4096
scstadmin -open_dev AsmRec632_05 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_05.img,blocksize=4096
scstadmin -open_dev AsmRec632_06 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_06.img,blocksize=4096
scstadmin -open_dev AsmRec632_07 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_07.img,blocksize=4096
scstadmin -open_dev AsmRec632_08 -handler vdisk_fileio -attributes filename=/scst_oracle632/AsmRec632_08.img,blocksize=4096
scstadmin -write_config /etc/scst.conf
scstadmin -add_target iqn.2014-08.org.vmem:oracle651.san.asm.luns -drive iscsi
scstadmin -add_group oracle632 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns
scstadmin -add_group oracle631 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns
scstadmin -write_config /etc/scst.conf
scstadmin -add_lun 0 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmSys631_01
scstadmin -add_lun 1 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_01
scstadmin -add_lun 2 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_02
scstadmin -add_lun 3 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_03
scstadmin -add_lun 4 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_04
scstadmin -add_lun 5 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_05
scstadmin -add_lun 6 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_06
scstadmin -add_lun 7 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_07
scstadmin -add_lun 8 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmDat631_08
scstadmin -add_lun 9 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_01
scstadmin -add_lun 10 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_02
scstadmin -add_lun 11 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_03
scstadmin -add_lun 12 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_04
scstadmin -add_lun 13 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_05
scstadmin -add_lun 14 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_06
scstadmin -add_lun 15 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_07
scstadmin -add_lun 16 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device AsmRec631_08
scstadmin -add_lun 18 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device disk0
scstadmin -add_lun 19 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631 -device disk1
scstadmin -write_config /etc/scst.conf
scstadmin -add_lun 0 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmSys632_01
scstadmin -add_lun 1 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_01
scstadmin -add_lun 2 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_02
scstadmin -add_lun 3 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_03
scstadmin -add_lun 4 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_04
scstadmin -add_lun 5 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_05
scstadmin -add_lun 6 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_06
scstadmin -add_lun 7 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_07
scstadmin -add_lun 8 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmDat632_08
scstadmin -add_lun 9 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_01
scstadmin -add_lun 10 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_02
scstadmin -add_lun 11 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_03
scstadmin -add_lun 12 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_04
scstadmin -add_lun 13 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_05
scstadmin -add_lun 14 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_06
scstadmin -add_lun 15 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_07
scstadmin -add_lun 16 -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632 -device AsmRec632_08
scstadmin -write_config /etc/scst.conf
scstadmin -add_init iqn.2014-08.org.vmem:oracle632.asm -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle632
scstadmin -add_init iqn.2014-08.org.vmem:oracle631.asm -driver iscsi -target iqn.2014-08.org.vmem:oracle651.san.asm.luns -group oracle631
scstadmin -enable_target iqn.2014-08.org.vmem:oracle651.san.asm.luns -driver iscs
scstadmin -set_drv_attr iscsi -attributes enabled=1
scstadmin -write_config /etc/scst.conf
[root@oracle651 scripts]#
This is how a SCST iSCSI Linux SAN was created. The commands to login to this SAN from the KVM Oracle guest iSCSI clients is shown below.