Hi.
This question has been asked many times and the answers have been good but fragmented, and rarly covers the FreeNAS setup part. I will not go in on how to install FreeNAS or howto setup ZFS pools but i will cover whats required to make this actually works.
So lets begin.
First we need to install some patches on the proxmox nodes since FreeNAS dosn't use istgt provider anymore.
The patches creates a new iSCSI provider called FreeNAS-API in the webgui.
Thanks to GrandWazoo who made these patches.
First of all we need to setup SSH keys to the freenas box, the SSH connection needs to be on the same subnet as the iSCSI Portal, so if you are like me and have a separate VLAN and subnet for iSCSI the SSH connection needs to be established to the iSCSI Portal IP and not to the LAN/Management IP on the FreeNAS box.
The SSH connection is only used to list the ZFS pools
1. Lets create the SSH keys on the proxmox boxes. (The IP must match your iSCSI Portal IP)
You only need to create the keys on one node if they are clustered as the keys will replicate to the other nodes.
mkdir /etc/pve/priv/zfs
ssh-keygen -f /etc/pve/priv/zfs/192.168.1.1_id_rsa
ssh-copy-id -i /etc/pve/priv/zfs/192.168.1.1_id_rsa.pub root@192.168.1.1
1. Enable "Log in as root with password" under Services -> SSH on the FreeNAS box.
2. Make an SSH connection from every node to the iSCSI Portal IP
ssh -i /etc/pve/priv/zfs/192.168.1.1_id_rsa root@192.168.1.1
3. Install the REST client on every node
apt-get install librest-client-perl git
4. Download the patches on every proxmox node
git clone "link to the patches"
Note: as a new forum user im not allowed to paste links, take a look at GrandWazoo page on github
for the full path to the patches.
5. Install the patches on every proxmox node
cd freenas-proxmox
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < pve-manager/js/pvemanagerlib.js.patch
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < perl5/PVE/Storage/ZFSPlugin.pm.patch
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < pve-docs/api-viewer/apidoc.js.patch
cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm
6. Restart the PVE services.
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd
Logout from PVE webgui and clean the browser cache, and login again.
Now FreeNAS-API should we available as a iSCSI provider
7. Create a iSCSI target on the FreeNAS box.
You dont need to create any extents as the FreeNAS-API plugin will do this automatically when the drive is created on the VM.
8. Setup ZFS Over iSCSI i Proxmox GUI. choose FreeNAS-API as provider.
ID: Whatever you want
Portal: iSCSI portal IP on the freenas box
Pool: Your ZFS pool name on the freenas box (this needs to be the root pool and not an extent as the VM disks will be created as own zvols directly on the pool)
ZFS Block Size: 4k
Target: IQN on the FreeNAS box and target ID
ex "qn.2005-10.org.freenas.ctlroxmox"
API use SSL: Unchecked
API Username: root
API IPv4 Host: iSCSI portal IP on the freenas box
API Password: root password on freenas box
Thin provision and Write cache is optional
Note: A pve-manager upgrade will replace the patched files so i suggest you create a bash script
and run it on every node after an upgrade.
I have a script in /root/freenas-proxmox folder that looks like this
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < pve-manager/js/pvemanagerlib.js.patch
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < perl5/PVE/Storage/ZFSPlugin.pm.patch
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < pve-docs/api-viewer/apidoc.js.patch
cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd
Hope this sums it up
This question has been asked many times and the answers have been good but fragmented, and rarly covers the FreeNAS setup part. I will not go in on how to install FreeNAS or howto setup ZFS pools but i will cover whats required to make this actually works.
So lets begin.
First we need to install some patches on the proxmox nodes since FreeNAS dosn't use istgt provider anymore.
The patches creates a new iSCSI provider called FreeNAS-API in the webgui.
Thanks to GrandWazoo who made these patches.
First of all we need to setup SSH keys to the freenas box, the SSH connection needs to be on the same subnet as the iSCSI Portal, so if you are like me and have a separate VLAN and subnet for iSCSI the SSH connection needs to be established to the iSCSI Portal IP and not to the LAN/Management IP on the FreeNAS box.
The SSH connection is only used to list the ZFS pools
1. Lets create the SSH keys on the proxmox boxes. (The IP must match your iSCSI Portal IP)
You only need to create the keys on one node if they are clustered as the keys will replicate to the other nodes.
mkdir /etc/pve/priv/zfs
ssh-keygen -f /etc/pve/priv/zfs/192.168.1.1_id_rsa
ssh-copy-id -i /etc/pve/priv/zfs/192.168.1.1_id_rsa.pub root@192.168.1.1
1. Enable "Log in as root with password" under Services -> SSH on the FreeNAS box.
2. Make an SSH connection from every node to the iSCSI Portal IP
ssh -i /etc/pve/priv/zfs/192.168.1.1_id_rsa root@192.168.1.1
3. Install the REST client on every node
apt-get install librest-client-perl git
4. Download the patches on every proxmox node
git clone "link to the patches"
Note: as a new forum user im not allowed to paste links, take a look at GrandWazoo page on github
for the full path to the patches.
5. Install the patches on every proxmox node
cd freenas-proxmox
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < pve-manager/js/pvemanagerlib.js.patch
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < perl5/PVE/Storage/ZFSPlugin.pm.patch
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < pve-docs/api-viewer/apidoc.js.patch
cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm
6. Restart the PVE services.
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd
Logout from PVE webgui and clean the browser cache, and login again.
Now FreeNAS-API should we available as a iSCSI provider
7. Create a iSCSI target on the FreeNAS box.
You dont need to create any extents as the FreeNAS-API plugin will do this automatically when the drive is created on the VM.
8. Setup ZFS Over iSCSI i Proxmox GUI. choose FreeNAS-API as provider.
ID: Whatever you want
Portal: iSCSI portal IP on the freenas box
Pool: Your ZFS pool name on the freenas box (this needs to be the root pool and not an extent as the VM disks will be created as own zvols directly on the pool)
ZFS Block Size: 4k
Target: IQN on the FreeNAS box and target ID
ex "qn.2005-10.org.freenas.ctlroxmox"
API use SSL: Unchecked
API Username: root
API IPv4 Host: iSCSI portal IP on the freenas box
API Password: root password on freenas box
Thin provision and Write cache is optional
Note: A pve-manager upgrade will replace the patched files so i suggest you create a bash script
and run it on every node after an upgrade.
I have a script in /root/freenas-proxmox folder that looks like this
patch -b /usr/share/pve-manager/js/pvemanagerlib.js < pve-manager/js/pvemanagerlib.js.patch
patch -b /usr/share/perl5/PVE/Storage/ZFSPlugin.pm < perl5/PVE/Storage/ZFSPlugin.pm.patch
patch -b /usr/share/pve-docs/api-viewer/apidoc.js < pve-docs/api-viewer/apidoc.js.patch
cp perl5/PVE/Storage/LunCmd/FreeNAS.pm /usr/share/perl5/PVE/Storage/LunCmd/FreeNAS.pm
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd
Hope this sums it up
Last edited: