blob: ef764a6e9288b11e0342e821d3958e21e24670ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
---
layout: post
title: Fibrechannel SAN under Linux
---
## Requirements
* a qLogic qla2xxx fibrechannel HBA for the target (server)
* another FC-HBA (can be anything, i used emulex because cheaper) for the initiator (client)
* a LC-LC fibre cable
## Setup
Connect the two FC HBAs with the LC-LC cable.
Install the qlogic driver (qla2xxx) and targetcli (targetcli-fb in some cases) on the server. Then configure the qla driver by creating `/etc/modprobe.d/qla2xxx.conf` with the following content:
`options qla2xxx qlini_mode="disabled"`
This disables the HBAs initiator mode and allows us to create a target. A reboot is required for these changes to take effect.
Next we need to get our HBAs WWN (compareable to MAC-Addresses on ethernet interfaces) to be able to target our initiator(s). To get your WWN run `more /sys/class/fc_host/host?/port_name`. If you have multiple HBAs or multiple ports run `more /sys/class/fc_host/host?/port_state` to identify the active port.
As a last step, we need to configure the target. To enter the configuration utility, run `targetcli`. You can type `ls` to get an overview of all features, run `help` in any subdirectory to get specific info about which commands can be used here and how to use them.
First we need to set up a backstore by either choosing a block device or using an image file on disk as our storage. Run `cd backstores` and then change into the subdir you want (eg `cd fileio`). Then run `create <name> <path> [size]`. This creates our backstore wich we then need to target. Go to `/qla2xxx` and `create <WWN>`. Next we need to specify a lun (targetted backstore) by `cd <WWN>/luns` and then `create /backstores/<path to backstore>`. Finally we need to allow access by creating an access control entry by `cd /qla2xxx/<WWN>/acls` and then `create <initiator wwn> <lun>`.
After a reboot of the initiator machine, the device should show up as a blockdevice with `lsblk` and should behave like any other blockdevice.
To permanently save your config go to `/` and type `saveconfig`.
Your config could look something like this:
![Config]({{ site.baseurl }}/images/fcsan_config.png)
|