Proxmox - configure iscsi over zfs

This guide assumes a specific setup with Proxmox as the hypervisor and a Debian-based storage server using ZFS. Adjust the commands and configurations based on your environment and requirements.

Proxmox Server Configuration

Create a Directory for Private Key used for secure communication between Proxmox and the storage server:

mkdir /etc/pve/priv/zfs

Generate SSH Key:

ssh-keygen -f /etc/pve/priv/zfs/

Copy the generated SSH key to the root user on the storage node :

ssh-copy-id -i /etc/pve/priv/zfs/ root@

Test SSH Connection:

ssh -i /etc/pve/priv/zfs/ root@

Verify that the SSH connection works without errors.

Update the Proxmox storage configuration file to include the necessary settings for ZFS over iSCSI. nano /etc/pve/storage.cfg


zfs: zfs-pool-name
        blocksize 4k
        iscsiprovider LIO
        pool pool-name
        content images
        lio_tpg tpg1
        nowritecache 1
        sparse 0

Retrieve the initiator name, which will be used when creating an iSCSI target on the storage node:

cat /etc/iscsi/initiatorname.iscsi


Restart Proxmox Services:

systemctl restart pvedaemon && systemctl restart pveproxy && systemctl restart pvestatd

Debian Storage Server Configuration

Ensure the Debian server is up to date.

apt update && apt upgrade

Install the necessary ZFS-related packages:

sed -r -i'.BAK' 's/^deb(.*)$/deb\1 contrib/g' /etc/apt/sources.list
apt update
apt install linux-headers-amd64 zfsutils-linux zfs-dkms zfs-zed

Load the ZFS kernel module.

modprobe zfs

Create a ZFS pool on the specified disk:


zpool create -f -d -m none -o ashift=12 -O atime=off -o feature@lz4_compress=enabled storage /dev/sdX /dev/sdY

zpool create -o ashift=12 -O compression=lz4 -O atime=off -O xattr=sa -O acltype=posix storage SanDisk_XXX

Create dataset:

zfs create -o compression=off -o dedup=off -o volblocksize=32K -V 1000G storage/cloud

 ls -l /dev/zvol/storage/cloud
.. /dev/zvol/storage/cloud -> ../../zd0

#Configuring ISCSI target

Install targetcli

apt -y install targetcli-fb 

Creating a block storage object

cd backstores/block
/backstores/block> create md_block0 /dev/zvol/storage/cloud
cd /iscsi

/tpg1> set attribute authentication=0
cd luns
create /backstores/block/md_block0

cd ../portals
delete ip_port=3260
create 3260

cd ../acls
# cat /etc/iscsi/initiatorname.iscsi from proxmox node

after configutring the ISCSI target you should be able to deploy your vms