4 (80%) 2 votes

In the two first parts, we saw how to implement the DRBD and the ISCSI Targets which hosts our data.

Now, we need to implement our ISCSI Initiator allowing us to connect to our ISCSI storage from our two targets. We can implement the ISCSI Initiator to some servers like the web servers, database servers and so on… so that they use this ISCSI storage to store some datas. So on each server you want to have an access to this storage, you need to repeat the same steps.


Install the following package.

apt-get install open-iscsi


Configuration of the ISCSI Initator

Now, we’ll find our iSCSI storage thanks to the virtual IP we provided before which is :

iscsiadm –m discovery-t st –p

Let’s connect then to our storage with the command

 iscsiadm -m node --targetname "iqn.2016-06.com.transcoder:drbd0" --portal "" –login


Our server is now connected to the iSCSI target. Before mounting the disk, we will have to format it in order to use it. Then, we will mount our iSCSI storage to the folder /mnt/iscsi that we will create.

fdisk /dev/sdb //create a new partition
mkfs.ext4 /dev/sdb1
mkdir /mnt/iscsi
mount /dev/disk/by-path/ip- 06.com.transcoder:drbd0-lun-0-part1 /mnt/iscsi


Your ISCSI drive is now mounted. But if you reboot your initiator, you have to repeat the previous step to connect to our iSCSI. In order to resolve this issue, we will edit the file fstab so that he can mount automatically our ISCSI disk and also log-in automatically to our resource.

 iscsiadm -m node --targetname "iqn.2016-06.com.transcoder:drbd0" --portal "" --op=update -n node.startup -v automatic


In /etc/fstab, add the following line

 /dev/disk/by-path/ip- lun-0-part1 /mnt/iscsi ext4 _netdev 0 0


Now, your initiator can mount automatically our iSCSI target even after rebooting the server.

Finally, your ISCSI storage is fully ready ! It’s now highly-available and we can afford to lose one server which host the ISCSI storage. You wan try to add some data into the ISCSI storage and crash one ISCSI target and see that your data is on the second ISCSI target. Play with it with moderation ! 🙂