Setting Up iSCSI Multipathing Manually on Linux
Multipathing (MPIO - Multipath I/O) is crucial for high availability and performance in iSCSI storage environments. It allows multiple network paths between a server (initiator) and a storage target, ensuring failover and load balancing. In this guide, we will configure iSCSI multipathing manually on Linux without Ansible.
1. Why Use Multipathing?
Multipathing is used in enterprise storage environments to achieve:
- Redundancy - If one network path fails, another takes over
- Load Balancing - Spreads I/O operations across multiple paths
- Higher Bandwidth - Uses multiple network interfaces for increased throughput
- Failover Support - Ensures continuous access to storage if a path fails
2. Requirements
2.1. Server-Side (iSCSI Target Requirements)
- The iSCSI target must support multiple network paths.
- Each LUN must be accessible via at least two separate IP addresses.
- Example target setup:
iSCSI Target:
IP1: 192.168.2.253 (eth1)
IP2: 192.168.3.253 (eth2)
2.2. Client-Side (iSCSI Initiator Requirements)
- Multiple network interfaces.
- The
open-iscsiandmultipath-toolspackages installed. - Two or more iSCSI sessions to the same LUN using different IPs.
3. Install Required Packages
On the iSCSI initiator (client):
sudo apt update
sudo apt install -y open-iscsi multipath-tools
Enable the services to start on boot:
sudo systemctl enable --now iscsid multipathd
4. Discover and Log In to iSCSI Targets
4.1. Discover Available Targets
Run the discovery command for each target IP:
sudo iscsiadm -m discovery -t st -p 192.168.2.253
sudo iscsiadm -m discovery -t st -p 192.168.3.253
Expected output:
192.168.2.253:3260,1 iqn.2025-03.com.example:storage
192.168.3.253:3260,1 iqn.2025-03.com.example:storage
4.2. Log In to Both Paths
sudo iscsiadm -m node -T iqn.2025-03.com.example:storage -p 192.168.2.253 --login
sudo iscsiadm -m node -T iqn.2025-03.com.example:storage -p 192.168.3.253 --login
Verify active iSCSI sessions:
sudo iscsiadm -m session
Expected output:
tcp: [1] 192.168.2.253:3260,1 iqn.2025-03.com.example:storage
tcp: [2] 192.168.3.253:3260,1 iqn.2025-03.com.example:storage
Set the login to persist across reboots:
sudo iscsiadm -m node -T iqn.2025-03.com.example:storage -p 192.168.2.253 --op=update --name=node.startup --value=automatic
sudo iscsiadm -m node -T iqn.2025-03.com.example:storage -p 192.168.3.253 --op=update --name=node.startup --value=automatic
5. Configure Multipathing
5.1. Enable Multipath
Edit /etc/multipath.conf:
sudo nano /etc/multipath.conf
Add the following configuration:
defaults {
user_friendly_names yes
}
blacklist {
devnode "^sd[a-z]"
}
multipaths {
multipath {
wwid "3600140547f55689de4b49c098d9b1a3c"
alias mpatha
path_grouping_policy "multibus"
path_selector "round-robin 0"
failback immediate
rr_weight priorities
no_path_retry 5
}
}
To find the WWID for your LUNs, run:
sudo multipath -ll
5.2. Restart Multipath Service
sudo systemctl restart multipathd
Enable it at boot:
sudo systemctl enable multipathd
6. Verifying Multipathing Setup
6.1. Check Multipath Devices
sudo multipath -ll
Expected output:
mpatha (3600140547f55689de4b49c098d9b1a3c) dm-0 LIO-ORG ,iscsi_target
size=20G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| - 2:0:0:0 sdb 8:16 active ready running
|-+- policy='round-robin 0' prio=50 status=enabled
| - 2:0:1:0 sdc 8:32 active ready running
6.2. Monitor Multipathing
sudo systemctl status multipathd
sudo journalctl -u multipathd --no-pager --lines=50
7. Simulating a Path Failure
To test failover, manually disable one of the network interfaces:
sudo ip link set eth1 down
Check multipath status:
sudo multipath -ll
The failed path should be marked failed, but the system should remain operational using the second path.
Restore the path:
sudo ip link set eth1 up
8. Summary
In this guide we:
- Configured iSCSI multipathing manually
- Enabled automatic iSCSI login
- Set up multipath failover and load balancing
- Verified redundancy by simulating a path failure
This setup ensures high availability and performance in your iSCSI storage environment.