From d5b9665dac59335b118382c52709f5f8b03609ff Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Wed, 27 Feb 2019 18:53:38 +0100 Subject: post FC SAN linux --- _posts/2019-2-27-Fibrechannel-Linux.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 _posts/2019-2-27-Fibrechannel-Linux.md (limited to '_posts/2019-2-27-Fibrechannel-Linux.md') 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 [size]`. This creates our backstore wich we then need to target. Go to `/qla2xxx` and `create `. Next we need to specify a lun (targetted backstore) by `cd /luns` and then `create /backstores/`. Finally we need to allow access by creating an access control entry by `cd /qla2xxx//acls` and then `create `. + +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`. -- cgit v1.2.3