Native iSCSI target FreeBSD 10/11

Admiral

Member
Feb 23, 2015
28
0
21
Any news yet on the ZFS plugin that wil work with the native iSCSI in FreeBSD 10+?
I really would like to see this since this iSCSI solution gives so much better performance.
 
How good is the iscsi target on FreeBSD 10 ?
I read from the Promox wiki the following:

I will not recommend BSD based platforms for enterprise and/or HA setups due to limitations in the current iSCSI target implementation. Istgt will require a restart of the daemon every time a LUN is to be deleted or updated which means dropping all current connections. Work has begun to provide a native iSCSI target for FreeBSD 10 which hopefully will solve this inconvenience.

Can you confirm that the native iscsi on FreeBSD 10 + does not exhibit this behaviour ?
 
Last edited:
The new iscsi implementation in FreeBSD does overcome the problems in Istgt but introduces a new shortcoming which make it unsuitable for use in Proxmox. The problem is that it has a hardcoded max number for targets and luns which limits it to support a max of 256 luns (256 disks). See https://forums.freebsd.org/threads/maximum-number-of-iscsi-targets-in-freebsd10.45857/
Work should be started though , since the new implementation gives less load and more performance..
 
The developer of ctl will not make the necessary changes so implementing support for ctl is currently pointless.
I disagree, istgt needs a reload of all targets after a change and it performs bad..
 
Looks interesting. I will have to try it out sometime but at the moment I am quite busy so it will not be in the near future.
 
Hi
I tested in my lab the native iscsi FreeBSD ctl daemon, and I found it does not work reliably with zvols.

Every second time the ctl daemon was aborting being unable to find the zvol. With file based LUNs it worked.
 
The iSCSI implementation is the crucial part and at the moment the only implementation which is production ready for enterprise usage is comstar so any Solaris derivative and Solaris is recommended.
 
I've been using FreeBSD ctl and Porxmox (3.4, 4.4) for more than two years and I have no problems. Very fast, very reliably. I use workaround for the simulation of comstar commands (simple perl script).
 
I'm not a programmer, it's a bad code. There is no guarantee. The target in the script must match the target in ctl.conf.

comstarproxmox.pl:
Code:
#!/usr/local/bin/perl
use strict;
use XML::Simple;
use Getopt::Long;
use Text::ParseWords;

#use Log::Any '$log';
#use Log::Any::Adapter ('File', '/var/log/comstar.log');

my $config = "/etc/ctl.conf";
my $target="iqn.2014-06.org.freebsd:target0";

#$log->info("Start with arguments: @ARGV");

open (P,"/usr/sbin/ctladm devlist -x |")||die "Cannot execute: $!";
my $output = join "", <P>;
close(P);
my $luns = XMLin($output, ForceArray => 1, KeyAttr => { lun=>'id'} );

my $command  = shift @ARGV;

if ( $command eq "list-lu" ){
  my $key;

  print "              GUID                    DATA SIZE           SOURCE\n";
  print "--------------------------------  -------------------  ----------------\n";
  foreach $key(keys %{$luns->{lun}})
  {
    my @lun = quotewords(",", 0, $luns->{lun}->{$key}->{ctld_name}[0]);
    if ($lun[0] eq $target)
    {
      $luns->{lun}->{$key}->{file}[0] =~ s/dev\/zvol/dev\/zvol\/rdsk/;
      print sprintf "%32u %20u  %s\n", $key, $luns->{lun}->{$key}->{blocksize}[0]*$luns->{lun}->{$key}->{size}[0], $luns->{lun}->{$key}->{file}[0];
    }
  }
}
elsif ( $command eq "list-view" )
{
  my $id = shift @ARGV;
  $id = shift @ARGV;
  my @lun = quotewords(",", 0, $luns->{lun}->{$id}->{ctld_name}[0]);
  print "View Entry: 0\n   Host group   : All\n   Target group : All\n";
  print "   LUN          : " . $lun[2] . "\n";
}
elsif ( $command eq "delete-lu" )
{
  my $id = shift @ARGV;
  my $find=0;
  open(IN_CONF,$config);
  my @file_content = <IN_CONF>;
  close(IN_CONF);
  my @lun = quotewords(",", 0, $luns->{lun}->{$id}->{ctld_name}[0]);
  open(OUT_CONF,">$config");
  foreach (@file_content)
  {
    if ($_ eq "#PROXMOX\n")
    {
      $find = 1;
    }
    if ($_ ne "lun " . $lun[2] . " {path " . "$luns->{lun}->{$id}->{file}[0]" . "}\n" )#|| !$find )
    {
    print OUT_CONF;
    }
  }
  close(OUT_CONF);
  my $command = "/usr/sbin/ctladm remove -b block -l " . $id;
  system('service ctld forcereload');
}
elsif ( $command eq "create-lu" || $command eq "import-lu" )
{
  my $filepath = shift @ARGV;
  if ( $command eq "create-lu" )
  {
      $filepath = shift @ARGV;
      $filepath = shift @ARGV;
      $filepath = shift @ARGV;
      $filepath = shift @ARGV;
  }
  $filepath =~ s/dev\/zvol\/rdsk/dev\/zvol/;
  my $key;
  my $lun_id=0;
  my $find;
  my @lun;
  while(1)
  {
    $lun_id = $lun_id + 1;
    $find=0;
    foreach $key(keys %{$luns->{lun}})
    {
      @lun = quotewords(",", 0, $luns->{lun}->{$key}->{ctld_name}[0]);
      if ( $lun_id == $lun[2] && $lun[0] eq $target )
      {
         $find=1;
         last;
      }
    }
    if ( !$find ) {last;}
  };
  open(IN_CONF,$config);
  my @file_content = <IN_CONF>;
  close(IN_CONF);
 
  open(OUT_CONF,">$config");
  foreach (@file_content)
  {
    if ($_ eq "#PROXMOX\n")
    {
    
      print OUT_CONF;
      print OUT_CONF "lun " . $lun_id . " {path "  . $filepath . "}\n";
    } else
    {
      print OUT_CONF;
    }
  }
  close(OUT_CONF);
  my $command = "/usr/sbin/ctladm create -b block -o file=" . $filepath . " -o cfiscsi_lun=". $lun_id . " -o cfiscsi_target=". $target;
#  system($command);
  system('service ctld forcereload');
}
elsif ( $command eq "modify-lu" )
{
  my $size = shift @ARGV;
  $size = shift @ARGV;
  my $id = shift @ARGV;
  my $command = "/usr/sbin/ctladm modify -b block -l " . $id . " -s ". $size;
  system($command);
}

Use symlinks:
/usr/sbin/sbdadm -> comstarproxmox.pl
/usr/sbin/stmfadm -> comstarproxmox.pl

Code:
target iqn.2014-06.org.freebsd:target0 {
auth-group no-authentication
portal-group pg0
lun 0 {path ....}
#PROXMOX
lun 1 {path /dev/zvol/tunk/vmvols/vm-110-disk-1}
}
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!