iSCSI allows you to connect network storage to a local machine over TCP and have it show up like a normal disk in the operating system. This hopefully simple guide will walk through the process of setting up iSCSI in FreeNAS and connecting to the storage in Debian 8 and Windows 8.1.
For better performance multiple NICs can be utilized with MPIO (multipath). It does not seem possible to use LACP (link aggregation) to achieve better performance with iSCSI. MPIO must be used. This guide will be updated for multipath if I ever decide to get a quad-port gigabit NIC.
There are several reasons to use iSCSI:
Virtual machine storage
Instead of using local storage for VMs you can setup an iSCSI target on the host and give the VM its own LV to use (LVM). This gives the benefits of ZFS and not needing internal storage.
Add more storage without the overhead of SMB, NFS, or AFP
Performance will not be as good as locally connected storage in most cases.
Each iSCSI target is limited to one client. This means the target cannot be accessed by multiple machines at once where an SMB, NFS, or AFP share can be.
You will need FreeNAS and a Debian client or Windows client.
Log into your FreeNAS server
Select “Storage” from the top menu bar
From there select your local zvol and select “Create zvol” from the bottom
Give your zvol a name and size
Select “Services” from the top menu bar
Turn on “iSCSI”
Once iSCSI is enabled, click on the wrench beside iSCSI
Select the “Portals” tab
Select “Add Portal”
Go to the next tab “Initiators”
Select “Add Initiator” and click “OK”
Select “Authorized Access” and click “Add Authorized Access”
This menu is for CHAP authentication. You should add a user for each iSCSI target. Give it a strong password.
Next, select “Targets” and add a new iSCSI target
Finally, add a LUN by selecting “Associated Targets”
Windows iSCSI Setup
Open the iSCSI Initiator
On the “Targets” tab enter the IP address of your FreeNAS server and select “Quick Connect…”
This will give you a list of all the targets that were discovered.
Select the target you wish to connect to and click “Connect”
From here you will need to set up CHAP authentication. Select “Advanced…” -> “Enable CHAP log on”
The password is the CHAP secret you set in FreeNAS.
“OK” -> “OK”
If you did everything right it will now say “Connected” under “Discovered targets”.
Navigate to the “Volumes and Devices” tab and click “Auto Configure”. You should see a new volume appear in the dialog.
You can now format the new volume by going into “Disk Management”.
Debian iSCSI Setup
apt-get install open-iscsi multipath-tools
Enable CHAP and automatic startup
/etc/iscsi/iscsid.conf1234node.startup = automaticnode.session.auth.authmethod = CHAPnode.session.auth.username = USERNAMEnode.session.auth.password = PASSWORD
systemctl restart open-iscsi
Discover iSCSI targets
iscsiadm -m discovery -t sendtargets -p IP_ADDRESS
Log into all possible iSCSI targets
iscsiadm -m node --login
You should now be able to see a new block device show up in
Logging out of all iSCSI targets:
iscsiadm -m node -u
These benchmarks are from inside a KVM virtual machine with an LV on the FreeNAS server. Writeback caching is disabled and it is connected via 1Gb Ethernet.