Difference between revisions of "FreeBSD fiber channel target"

From Aram's Wiki
Jump to: navigation, search
(References)
(Check the WWN address)
Line 22: Line 22:
  
 
== Check the WWN address ==
 
== Check the WWN address ==
 
sudo ctladm port -o on isp0
 
  
 
You'll get output like:
 
You'll get output like:

Revision as of 16:16, 7 November 2018

Introduction

You need:

  • FreeBSD with a kernel that supports your card, e.g. for QLogic QLE2462
  • a fiber channel card that supports target mode
  • a ZFS zvol

Create a ZFS zvol

This will create a sparse 850GB ZFS zvol.

sudo zfs create -p -s -V 850g tank1/export/fc

Enable ctld

sudo sysrc ctld_enable=YES

Bring the device online

sudo ctladm port -o on isp0
sudo ctladm port -o on isp1

Check the WWN address

You'll get output like:

z800:aram$ sudo ctladm port -l
Port Online Frontend Name     pp vp
0    YES    camsim   camsim   0  0  naa.50000009e370df01
1    YES    ioctl    ioctl    0  0  
2    YES    tpc      tpc      0  0  
3    YES    camtgt   isp0     0  0  naa.2100001b321cd5b6
4    YES    camtgt   isp1     0  0  naa.2101001b323cd5b6

Configure /etc/ctl.conf

Use this comfig for /etc/ctl.conf

target naa.2100001b321cd5b6 {
	auth-group no-authentication
	port isp0
	port isp1
	lun 0 {
	backend block
		path /dev/zvol/tank1/export/fc
	}
}

Make sure the WWN matches. Next, start the ctld daemon.

sudo service ctld start

Query the status, to see if everything is working correctly:

z800:aram$ sudo ctladm devlist -v                                                                                                                                          
LUN Backend       Size (Blocks)   BS Serial Number    Device ID       
  0 block            1782579200  512 MYSERIAL   0     MYDEVID   0     
      lun_type=0
      num_threads=14
      file=/dev/zvol/tank1/export/fc
      ctld_name=naa.2100001b321cd5b6,lun,0
      scsiname=naa.2100001b321cd5b6,lun,0

References