Configuring Linux iSCSI Storage with QNAP ES NAS
Linux and iSCSI Architecture
Use a QNAP NAS as external iSCSI-based storage will be safe, efficient, and you will be able to use all other features that help you utilize storage resources. For example, the online storage pool expansion and thin provisioning of the ES NAS allow you to extend datastores online without downtime. To use iSCSI storage area networks (SANs), you create a LUN on the iSCSI target (i.e. the ES NAS) and then mount it as a datastore on a host. The following diagram illustrates the utilization of iSCSI storage in a linux environment.

A gigabit Ethernet adapter that transmits 1000 megabits per second (Mbps) is recommended for the connection to an iSCSI target.
Preparation for Installation
We have learned that hosts are able to connect to the ES NAS via iSCSI. And you can set up datastores (repositories for virtual machines) on the ES NAS that the hosts discover in your linux environment. We will demonstrate this implementation.
In our demonstration, the following configuration is used:
- Storage device: QNAP ES NAS series with QES 1.1.4 (NAS operating system) or later.
- Linux hosts: CentOS 7 x86_64
- open-iscsiPackages : 6.2.0.873-32.el7
- device-mapper-multipath Packages : 0.4.9-85.el7_2.1
- IP addressing: Static IP addresses are recommended for both linux hosts and the ES NAS.
Server and Storage Network Settings
Server Network Settings | ||
---|---|---|
Role | IP | Description |
Data Network 1 | 10.10.10.21 | 10G Data port 1 in linux host |
Data Network 2 | 10.10.20.21 | 10G Data port 2 in linux host |
Storage Network Settings | ||
---|---|---|
Setting | Value | Description |
SCA Management IP | 192.168.1.10 | Management IP of controller A |
SCA Ethernet1 IP | 10.10.10.51 | Data port 1 IP of controller A |
SCA Ethernet2 IP | 10.10.20.51 | Data port 2 IP of controller A |
SCB Management IP | 192.168.1.11 | Management IP of controller B |
SCB Ethernet1 IP | 10.10.10.52 | Data port 1 IP of controller B |
SCB Ethernet2 IP | 10.10.20.52 | Data port 2 IP of controller B |
Confirmation Made before Configuration
- All data ports, from linux host and ES NAS, should be in the same subnet.
- Available pools must be built before configuring iSCSI LUN on ES NAS. See ”ES quick setup” to build pools.
Definition
In this document, linux host is defined to be iSCSI initiator, and QNAP ES NAS is iSCSI target.
Setup iSCSI with MPIO on Linux
Configure an open-iscsi initiator
Step 1: Discover the ES NAS iSCSI target
# iscsiadm -m discovery -t st -p 10.10.10.51
# iscsiadm -m discovery -t st -p 10.10.10.52
# iscsiadm -m discovery -t st -p 10.10.20.51
# iscsiadm -m discovery -t st -p 10.10.20.52
Step 2: Login iSCSI target
# iscsiadm -m node –l
Step 3: Display iSCSI sessions detail
# iscsiadm -m session
tcp: [23] 10.10.20.51:3260,1 iqn.2004-04.com.qnap:es1640dc:iscsi.linux.e57840.0 (non-flash)
tcp: [24] 10.10.10.51:3260,1 iqn.2004-04.com.qnap:es1640dc:iscsi.linux.e57840.0 (non-flash)
tcp: [31] 10.10.20.52:3260,1 iqn.2004-04.com.qnap:es1640dc:iscsi.linux.e57840.1 (non-flash)
tcp: [32] 10.10.10.52:3260,1 iqn.2004-04.com.qnap:es1640dc:iscsi.linux.e57840.1 (non-flash)
Configure multipath
Step 1: Create multipath configuration file
# mpathconf --enable --with_multipathd y
Step 2: Configure multipath settings
# vim /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
polling_interval 10
path_selector "round-robin 0"
path_grouping_policy multibus
uid_attribute ID_SERIAL
prio alua
path_checker readsector0
rr_min_io 100
max_fds 8192
rr_weight priorities
failback immediate
no_path_retry fail
}
Step 3: After editing, restart multipath service.
#systemctl restart multipathd
Step 4: Check multipath status
# multipath -ll
mpathn (36e843b66430373739633034323866663) dm-2 QNAP ,iSCSI Storage
size=100G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=30 status=active
|- 26:0:0:1 sdf 8:80 active ready running
|- 25:0:0:1 sdj 8:144 active ready running
|- 34:0:0:1 sdbe 67:128 active ready running
`- 33:0:0:1 sdx 65:112 active ready running
Use LUN
Step 1: Create a partition
# fdisk /dev/mapper/mpathn
Step 2: Format the partition
# mkfs.ext4 /dev/mapper/mpathn
Step 3: Mount the file system
# mount /dev/mapper/mpathn /mount_point/
Step 4: Mount file system at system boot
# vim /etc/fstab
Step 5: Add the line in the file
/dev/mapper/mpathn /mount_point/ ext4 defaults,_netdev 1 2
Conclusion
After configuring the multipath settings, the Linux iSCSI initiator will use all available interfaces to transfer data to achieve load balancing and high availability.