In order to test an iSCSI initiator, you will need to configure an iSCSI target.
Install the following package:
# yum install -y iscsi-initiator-utils
Discover the available iSCSI targets from your already installed ‘targetserver‘:
# iscsiadm -m discoverydb -t st -p targetserver -D
Start the iSCSI service:
# service iscsi start
Retrieve the new iSCSI disk name (here /dev/sda):
# grep "Attached SCSI" /var/log/messages Nov 22 10:28:38 testvm kernel: sd 2:0:0:1: [sda] Attached SCSI disk
Create a file system on this disk:
# mkfs.ext4 /dev/sda
Note: if you are connecting remotely, set up a console access before.
Retrieve the UUID of this disk:
# blkid | grep "/dev/sda"
Add the disk UUID to the /etc/fstab file:
# echo "UUID=..." >> /etc/fstab
Edit the /etc/fstab file and add mount point, file system type and mount options (_netdev):
UUID=... /mnt ext4 _netdev 0 0
You can additionally read this very interesting Linux Journal’s article about iSCSI & RHEL 6 certification.