KB450300 – Setup iSCSI Storage Server on Ubuntu 20.04 LTS

Last modified: April 6, 2021
You are here:
  • KB Home
  • KB450300 – Setup iSCSI Storage Server on Ubuntu 20.04 LTS
Estimated reading time: 1 min

Setup iSCSI Storage Server on Ubuntu 20.04 LTS

Scope/Description:

In this tutorial, we will explain how to setup iSCSI targets on Ubuntu 20.04 server as well as iSCSI initiators in Windows, VMware and Linux.

The iSCSI target is LIO and is managed via targetcli

Prerequisites:

  • ZFS Storage pool configured

Steps:

Install needed packages for iSCSI

apt install targetcli-fb

Create ZFS zvols to be used as LUNs

  • In this example there is a zpool created named “tank” with a dataset created called “blocks”
  • Create a zvol named “lun1” of 1 TiB size with blocksize=128k
zfs create -V 1T -b 128k tank/blocks/lun0
  • Create as many more block to used as iSCSI luns as needed with the same command as above

Configure iSCSI Target

Create Block Backstores for iSCSI LUNS
  • Launch “targetcli” and create a block backstore using the zvol(s) created above
root@ceph-ubuntu1:~# targetcli
targetcli shell version 2.1.51
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> cd backstores/block 
/backstores/block> create lun1 /dev/zvol/tank/blocks/lun0 
Created block storage object lun1 using /dev/zvol/tank/blocks/lun0.
  • If using more than one zvol repeat the process above
  • Verify your block devices have been created in targetcli
/backstores/block> ls
o- block ...................................................................................................... [Storage Objects: 1]
  o- lun0 ............................................................. [/dev/zvol/tank/blocks/lun0 (1.0TiB) write-thru deactivated]
    o- alua ....................................................................................................... [ALUA Groups: 1]
      o- default_tg_pt_gp ........................................................................... [ALUA state: Active/optimized]
Create an iSCSI Target
  • Create the iSCSI target by selecting its name
    • naming rule : iqn.YYYY-MM.REVERSE.DOMAIN.NAME:unique
    • In this example the target name will be “iqn.2021-04.com.45lab:ubuntu.iscsi0”
/backstores/block> cd /iscsi 
/iscsi> create iqn.2021-04.com.45lab:ubuntu.iscsi0
Created target iqn.2021-04.com.45lab:ubuntu.iscsi0.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
Create iSCSI LUNs
/iscsi> cd iqn.2021-04.com.45lab:ubuntu.iscsi0/tpg1/luns 
/iscsi/iqn.20...si0/tpg1/luns> create /backstores/block/lun1 
Created LUN 0.
Configure ACL (Inititator IQN)
  • The ACL to be created is the initiator IQN name of teh client that will be connecting to the LUN.
    • In the example the Windows client’s IQN is “iqn.1991-05.com.microsoft:win10”
/iscsi/iqn.20...si0/tpg1/luns> cd /iscsi/iqn.2021-04.com.45lab:ubuntu.iscsi0/tpg1/acls 
/iscsi/iqn.20...si0/tpg1/acls> create iqn.1991-05.com.microsoft:win10
Created Node ACL for iqn.1991-05.com.microsoft:win10
Created mapped LUN 0.
Configure Authentication
  • Configure userid and password when connecting to the LUN from the client. This is optional.
    • Choose any name and password for “userid” and “password”
/iscsi/iqn.20...si0/tpg1/acls> cd iqn.1991-05.com.microsoft:win10/
/iscsi/iqn.20...crosoft:win10> set auth userid=username
Parameter userid is now 'username'.
/iscsi/iqn.20...crosoft:win10> set auth password=password
Parameter password is now 'password'.
Exit and Save Configuration
/iscsi/iqn.20...crosoft:win10> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/rtslib-fb-target/saveconfig.json
Open Firewall for iSCSI and enable rtslib service
  • In Houston UI add “iscsi” service to firewall in the Networking Module

  • Enable “rtslib-fb-targetctl” service

Configure Windows initiator

  • Open “iSCSI Initiator”
  • Enter Target IP into “Target” feild
  • Hit quick-connect

Verification:

Troubleshooting:

Was this article helpful?
Dislike 0
Views: 18
Unboxing Racking Storage Drives Cable Setup Power UPS Sizing Remote Access