45Drives Knowledge Base
Setup iSCSI Storage Server on Rocky Linux
https://knowledgebase.45drives.com/kb/setup-iscsi-storage-server-on-rocky-linux/

Setup iSCSI Storage Server on Rocky Linux

Posted on November 2, 2021 by Archie Blanchard


Scope/Description

In this article, we'll cover setting up iSCSI targets on Rocky Linux.

(We don't recommend using bonds with iSCSI, we recommend using Multi-path instead)

Prerequisites

Steps

Install necessary packages for iSCSI

dnf -y install targetcli

Create a ZFS dataset to store iSCSI images

 

Configuring iSCSI Target

Create Block Backstores for iSCSI LUNs

cd /tank/images
dd if=/dev/zero of=lun0 bs=1 count=0 seek=1T

targetcli 
cd backstores/fileio
create lun0 /tank/images/lun0

Create an iSCSI Target

cd /iscsi
create iqn.2021-11.fourfive.lab:test.environment

Create iSCSI LUNs

cd iqn.2021-11.fourfive.lab:test.environment/tpg1/luns
create /backstores/fileio/lun0

Configure ACL (Initiator IQN)

Configure Authentication

set auth userid=username
set auth password=password

Exit and Save the Configuration

Open Firewall for iSCSI and enable the iSCSI service

Verification

Troubleshooting

cd iscsi
/iscsi> delete iqn.2021-04.com.45lab:ubuntu.iscsi0 
Deleted Target iqn.2021-04.com.45lab:ubuntu.iscsi0.
cd /backstores/fileio/

/backstores/fileio> delete lun0 
Deleted storage object lun0.