Linux VPS

iSCSI storage on Linux: set up a target and initiator

Share block storage over the network with iSCSI: create a target with targetcli, connect an initiator with iscsiadm, secure it with CHAP, and use it for KVM VM storage.

AdvancedLinux servers2 min read

iSCSI carries SCSI disk commands over TCP/IP, so a server can use a disk on another machine as if it were local. It is the classic way to build a simple SAN for virtualization. This guide shows how to set up iSCSI on Linux with a target (storage server) and an initiator (client).

Before you start

  • Two Linux servers on a private, fast network; a dedicated storage VLAN is recommended.
  • A spare disk, partition or LVM volume on the target server to share.
  • An iSCSI LUN should be used by one host at a time unless you use a cluster-aware filesystem or LVM setup.

Create the target with targetcli

sudo apt install -y targetcli-fb

RHEL family: sudo dnf install -y targetcli. Then run sudo targetcli and enter:

/backstores/block create name=vmdisk1 dev=/dev/vg_storage/vmdisk1
/iscsi create iqn.2025-12.com.example:storage1
/iscsi/iqn.2025-12.com.example:storage1/tpg1/luns create /backstores/block/vmdisk1
/iscsi/iqn.2025-12.com.example:storage1/tpg1/acls create iqn.2025-12.com.example:kvm1
saveconfig
exit

Enable the service so the config loads at boot (rtslib-fb-targetctl on Debian/Ubuntu, target on RHEL), and allow TCP port 3260 only from initiators.

Configure the initiator

sudo apt install -y open-iscsi

Set the initiator name to match the ACL in /etc/iscsi/initiatorname.iscsi:

InitiatorName=iqn.2025-12.com.example:kvm1
sudo systemctl restart iscsid

Discover and log in:

sudo iscsiadm -m discovery -t sendtargets -p 10.10.0.5
sudo iscsiadm -m node -T iqn.2025-12.com.example:storage1 -p 10.10.0.5 --login

A new disk appears in lsblk. Make login automatic: sudo iscsiadm -m node -T iqn.2025-12.com.example:storage1 --op update -n node.startup -v automatic.

Add CHAP authentication

In targetcli under the ACL, set set auth userid=kvm1 password=LongSecret. On the initiator, set node.session.auth.authmethod = CHAP and the same username and password in /etc/iscsi/iscsid.conf or per node with iscsiadm --op update.

Use it for VMs

  • Use the LUN directly as a raw VM disk (/dev/disk/by-path/...) for best stability of device names.
  • Or create an LVM volume group on it and use a libvirt logical pool; see LVM storage pool for KVM.
  • For sharing across hosts with live migration, use shared LVM with locking, or prefer NFS/Ceph; see NFS shared storage.

Troubleshooting

  • Login failed: authorization failure: initiator IQN does not match the ACL, or CHAP is wrong.
  • No targets found: firewall blocks port 3260, or the target listens on another IP.
  • Disk name changes after reboot: use /dev/disk/by-path or by-id in configs and fstab with _netdev.

Frequently asked questions

iSCSI or NFS for VMs?

iSCSI gives block devices with low overhead; NFS is simpler to share between hosts.

Do I need multipath?

For redundancy with two network paths, yes, using multipathd.

Can Windows connect to a Linux iSCSI target?

Yes, with the built-in iSCSI Initiator.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.