How to Install an iSCSI Storage Server on Ubuntu 22.04

Introduction

iSCSI (Internet Small Computer System Interface) is a protocol used for accessing and sharing storage devices over a network. Setting up an iSCSI storage server allows you to centralize storage resources and provide block-level access to multiple clients. This tutorial will guide you through the process of installing an iSCSI storage server on Ubuntu 22.04.

Prerequisites

Before you begin, ensure you have:

  1. An Ubuntu 22.04 server with a sufficient amount of storage
  2. SSH access to the server
  3. Root or sudo privileges

Step 1: Install iSCSI Target Software

Install the iSCSI target software (targetcli) using the following command:

sudo apt update
sudo apt install -y targetcli

Step 2: Configure iSCSI Target

Launch the iSCSI target shell:

sudo targetcli

Create a backstore for your iSCSI disk. For example, to create a 10GB file-based backstore, use the following command:

backstores/fileio create disk01 /path/to/disk01.img 10G

Create an iSCSI target and associate the backstore with it:

iscsi/ create iqn.2022-04.com.example:storage01
iscsi/iqn.2022-04.com.example:storage01/tpg1/luns/ create /backstores/fileio/disk01

Set the authentication method (optional):

iscsi/iqn.2022-04.com.example:storage01/tpg1/acls create iqn.2022-04.com.example:client01

Exit the iSCSI target shell:

exit

Step 3: Configure Firewall

If the firewall is enabled on your system, allow iSCSI traffic (port 3260) using the following command:

sudo ufw allow 3260/tcp

Step 4: Start and Enable iSCSI Target Service

Start and enable the iSCSI target service:

sudo systemctl start target
sudo systemctl enable target

Step 5: Connect iSCSI Initiator

On the client machine (iSCSI initiator), use the iSCSI initiator software to connect to the iSCSI target. Configure the initiator to connect to the iSCSI target using its IQN (iSCSI Qualified Name).

Conclusion

Congratulations! You have successfully installed and configured an iSCSI storage server on Ubuntu 22.04. You can now use this server to provide block-level storage to your clients over the network.

Was this answer helpful? 0 Users Found This Useful (0 Votes)