diff options
Diffstat (limited to '_posts/2019-2-27-Fibrechannel-Linux.md')
-rw-r--r-- | _posts/2019-2-27-Fibrechannel-Linux.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/_posts/2019-2-27-Fibrechannel-Linux.md b/_posts/2019-2-27-Fibrechannel-Linux.md new file mode 100644 index 0000000..0caedeb --- /dev/null +++ b/_posts/2019-2-27-Fibrechannel-Linux.md @@ -0,0 +1,30 @@ +--- +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 behace like any other blockdevice. + +To permanently save your config go to `/` and type `saveconfig`. |