This post is for reference only and does not contain every steps of the configuration tasks.
Versions:
- Ubuntu Server 16.04.1 for iSCSI target installation
- Windows Server 2012 R2 for Cluster Service
Background:
There are a number of ways to create a iSCSI target supported for Windows Cluster service (i.e. the iSCSI target supports SCSI-3 persistent reservation), for instance, FreeNAS, OpenFiler or a dedicated NAS unit. Ubuntu Server is my choice due to its small footprints (512MB RAM or less). Among the packages available, targetcli (as opposed to iscsitarget) is the only choice to allow persistent reservation.
Procedures:
All commands below are run as root.
Step 1: Install and run the command
# apt-get install targetcli
# targetcli
Step 2: create a disk image with the name "disk01" on /mnt/vdb1/iscsi_disks/disk01.img with size 10 GB
/> cd backstores/fileio
/backstores/fileio> create disk01 /mnt/vdb1/iscsi_disks/disk01.img 10G
Step 3: create a target (assume iqn = iqn.2016-07.iscsisvr.local:storage.target00, which is the iSCSI identifier for the server side) and connect the backend storage
/backstores/fileio> cd /iscsi
/iscsi> create iqn.2016-07.iscsisvr.local:storage.target00
/iscsi> cd iqn.2016-07.iscsisvr.local:storage.target00/tpg1/luns
/iscsi/iqn.20.../tpg1/luns> create /backstores/fileio/disk01
Step 4: set IP address to listen and ACL (change the iSCSI initiator name accordingly, they are the clients that will connect to this iSCSI target)
/iscsi/iqn.20.../tpg1/luns> cd ../portals
/iscsi/iqn.20.../tpg1/portals> create 0.0.0.0
/iscsi/iqn.20.../tpg1/portals> cd ../acls
/iscsi/iqn.20.../tpg1/acls> create iqn.2016-07.iscsi.initiator.name:alias
Step 5: Define access rights (in this reference we only discuss demo mode, which means "open" access)
/iscsi/iqn.20.../tpg1/acls> cd ..
/iscsi/iqn.20.../tpg1> set attribute authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1
/iscsi/iqn.20.../tpg1> cd /
/> saveconfig
/> exit
Step 6: Complete. The effect should be immediate but I suggest doing a reboot.
Reference #1:
https://www.server-world.info/en/note?os=Ubuntu_16.04&p=iscsi
Reference #2:
http://linux-iscsi.org/wiki/ISCSI