-
Notifications
You must be signed in to change notification settings - Fork 28
Simple iSCSI target and initiator setup
We will use FreeBSD and its CAM Target Layer (CTL) as an iSCSI target.
The example FreeBSD installation will have the IP address 192.168.1.32
Verify that you see all the block devices intended for iSCSI LUNs to be created. You can make use of zvol-backed LUNs, generic block device-backed LUNs or file-backed LUNs.
If you intend to use zvol-backed LUNs, then:
Create zpool where the zvols for LUNs will reside:
# zpool create -m none -O volmode=dev zpool_iscsi /dev/vtbd1
Create zvol(s) for the LUNs:
# zfs create -o volmode=dev -V 9g zpool_iscsi/pg0-vol0
Create /etc/ctl.conf:
portal-group pg0 {
discovery-auth-group no-authentication
listen 0.0.0.0
listen [::]
}
target iqn.2017-01.org.danubecloud:target0 {
auth-group no-authentication
portal-group pg0
lun 0 {
backend block
path /dev/zvol/zpool_iscsi/pg0-vol0
blocksize 4096
device-id FREEBSD
serial 00010001
}
}
pg0 is an arbitrary name chosen for, so called, portal group.
Set mode 0600 on /etc/ctl.conf
chmod 600 /etc/ctl.conf
Enable ctld in /etc/rc.conf and start ctld:
# echo 'ctld_enable="YES"' >> /etc/rc.conf
# service ctld start
Verify that you see the LUNs:
# ctladm devlist
LUN Backend Size (Blocks) BS Serial Number Device ID
0 block 2359296 4096 00010001 FREEBSD
Install Danube Cloud node
Enable iSCSI initiator in global zone:
# svcadm enable -r svc:/network/iscsi/initiator:default
Setup iSCSI discovery address:
# iscsiadm add discovery-address **192.168.1.32**
The IP address 192.168.1.32 is the address that the iSCSI target has. If you plan to use multihoming, just specify the respective IP address where the iSCSI should communicate.
Enable iSCSI sendtargets
discovery method:
# iscsiadm modify discovery -t enable
- verify that you see iscsi targets:
In dmesg
:
/scsi_vhci/disk@g465245454253442046524545425344000000000000000000 (sd2) online
In iostat -En
:
# iostat -En
c1t465245454253442046524545425344000000000000000000d0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FREEBSD Product: CTLDISK Revision: 0001 Serial No: 00010001
Size: 9.66GB <9663676416 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
Create zpool
on iSCSI:
# zpool create iscsi /dev/dsk/c1t465245454253442046524545425344000000000000000000d0
You are all set!
And be careful to not create situation where global zone would depend on iSCSI target that has not been booted yet!
Homepage | User Guide | API Reference | Wiki