iSCSI usage tutorial

iSCSI (Internet Small Computer System Interface) is a protocol for transmitting SCSI commands over a network, allowing storage devices to communicate over a network, similar to directly connected storage. It can virtualize storage resources, achieve centralized management, network sharing, and remote access, and is suitable for scenarios such as data centers, virtualized environments, and backup and recovery.
Through this tutorial, you will learn how to configure and use iSCSI in ZimaOS to improve storage management efficiency, simplify network storage architecture, and achieve flexible data access methods.

Prerequisites

  1. The hard disk used is not in use
  2. Confirm the client’s IQN

Operation steps

Server

Make sure your ZimaOS has been upgraded to 1.2.5 or above.

  1. Use the command sudo -i to enter superuser mode,Start targetcli
    targetcli

  1. Create a LUN, assuming /dev/sde is used as the storage backend(Here we use sde. You can use the lsblk to view the device status and change to sda or sdb..):
    cd backstores/block
    create myblockdev /dev/sde

  1. Create an iSCSI target (iqn.2024-10.com.zima:target1 is an example)
    cd /iscsi
    create iqn.2024-10.com.zima:target1

  1. Add a LUN to the target
    cd iqn.2024-10.com.zima:target1/tpg1/luns
    create /backstores/block/myblockdev

  1. Set the ACL (access control list) to allow the connection. The IQN here needs to be consistent with the client(Open iSCSI Initiator, it is in the Configuration tab)
    cd ../acls
    create iqn.1993-08.org.debian:01:bb1e6772dfb6

Client

Windows

  1. Open iSCSI Initiator, in the Discovery tab, click Discover Portal

  2. Configure the IP address, click OK

  3. In the Targets tab, click Connect

  4. Open Computer Management, click Storage > Disk Management, and you can see the newly connected iSCSI volume

Linux

  1. Discover iSCSI targets
    iscsiadm -m discovery -t sendtargets -p <IP_ADDRESS>

Replace <IP_ADDRESS> with the IP address of the server

  1. Log in to the iSCSI target
    iscsiadm -m node --login