Share ZVOL via ISCSI from different installation?

AveryFreeman

Renowned Member
Feb 22, 2017
17
4
68
44
Seattle
unixgreybeard.org
Hi, I am trying to migrate to Proxmox VE 8.3 from Truenas Scale, and I have a ZVOL I need to share with a device

Couple places where I'm confused:

Is there the a commonly-accepted way to create a target for a ZVOL? Should I just be following Debian instructions? I don't see it in the Proxmox docs.

I was used to targetcli from using RHEL-alikes, so I installed targetcli-fb, but I noticed it made a different iqn than what was in /etc/iscsi/iscsid.conf

And is there a way I can make the iqn like really, really simple? I have to enter it on a device without a keyboard - only a mouse and on-screen keyboard, the long, convoluted iqn:sn.target-uuid strings are a nightmare

Thanks
 
I think I mostly have it figured out, I opted for tgt package this time, instead of targetcli-fb. Seemed more straightforward, and I had to manually name the iqn (thank god)

Code:
# create target, idnum, iqn: iqn.year-mo.hostname:targetname
tgtadm --lld iscsi --op new --mode target --tid 1 --targetname iqn.2024-11.pve-iscsi:hikdvrvol0

# direct target to a backing store
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --backing-store /dev/zvol/netdisk/hikdvrvol0

# bind the target to 0.0.0.0:3260
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
# Could be more specific: tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.168.1.250:3260

# confirm current config in memory
tgt-admin --dump

# save to conf.d - I grepped to zvol name to avoid default-driver
tgt-admin --dump | grep -A 1 hikdvrvol0 > /etc/tgt/conf.d/hikdvrvol0.conf

# confirm creation
cat /etc/tgt/conf.d/hikdvrvol0.conf

# produced:
<target iqn.2024-11.pve-iscsi:hikdvrvol0>
  backing-store /dev/zvol/netdisk/hikdvrvol0
</target>

Seems like the Alpine Wiki is a good reference for more advanced use: https://wiki.alpinelinux.org/wiki/Linux_iSCSI_Target_(tgt)