Difference between revisions of "ISCSI"

From wiki.IPBRICK.COM
Jump to: navigation, search
(Discover and Map)
 
(9 intermediate revisions by 2 users not shown)
Line 28: Line 28:
  
 
  #deb http://repository.ipbrick.com/wheezy wheezy main contrib non-free ipbrick60
 
  #deb http://repository.ipbrick.com/wheezy wheezy main contrib non-free ipbrick60
  deb http://ftp.pt.debian.org/debian stable main contrib non-free
+
  deb http://ftp.pt.debian.org/debian wheezy main contrib non-free
 
  deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
 
  deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
 
  deb http://security.debian.org/ wheezy/updates main contrib non-free
 
  deb http://security.debian.org/ wheezy/updates main contrib non-free
Line 39: Line 39:
  
 
  ipbrick:~# apt-get install open-iscsi
 
  ipbrick:~# apt-get install open-iscsi
 
 
  
 
== Configuration ==
 
== Configuration ==
Line 59: Line 57:
  
 
E.g:
 
E.g:
 +
cat /etc/iscsi/initiatorname.iscsi
  
  iqn.2012-08.com.domain.ipbrick:fileserver
+
  GenerateName=no
 +
InitiatorName=iqn.2015-12.com.domain.ipbrick:fileserver
  
  
Line 101: Line 101:
 
  /etc/init.d/open-iscsi stop
 
  /etc/init.d/open-iscsi stop
 
  /etc/init.d/open-iscsi start
 
  /etc/init.d/open-iscsi start
 +
 +
==Discover and Map==
  
 
Run iscsiadm to discover the iSCSI devices on the iSCSI Server with the IP 192.168.69.15
 
Run iscsiadm to discover the iSCSI devices on the iSCSI Server with the IP 192.168.69.15
Line 113: Line 115:
 
Map the Target
 
Map the Target
  
  ipbrick:~# iscsiadm  -m node -l -T "iqn.2004-04.com.qnap:ts-439u:
+
  ipbrick:~# iscsiadm  -m node -l -T "iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78"
iscsi.ipbrick.be0e78"
+
 
  Logging in to [iface: default, target:
 
  Logging in to [iface: default, target:
 
  iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78,  
 
  iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78,  
Line 148: Line 149:
 
  mkfs.ext4 /dev/sdb
 
  mkfs.ext4 /dev/sdb
  
fstab mapping is done by device and it can be captured via /dev/sdb
+
fstab mapping is done by device and it can be captured via /dev/sdb unique identifier:
 +
 
 +
To find the unique identifier (UUID) run:
 +
blkid
 +
...
 +
/dev/sdb: UUID="46c2c071-ffb3-400e-8239-5f53c81a0b72" TYPE="ext4"
  
 
It will be necessary to inscribe it at /etc/fstab
 
It will be necessary to inscribe it at /etc/fstab
Line 162: Line 168:
 
Inscribe the following:
 
Inscribe the following:
  
  /dev/sdb  home3 ext4
+
  UUID=46c2c071-ffb3-400e-8239-5f53c81a0b72 /home3 ext4  defaults,_netdev,usrquota,grpquota,user_xattr,acl   0
  noauto,defaults,usrquota,grpquota  0   2
+
 
 +
NOTE:
 +
* we have the **_netdev** option to state that this device is a network dependent device
 +
* the last column was removed, this entry has only 5 columns - the sixth column is removed so it will not try to run automatic fsck (filesystem check) on boot (this is done before network is available, so it would fail and stop the boot up sequence)
  
 
Now, you need to run this script so as home3 can be added to the IPBRICK web interface.
 
Now, you need to run this script so as home3 can be added to the IPBRICK web interface.
Line 173: Line 182:
 
  Work Area 3 was successfully inserted!
 
  Work Area 3 was successfully inserted!
 
  Don't forget to Apply Configurations to commit the changes.
 
  Don't forget to Apply Configurations to commit the changes.
 
  
 
== Firewall ==
 
== Firewall ==
Line 188: Line 196:
 
  Interface: ETHx (The NIC used in the iSCSI connection)
 
  Interface: ETHx (The NIC used in the iSCSI connection)
 
  Protocol ALL
 
  Protocol ALL
 +
Origin IP: [Storage IPs]
 
  Policy: ACCEPT
 
  Policy: ACCEPT
  
NOTE: When you explicit a firewall rule, you must include the storage IPs!
+
 
  
 
Click on the Insert button to create the rule
 
Click on the Insert button to create the rule

Latest revision as of 16:58, 26 January 2016

Introduction

iSCSI, is an abbreviation of Internet Small Computer System Interface, an Internet Protocol (IP)-based storage networking standard for linking data storage facilities.

iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances. iSCSI can be used to transmit data over local area networks (LANs), wide area networks (WANs), or the Internet and can enable location-independent data storage and retrieval. The protocol allows clients (called initiators) to send SCSI commands (CDBs) to SCSI storage devices (targets) on remote servers.

It is a popular Storage Area Network (SAN) protocol, allowing organizations to consolidate storage into data center storage arrays while providing hosts (such as database and web servers) with the illusion of locally-attached disks. Unlike traditional Fibre Channel, which requires special-purpose cabling, iSCSI can be run over long distances using existing network infrastructure.


Requirements

IPBrick v6.0

Connection to the Internet

Installation

The installation process is done via sources list update.

Access the console:

NOTE: This procedure is done directly at the server's console as a root user.

ipbrick:~# vi /etc/apt/sources.list
#deb http://repository.ipbrick.com/wheezy wheezy main contrib non-free ipbrick60
deb http://ftp.pt.debian.org/debian wheezy main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free

Still at the console, run these commands:


ipbrick:~# apt-get update
...
ipbrick:~# apt-get install open-iscsi

Configuration

In order to configure an iSCSI interface please follow these steps:

NOTE: The service configuration is done directly at the server's console as a root user.


The /etc/iscsi/initiatorname.iscsi file will identify ONLY the IPBRICK server.

Usually its name is composed by these elements:


iqn + . + year-month + . + server_name + : + custom_string


E.g:

cat /etc/iscsi/initiatorname.iscsi
GenerateName=no
InitiatorName=iqn.2015-12.com.domain.ipbrick:fileserver


The configuration file /etc/iscsi/iscsid.conf can be edited to set the service's autostart parameter:


...
node.startup = automatic
...

And also the authentication parameters:

- NO AUTHENTICATION: If access to the storage is to be done without authentication, no changes to the configuration file are necessary, the following lines should remain as comments:

...
#node.session.auth *
#discovery.sendtargets.auth *
...


- WITH AUTHENTICATION - CHAP:

...
node.session.auth.authmethod = CHAP
...
node.session.auth.username = username
node.session.auth.password = password
...
discovery.sendtargets.auth.authmethod = CHAP
...
discovery.sendtargets.auth.username = username
discovery.sendtargets.auth.password = password
...


NOTE: Please replace username and password by the username and password of your iSCSI Target.

Proceed by stopping and then restarting the iSCSI service - execute:

/etc/init.d/open-iscsi stop
/etc/init.d/open-iscsi start

Discover and Map

Run iscsiadm to discover the iSCSI devices on the iSCSI Server with the IP 192.168.69.15

Example:

ipbrick:~# iscsiadm  -m discovery -t st -p 192.168.69.15
192.168.69.15:3260,1 iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78
192.168.69.15:3260,1 iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick1.be0e78


Map the Target

ipbrick:~# iscsiadm  -m node -l -T "iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78"
Logging in to [iface: default, target:
iqn.2004-04.com.qnap:ts-439u:iscsi.ipbrick.be0e78, 
portal: 192.168.69.15,3260]
Login to [iface: default, target: iqn.2004-04.com.qnap:ts-439u:
iscsi.ipbrick.be0e78, portal: 192.168.69.15,3260]: successful


With a dmesg command it's now possible to see the new disc as a device sdb:


Loading iSCSI transport class v2.0-871.
iscsi: registered transport (tcp)
scsi1 : iSCSI Initiator over TCP/IP
scsi2 : iSCSI Initiator over TCP/IP
scsi3 : iSCSI Initiator over TCP/IP
scsi4 : iSCSI Initiator over TCP/IP
scsi5 : iSCSI Initiator over TCP/IP
scsi6 : iSCSI Initiator over TCP/IP
scsi 5:0:0:0: Direct-Access     QNAP     
iSCSI Storage    3.1  PQ: 0 ANSI: 5
sd 5:0:0:0: [sdb] 104857600 512-byte hardware sectors:
(53.6 GB/50.0 GiB)
sd 5:0:0:0: [sdb] Write Protect is off
sd 5:0:0:0: [sdb] Mode Sense: 2f 00 00 00
sd 5:0:0:0: [sdb] Write cache:
disabled, read cache: enabled, doesn't support DPO or FUA
sdb: sdb1
sd 5:0:0:0: [sdb] Attached SCSI disk

If necessary, format the disc and use this procedure as an example that creates a new partition /dev/sdb:

mkfs.ext4 /dev/sdb

fstab mapping is done by device and it can be captured via /dev/sdb unique identifier:

To find the unique identifier (UUID) run:

blkid
...
/dev/sdb: UUID="46c2c071-ffb3-400e-8239-5f53c81a0b72" TYPE="ext4"

It will be necessary to inscribe it at /etc/fstab

Assuming that this new volume will be used as home3, create its mount point:

mkdir /home3

Map /etc/fstab by executing the nano editor:

nano /etc/fstab

Inscribe the following:

UUID=46c2c071-ffb3-400e-8239-5f53c81a0b72 /home3  ext4  defaults,_netdev,usrquota,grpquota,user_xattr,acl   0

NOTE:

* we have the **_netdev** option to state that this device is a network dependent device
* the last column was removed, this entry has only 5 columns - the sixth column is removed so it will not try to run automatic fsck (filesystem check) on boot (this is done before network is available, so it would fail and stop the boot up sequence)

Now, you need to run this script so as home3 can be added to the IPBRICK web interface.

/opt/system/scripts/system_add_new_workareas.php 1

You will get the following notification:

Work Area 3 was successfully inserted!
Don't forget to Apply Configurations to commit the changes.

Firewall

Usually, the firewall service is disabled at an intranet server. However, by default, IPBRICK has it active. So, in order create a rule to allow the communication between the IPBRICK and the SAN, please access the following menu:

Advanced Configurations -> Network -> Firewall

Click on Insert and create a rule of this type:

Type of configuration to insert: General Settings
Rule: INPUT
Interface: ETHx (The NIC used in the iSCSI connection)
Protocol ALL
Origin IP: [Storage IPs]
Policy: ACCEPT


Click on the Insert button to create the rule


Manage iSCSI

Some useful commands to manage iSCSI on IPBrick:

Restart the openiscsi: /etc/init.d/open-iscsi restart
Check the session status: /etc/init.d/open-iscsi status
Use the dmesg command to find the disc's device;