RHCE EX300 exam: Configure an iSCSI initiator (client) on Red Hat Enterprise Linux
---
Our given task is:
Configure an iSCSI initiator.
Configure system2 so that it connects to the iqn.2017-04.com.example.domain9:system1 target on system1 as follows:
The iSCSI device should automatically be available on system boot.
The iSCSI block device contain a 1700 MiB that is formatted as ext3.
The partition is mounted to /mnt/data and is automatically mounted to this directory at system boot.
---
Fist we have to install iscsi-initiator-utils package:
yum install -y iscsi-initiator-utils
Once iscsi-initiator-utils package is successfully installed we have to modify initiatorname.iscsi file:
vi /etc/iscsi/initiatorname.iscsi
InitiatorName musts be equal to the name which we had already set up on the iSCSI target. You can confirm iSCSI initiator name on iSCSI target server by running targetcli command. Initiator name can be found under acls in targetcli environment.
Enable iscsi service to start automatically during system startup:
systemctl enable iscsi
Double-check that iscsi service is enabled to start automatically after system startup:
systemctl is-enabled iscsi
Start iscsi service:
systemctl start iscsi
Please do not confuse iscsi service with iscsid service. If you start iscsi service it will start iscsid service for you as well. iscsi service will:
start iscsid service.
login initiator to target after system startup.
logout initiator from target before system shutdown.
If you will start only iscsid service instead of iscsi service it will not login initiator to target after system startup and iscsid will not logout initiator from target during system shutdown which may result to system hang during shutdown.
Next step is to discover targets on our iSCSI server system1. Command to discover targets can be found in EXAMPLES section of iscsiadm man page.
iscsiadm --mode discoverydb --type sendtargets --portal 172.24.9.10 --discover
Node record id found by the discovery (output of above command) will be used to login to the target. Command to login to the target can be found in EXAMPLES section of iscsiadm man page again.
iscsiadm --mode node --targetname iqn.2017-04.com.example.domain9:system1 --portal 172.24.9.10:3260 --login
Verify that iSCSI disk device was picked up successfully. Presence of the new iSCSI disk can be confirmed in /var/log/messages file, output of dmesg command and in the output of various Linux tools:
iscsiadm -m session -P3 | grep Attached
lsscsi -s
WHERE: -s option prints disk capacity in human readable form.
lsblk
lsblk --scsi
fdisk -l | grep Disk
cat /proc/scsi/scsi
cat /proc/partitions
Connection parameter defaults can be found in default file.
/var/lib/iscsi/nodes/iqn.2017-04.com.example.domain9:system1/172.24.9.10,3260,1/default
Once iSCSI disk was successfully added yo our Linux server, we will create disk partition, filesystem and we will modify /etc/fstab file to ensure that filesystem will be mounted after reboot as well.
To create disk partition we will use fdisk command. Once disk partition with requested size is successfully created - we will create ext3 filesystem with below command:
mkfs.ext3 /dev/sda1
NOTE: On your RHCE exam requested filesystem type can be xfs, ext4 or vfat.
Create directory for mount point:
mkdir /mnt/data
Update /etc/fstab file with entry related to your newly created filesystem on your new iSCSI storage. You have to specify _netdev option for new filesystem created on iSCSI storage otherwise mounting of filesystem will fail because it will happen before network services will be up and running. If you will specify _netdev option - system processes will know that they have to wait and try to mount network filesystem once network will be fully operational.
Mount new filesystem:
mount /mnt/data
Verify the size of the new filesystem:
df -h /mnt/data
Related Video Tutorials:
RHCE EX300 Exam:
RHCE EX300 exam: Configure an iSCSI target on Red Hat Enterprise Linux
• RHCE EX300 exam: Configure an iSCSI target...
RHCSA Fast Track course:
Reset forgotten root password in Redhat 7:
• Reset forgotten root password in Redhat 7
Setting up network using a NetworkManager command line interface (nmcli) in Red Hat 7
• Setting up network using a NetworkManager ...
nmcli cheat! Setting up network using nmcli in Red Hat 7 in less than a 30 seconds - QUICK & EASY!!!
• nmcli cheat! Setting up network using nmcl...
Setting up network using a NetworkManager text user interface (nmtui) in Red Hat 7 - EASY!!!
• Setting up network using a NetworkManager ...
Setting up network in Red Hat 7 in less than a minute
• Setting up network in Red Hat 7 in less th...
Shrink ext2 ext3 and ext4 file system and reduce the size of a logical volume with only one command.
• Shrink ext2 ext3 and ext4 file system and ...
Complete guide to file system shrinking and reducing the size of the underlying logical volume.
• Complete guide to file system shrinking an...
Other related video tutorials:
NetworkManager connection priority - manage network profile priority in Linux:
• NetworkManager connection priority - manag...