Lynda Linux System Engineer: Iscsi Storage Area Networks Download
In the data center world, large capacity Storage Area Networks ( SAN) have become the minimum standard. Create Volume Group in DebianNotice in the output above that the system responds that the Volume Group was created but it is always a good idea to double check as seen above with the ‘ vgs‘ command. The capacity of this volume group is only 9.99GB. While this is a particularly small volume group, the process would be the same for disks of larger capacity!The next step is the creation of the logical volume that will act as the disk to the iSCSI client ( initiator). For this example the entirety of the the volume group will be used but isn’t necessary.The logical volume will be created using the ‘ lvcreate‘ command. # lvcreate -l 100%FREE tecmintlun1 tecmintiscsi# lvs (Simply used to confirm the creation of the logical volume).
Create Logical Volume in DebianThe above ‘ lvcreate‘ command might be a little confusing at first glance but the break down is as such:. lvcreate – Command used to create the logical volume.l 100%FREE – Create the logical volume using all of the volume group’s free space.n tecmintlun1 – The name of the logical volume to be created. tecmintiscsi – The name of the volume group to create the logical volume within.Once the logical volume has been created, it’s time to create the actual LUN ( Logical Unit Number). The LUN will be the storage device that the initiator will connect to and use later.Creating a LUN is very simple and requires only a few steps. The first step will be the creation of the configuration file.
This file will reside in the ‘ /etc/tgt/conf.d‘ directory and for this article it will be called ‘ TecMintiscsi.conf‘.To create this file use a text editor. # nano /etc/tgt/conf.d/TecMintiscsi.confWithin this file, all the necessary configuration information for this LUN will be configured. There are a lot of options that can be placed in this file but for now a basic LUN with mutual Challenge Handshake Authentication Protocol ( CHAP) will be configured.The LUN’s definition will exist between two ‘ target‘ statements. For more parameters that can go in the target statement, review the manual page for the ‘ targets.conf‘ file by issuing ‘ man 5 targets.conf‘. # Provided device as an iSCSI targetbacking-store /dev/mapper/tecmintiscsi-tecmintlun1initiator-address 192.168.56.102incominguser tecmint-iscsi-user passwordoutgoinguser debian-iscsi-target secretpassThere’s a lot going on above.
A quick explanation may be helpful to most.The first line begins the particular iSCSI LUN configuration. In this case the LUN labeled ‘ iqn.2018-02.tecmint.com:lun1‘. The ‘ iqn‘ part indicates that this will be an iSCSI qualified name. The ‘ 2018-02‘ is an arbitrarily chosen date combination.
‘ tecmint.com‘ is the domain that this particular LUN belongs. Finally, the ‘ lun1‘ is used as the name for this particular target. The second line above illustrates a comment. Comments can exist in the target configuration files and must be prefaced with a ‘ #‘ symbol. The third line is where the actual storage space that will be used by the initiator exists.
In this case the storage backing will be the logical volume that was created earlier in the guide. The fourth line is the IP address that is expected from the initiator. While this isn’t a required configuration item, it can help increase security.
The fifth line is the incoming username/password. Much like the initiator address above, this parameter isn’t required either but can help to secure the LUN. Since this guide is also covering iSCSI mutual CHAP, this parameter is required.
This line indicates the username and password that the target will expect from the initiator in order to connect to this LUN. The sixth line is the username/password that the target will provide to the initiator to allow for mutual CHAP authentication to take place. Normally this parameter is not required but this article is covering mutual CHAP authentication so this parameter is required. The final line is the closing statement for the target definition. Pay attention to the closing slash in front of the keyword target!Once the appropriate configurations for the LUN have been typed out, save the changes and exit the text editor. If using nano, hit ctrl+o to save and then hit ctrl+x to exit nano.
Create LUN Configuration FileOnce the configuration file has been created, the tgt service should be restarted so tgt is aware of the new targets and the associated configuration.This can be done with one of the following commands and is dependent on the init system in use. # service tgt restart (For sysv init systems)# systemctl restart tgt (For systemd init systems)Once tgt has been restarted, it is important to check to ensure that the iSCSI target is being made available according to the configuration file created.This can be accomplished with the ‘ tgtadm‘ command.
# tgtadm -mode target -op show (This will show all targets). Show All iSCSI TargetsThis concludes the configuration of the target.
Lynda Linux System Engineers: Iscsi Storage Area Networks Download Windows 7
The next section will work through the configuration of the initiator. Debian iSCSI Initiator ConfigurationThe next step in using the previously configured iSCSI target is the configuration of the iSCSI initiator.A different will be used as the initiator in this article but any system that can utilize the iSCSI protocol can connect to the previously configured target; this could include hypervisors like or other distributions like Red Hat, Debian, or Ubuntu.The first step in this process for this Debian initiator is the installation of the proper packages for iSCSI. # apt-get update# apt-get install open-iscsiOnce has finished the configuration of the open-iscsi packages, the iSCSI initiator configuration can begin. The first step will be to communicate with the target to get the initial configuration information for the target prepared. # iscsiadm -m discovery -t st -p 192.168.56.101When this command runs, it will respond back with the name of the lun configured earlier for this particular host.
The above command will also generate two files for the newly discovered LUN information. Connect iSCSI Target ServerNow the file created for this node will need to have the CHAP information configured in order for this iSCSI target to actually be accessible by the initiator.Technically this information could be setup for the entire system as a whole but in the event that a host connects to different LUNs with different credentials, placing those credentials in the specific node configuration file can mitigate any issues.The node configuration file will exist in the directory ‘ /etc/iscsi/nodes/‘ and will have a directory per LUN available. In the case of this article (note that paths will change if names/IP addresses are changed). # /etc/iscsi/nodes/iqn.2018-02.tecmint.com:lun1/192.168.56.101,3260,1/defaultTo work with this file, any text editor can be used. List iSCSI ConnectionsFrom this point, the newly attached iSCSI device can be used similar to any normally attached disk!
Partitioning, filesystem creation, mounting, and/or persistent mounting can all able be handled normally.One big caution to be aware of with iSCSI devices is if the iSCSI target contains important filesystems that are needed as the initiator is booting, make sure to use the ‘ netdev‘ entry in the ‘ /etc/fstab‘ file to ensure that the iSCSI device is connected before the system continues booting!