Difference between revisions of "FreeBSD fiber channel target"

From Aram's Wiki
Jump to: navigation, search
(Check the WWN address)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:FreeBSD]]
 +
 
== Introduction ==
 
== Introduction ==
  
Line 22: Line 24:
  
 
== Check the WWN address ==
 
== Check the WWN address ==
 
sudo ctladm port -o on isp0
 
  
 
You'll get output like:
 
You'll get output like:
Line 37: Line 37:
 
== Configure /etc/ctl.conf ==
 
== Configure /etc/ctl.conf ==
  
Use this comfig for /etc/ctl.conf
+
Use this config for /etc/ctl.conf:
  
  target naa.2100001b321cd5b6 {
+
lun fibre-channel {
 +
backend block
 +
device-id "5000c5001d5ba30b"
 +
serial "MGKSERIAL0001"
 +
option vendor "MGK"
 +
option product "FC Disk"
 +
option naa "600A0B80002682A8000067D95897A544"
 +
option removable "on"
 +
path /dev/zvol/tank1/export/fc
 +
}
 +
 +
  target naa.100000062b1b88c8 {
 
  auth-group no-authentication
 
  auth-group no-authentication
  port isp0
+
  port mpt0
  port isp1
+
  port mpt1
  lun 0 {
+
  lun 0 fibre-channel
backend block
 
path /dev/zvol/tank1/export/fc
 
}
 
 
  }
 
  }
  
Make sure the WWN matches. Next, start the ctld daemon.
+
Make sure the WWN matches. Next, start the ctld daemon. The device-id is from a real Seagate FC disk, and the naa is from a real array. I think both are required by macOS to make multipathing work.
  
 
  sudo service ctld start
 
  sudo service ctld start
Line 63: Line 71:
 
       ctld_name=naa.2100001b321cd5b6,lun,0
 
       ctld_name=naa.2100001b321cd5b6,lun,0
 
       scsiname=naa.2100001b321cd5b6,lun,0
 
       scsiname=naa.2100001b321cd5b6,lun,0
 +
 +
== Initiator side ==
 +
 +
If using macOS, the mac should just "see" the target, no configuration required.
  
 
== References ==
 
== References ==
Line 68: Line 80:
 
* [https://justinholcomb.me/blog/2016/03/19/migration-to-freebsd-part3.html Migrating to FreeBSD from Solaris 11: Part 3 - Importing ZVols for serving via Fiber Channel]
 
* [https://justinholcomb.me/blog/2016/03/19/migration-to-freebsd-part3.html Migrating to FreeBSD from Solaris 11: Part 3 - Importing ZVols for serving via Fiber Channel]
 
* [https://globalengineer.wordpress.com/2018/03/25/applied-freebsd-fibre-channel-target Applied FreeBSD: Fibre Channel Target]
 
* [https://globalengineer.wordpress.com/2018/03/25/applied-freebsd-fibre-channel-target Applied FreeBSD: Fibre Channel Target]
 +
* [https://discussions.apple.com/thread/1927941 SAN multipathing in OS X 10.5 Leopard]

Latest revision as of 10:25, 22 February 2019


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 config for /etc/ctl.conf:

lun fibre-channel {
	backend block
	device-id "5000c5001d5ba30b"
	serial "MGKSERIAL0001"
	option vendor "MGK"
	option product "FC Disk"
	option naa "600A0B80002682A8000067D95897A544"
	option removable "on"
	path /dev/zvol/tank1/export/fc
}

target naa.100000062b1b88c8 {
	auth-group no-authentication
	port mpt0
	port mpt1
	lun 0 fibre-channel
}

Make sure the WWN matches. Next, start the ctld daemon. The device-id is from a real Seagate FC disk, and the naa is from a real array. I think both are required by macOS to make multipathing work.

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

Initiator side

If using macOS, the mac should just "see" the target, no configuration required.

References