Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Centralized Secure Storage (iSCSI) - \"Initiator Client\" Setup on CentOS
Centralized secure storage is an essential component of many modern IT infrastructures. It allows multiple servers to access a shared storage pool, enabling higher flexibility, scalability, and availability. One popular method is iSCSI (Internet Small Computer System Interface), which enables servers to access remote storage over IP networks as if it were locally attached.
What is iSCSI?
iSCSI is a protocol that encapsulates SCSI commands and data into IP packets, allowing servers to communicate with remote storage devices over standard Ethernet networks. This creates a Storage Area Network (SAN) using existing network infrastructure, making it cost-effective compared to dedicated Fibre Channel solutions.
iSCSI Components
| Component | Description | Role |
|---|---|---|
| Initiator | Client that initiates iSCSI connections | Sends SCSI commands, receives responses |
| Target | Storage device providing storage resources | Processes SCSI commands, manages storage |
| IQN | iSCSI Qualified Name (unique identifier) | Identifies initiators and targets globally |
Setting up iSCSI Initiator on CentOS
Step 1: Install Required Packages
Install the iSCSI initiator utilities using the package manager ?
sudo yum install iscsi-initiator-utils
For CentOS 8+ systems using dnf ?
sudo dnf install iscsi-initiator-utils
Step 2: Configure Initiator Name
Edit the initiator configuration to set a unique IQN ?
sudo vi /etc/iscsi/initiatorname.iscsi
Set the initiator name (example) ?
InitiatorName=iqn.2023-01.com.example:client01
Step 3: Start iSCSI Service
Enable and start the iSCSI services ?
sudo systemctl enable iscsid sudo systemctl start iscsid sudo systemctl enable iscsi sudo systemctl start iscsi
Step 4: Discover iSCSI Targets
Scan the network for available iSCSI targets ?
sudo iscsiadm -m discovery -t st -p 192.168.1.100:3260
Replace 192.168.1.100 with your target's IP address. This returns discovered targets ?
192.168.1.100:3260,1 iqn.2023-01.com.example:storage.target01
Step 5: Login to iSCSI Target
Establish connection to the discovered target ?
sudo iscsiadm -m node -T iqn.2023-01.com.example:storage.target01 -p 192.168.1.100:3260 -l
Successful login creates a block device (e.g., /dev/sdb).
Step 6: Verify iSCSI Session
Check active iSCSI sessions ?
sudo iscsiadm -m session -P3
List available block devices ?
lsblk
Step 7: Format and Mount Storage
Create a filesystem on the new device ?
sudo mkfs.ext4 /dev/sdb
Create mount point and mount the device ?
sudo mkdir /mnt/iscsi-storage sudo mount /dev/sdb /mnt/iscsi-storage
Step 8: Configure Automatic Mount
Add entry to /etc/fstab for persistent mounting ?
echo "/dev/sdb /mnt/iscsi-storage ext4 _netdev 0 0" | sudo tee -a /etc/fstab
The _netdev option ensures the mount waits for network availability.
Key Management Commands
| Operation | Command |
|---|---|
| Discover targets | iscsiadm -m discovery -t st -p TARGET_IP |
| Login to target | iscsiadm -m node -T TARGET_IQN -l |
| Logout from target | iscsiadm -m node -T TARGET_IQN -u |
| View sessions | iscsiadm -m session |
| Delete node | iscsiadm -m node -T TARGET_IQN -o delete |
Conclusion
Setting up an iSCSI initiator on CentOS provides cost-effective centralized storage access over IP networks. The configuration involves installing utilities, discovering targets, and establishing persistent connections. This solution scales storage infrastructure without requiring expensive dedicated hardware, making it ideal for virtualized environments and enterprise storage consolidation.
