Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

FC target support in FreeNAS 9.1.0

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
J

jpaetzel

Guest
FreeNAS doesn't have FC target support by default, but you can make it work if you want to do some hacking and you don't care that you can't manage it from the GUI.

1. gunzip then copy the attached ko to your FreeNAS box. Put it in /boot/modules.
(The attached ko is 64 bit only)

2. Run kldxref /boot/kernel boot/modules

3. Add a tunable to the GUI for ctl_load YES

4. Switch your FC ports to target mode. by adding hint.isp.0.role="1" to /boot/device.hints

Wash rinse and repeat for each FC port.

5. truncate -s 100g /mnt/tank/somefile

6. ctladm port on

ctladm realsync off

ctladm create -b block -o file=/mnt/tank/somefile

You could use a post init script to run the ctladm commands at boot.
 

Attachments

J

jpaetzel

Guest
Almost there. The howto needs a different kernel. I'll attach it as soon as I get home, with updated instructions.
 

tranced1

Neophyte
Joined
Aug 21, 2013
Messages
5
Hi, I've followed your instructions and succesfully presented lun to ESXI, but when I started to create datastore my Freenas rig rebooted. Am I doing something wrong?
 

fox257

Newbie
Joined
Sep 3, 2013
Messages
1
I am having the same issue. I added your kernel , add the ko to the modules , created the hints. etc .. but when I format the volume in VMware it reboots the freenas server.

Any ideas ?

I am running FreeNas from a USB drive. I have a ISP2532-based 8Gb Fibre Channel Card. I will try to see if Windows or XenServer will crash it next week. I dont think it is a kernel panic it Just flashes alot of white text on the console then the system reboots. If you tell me what to get and I will get more info for you. d
 

roast

Neophyte
Joined
Sep 24, 2013
Messages
8
FreeNAS-9.1.1-RELEASE-x64 (a752d35)
kldload ctl.ko

My isp cards are in target mode. same problems as reported above.

I present a block storage target and the freenas box reboots.
If I present a ramdisk i just get errors and no reboot! =D


ctladm port -o on
ctladm realsync off
ctladm create -b ramdisk -s 5368709120
camcontrol devlist -v
scbus8 on ctl2cam0 bus 0:
<FREEBSD CTLDISK 0001> at scbus8 target 1 lun 0 (pass4)
<> at scbus8 target -1 lun -1 ()
 

roast

Neophyte
Joined
Sep 24, 2013
Messages
8
One more note to add:

http://freebsdfoundation.blogspot.co.uk/2012/01/cam-target-layer.html
For people who want to test it, you don't need a Fibre Channel card, you can actually create LUNs and use CTL without any new hardware. With the CTL CAM SIM, the LUNs are visible on the internal 'ctl2cam0' bus. Here's what the output of camcontrol devlist -v looks like:

scbus6 on ctl2cam0 bus 0:
at scbus6 target 1 lun 0 (pass56,da48)
at scbus6 target 1 lun 1 (pass57,da49)
at scbus6 target 1 lun 2 (pass58,da50)
<> at scbus6 target -1 lun -1 ()

The da(4) driver is attached to the CTL LUNs, and you can do normal I/O to them just as you would any other disk.
You'll notice that the da(4) driver is not attached to my lun (created in my above post).

Code:
camcontrol devlist -v
 
scbus8 on ctl2cam0 bus 0:
<FREEBSD CTLDISK 0001>            at scbus8 target 1 lun 0 (pass4)
<>                                at scbus8 target -1 lun -1 ()
 

Joshoa

Newbie
Joined
Oct 17, 2013
Messages
2
Fixed in FreeNAS 9.2.1 BETA.
Just tested it out - works flawlessly.
Thanx a lot, guys!

J
 

HoneyBadger

Mushroom! Mushroom!
Joined
Feb 6, 2014
Messages
2,767
All - does the method and attached kernel/module in the OP still apply to 9.2.1-release (and, I suppose, 9.2.1.1-release), or is it no longer needed?

Interested in seeing if I can make FreeNAS do the FC dance, as I've got a couple QLE2562s. I've set up FC target in the Solaris world before, so command-line doesn't bother me; just making sure I won't horribly break something or impact stability.
 

Joshoa

Newbie
Joined
Oct 17, 2013
Messages
2
Hi
The files attached are no longer needed, BUT as far as i remember i was in need of download and install [ispfw.ko] from [https://bugs.freenas.org/issues/3196]
To check if you really need to do any fixing just do [hint.isp.0.role=1] in [device.hints] reboot and do [ctladm port -l]
If all is OK you should see something like:
[root@freenas] ~# ctladm port -l

Port Online Type Name pp vp WWNN WWPN
0 NO IOCTL CTL ioctl 0 0 0 0
1 NO INTERNAL ctl2cam 0 0 0x5000000255a4eb00 0x5000000255a4eb02
2 NO INTERNAL CTL internal 0 0 0 0
3 NO ISCSI iscsi 0 0 0 0
4 NO FC isp0 0 0 0 0
5 NO FC isp1 1 0 0 0

J
 

HoneyBadger

Mushroom! Mushroom!
Joined
Feb 6, 2014
Messages
2,767
Installed the .ko from the bugfix as described

Code:
mount -u -w /
cd /tmp
fetch http://people.freebsd.org/~delphij/misc/ispfw.ko.xz
unxz ispfw.ko.xz
install -m 555 ispfw.ko /boot/kernel


Added ispfw_load = YES as a tunable and the two tunables for hint.isp.N.role=1 for both ports, and I now see the two lines for FC isp0/isp1.

Time to start playing!

Edit: I'm seeing a lot of invalid SCSI commands show up in console (mounting in ESXi 5.1 U1) so perhaps I need to make sure it's not trying to use VAAI. Could also be that I'm stuck using an evil RAID card in my testbed that's refusing to pass certain things.

Other than that performance seems quite solid. Going to have to drop some SSD in there to check out sync write speed, but standard (read: async) is blisteringly fast as expected, and once ARC warms up it's hilarious to watch a Server 2K8 VM boot in five seconds.

Anyone been running this for long enough to comment on general stability?
 

Gerasim

Neophyte
Joined
Aug 22, 2014
Messages
10
Good day !
i was intersting with make freenas as fc enclosure. reading most of forums about and point this team.. then i am install a freenas on server who have connect to two hp msa50, configure raid on both 20 disk. activate ispfw.ko in boot... what next? connect fc card on server with optical mm patchcord to switch and zoning wwn on it.. then esxi as above must see fc target presented freenas? i'am right?
of couse iam see
[root@freenas] ~# ctladm port -l
Port Online Type Name pp vp WWNN WWPN
0 NO IOCTL CTL ioctl 0 0 0 0
1 NO INTERNAL ctl2cam 0 0 0x5000000994d7ff00 0x5000000994d7ff02
2 NO INTERNAL CTL internal 0 0 0 0
3 NO ISCSI iscsi 0 0 0 0
4 NO FC isp0 0 0 0 0
5 NO FC isp1 1 0 0 0
 

aran kaspar

Member
Joined
Mar 24, 2014
Messages
68
Hello everyone,

Thank you in advance for reading and any help you can provide to me and everyone else.
I've been trying to get this working for quite some time and have followed a few guides but seem to be doing something wrong.

FreeNAS 9.2 x64 - PMS, OwnCloud, Trans
Intel Q6700 X4 - 4GB 800MHz - RaidZ2 4x1TB

Haven't had success adding your hints @jpaetzel to device.hints list using nano in SSH because it opens in read-only mode.

I have success in that the firmware is loading for my Qlogic 2462 (ISP 2432) and I have a solid link indicator (Amber 4Gbps LED) on each HBA card.
It's connected to an identical card in my ESXi box and both cards have been "configured" in their BIOS for Point-to-Point @ 4Gbps. It was recommended by Qlogic info to set these manually for better results.

ctladm port -l gives me the same as the guy above @Gerasim (I see the two FC ports)
not sure if these ports are supposed to be, but they are "OFF" and they do turn on only IF I enter the command manually

I've tried adding these TUNABLES through the GUI...

Variable: hint.isp.0.role
Value : 2

Variable: hint.isp.1.role
Value : 2

Variable: ispfw_load
Value : YES

Variable: ctl_load
Value : YES

another guide I'm following that led me astray
https://bugs.freenas.org/issues/3196


some people are saying the hints should be in /boot/device.hints
some people are saying the hints should be tunables added through the GUI

another variable seems to be the mode... "1", "2", or "target"

Any laymens terms guide or help would be very very much appreciated.
My knowledge of fiber is non-existent, I have just started playing with it.

If I need to do some association between ports, WWNs and hard drives or maybe create LUNs or something... just let me know and I'll google that.
I am very familiar with iSCSI in FreeNAS (which is already setup) but not sure if it works over FC. I'm LOST.

Again, both adapters are visible from their respective computer and they have a solid link light for both ports of each card.
I'm basically unable to see any storage from the ESXi side and I imagine there's more config/association to do on the freenas side.

Very much appreciated again!

Please let me know if you need any info and I'll get right back with it.
Thanks again!
 
Last edited:

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
The .ko file included in this thread is for 9.1.0 (and possible 9.1.1). 9.2 (and other versions) have a different kernel and the .ko is probably not compatible.
 

aran kaspar

Member
Joined
Mar 24, 2014
Messages
68
Thanks so much for the post. Is there any way to get FC storage working with my point to point setup? Can it be done with FreeNAS 9.3? I just need some closure at this point.
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,092
FC target should be possible with 9.3. All required pieces are in place. You should do:
- load ispfw and ctl modules as told above;
- set hint.isp.X.role tunables to 0 (ZERO) to disable FC ports until system is ready;
- enable iSCSI and configure some LUNs for it via WebUI;
- when ready -- execute `ctladm port -o on -t fc` to enable target mode on FC ports;
- celebrate all configured iSCSI LUNs visible via FC.
 
Top