{"id":306,"date":"2018-01-08T11:56:28","date_gmt":"2018-01-08T11:56:28","guid":{"rendered":"https:\/\/langhard.net\/?p=306"},"modified":"2018-10-12T07:47:36","modified_gmt":"2018-10-12T07:47:36","slug":"ubuntu-16-04-serve-iscsi-target","status":"publish","type":"post","link":"https:\/\/langhard.net\/?p=306","title":{"rendered":"Ubuntu 16.04 to serve as an iSCSI target"},"content":{"rendered":"<h3>What is ISCSI<\/h3>\n<p>iSCSI, which stands for Internet Small Computer System Interface, works on top of the Transport Control Protocol (TCP) and allows the SCSI\u00a0command\u00a0to be sent end-to-end over local-area networks (LANs), wide-area networks (WANs) or the\u00a0Internet.\u00a0IBM developed iSCSI as a\u00a0proof of concept\u00a0in 1998, and presented the first draft of the iSCSI\u00a0standard\u00a0to the Internet Engineering Task Force (IETF) in 2000. The\u00a0protocol\u00a0was ratified in 2003.<\/p>\n<h3 class=\"section-title\">How ISCSI works<\/h3>\n<p>iSCSI works by transporting\u00a0block-level data between an\u00a0iSCSI initiator\u00a0on a server and an\u00a0iSCSI target\u00a0on a\u00a0storage\u00a0device. The iSCSI protocol\u00a0encapsulates\u00a0SCSI commands and assembles the data in\u00a0packets\u00a0for the TCP\/IP layer. Packets are sent over the\u00a0network\u00a0using a point-to-point connection. Upon arrival, the iSCSI protocol disassembles the packets, separating the SCSI commands so the operating system (OS) will see the storage as a local SCSI device that can be formatted as usual. Today, some of iSCSI&#8217;s popularity in small to midsize businesses (SMBs) has to do with the way\u00a0server virtualization\u00a0makes use of storage pools. In a\u00a0virtualized\u00a0environment, the storage pool is accessible to all the\u00a0hosts\u00a0within the\u00a0cluster\u00a0and the cluster nodes nodes communicate with the storage pool over the network through the use of the iSCSI protocol.<\/p>\n<h3>ISCSI target install<\/h3>\n<p>Have a clean updated ubuntu server with alot of disk space. In this tutorial i will use a 5.5TB setup. 5TB for the iscsi and 500GB for the system.<\/p>\n<pre>sudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n<p><span>Install the iSCSI target(<\/span><em>iscsitarget<\/em><span>)<\/span><span>\u00a0and\u00a0<\/span><em>iscsitarget-dkms<\/em><span>.<\/span><\/p>\n<pre>sudo apt-get install iscsitarget iscsitarget-dkms<\/pre>\n<p><span>edit\u00a0<\/span><em>\/etc\/default\/iscsitarget<\/em><span>. Change the default value of\u00a0<\/span><em>ISCSITARGET_ENABLE=false<\/em><span>\u00a0over to\u00a0<\/span><em>ISCSITARGET_ENABLE=true<\/em><span>. Not doing so will not allow the target to start.<\/span><\/p>\n<pre>sudo nano \/etc\/default\/iscsitarget<\/pre>\n<pre>ISCSITARGET_ENABLE=true<\/pre>\n<h3>Storage Creation<\/h3>\n<p>When working with iSCSI you have to also think of LUN\u2019s. This when you decide whether you want to use files or partitions when offering the targets storage to the iSCSI clients. For the tutorial I will be using files.<\/p>\n<p>To create a file we can use dd to create and empty file that will grow once the users start storing file in it. The file weights 5000GB.<\/p>\n<pre>sudo mkdir \/media\/volume0\r\nsudo dd if=\/dev\/zero of=\/media\/volume0\/storlun0.bin count=0 obs=1 seek=5000G<\/pre>\n<p>I want to store the resulting files in a different path than my home directory which is why I specified that the file be deposited at \/media\/volume0.<\/p>\n<h3>Target Creation<\/h3>\n<p>Configurations and targets we create can be found in the<span>\u00a0<\/span><em>\/etc\/iet\/ietd.conf<\/em>configuration file.<\/p>\n<pre>sudo nano \/etc\/iet\/ietd.conf\r\n<\/pre>\n<p>Scroll to the bottom of the configuration file and add:<\/p>\n<pre>Target iqn.2012-05.local.mynet:storage.sys0\r\n        Lun 0 Path=\/media\/volume0\/storlun0.bin,Type=fileio,ScsiId=lun0,ScsiSN=lun0\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Restart Target<\/h3>\n<p>All that is left to do is restart the target with our changes.<\/p>\n<pre>sudo service iscsitarget restart<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is ISCSI iSCSI, which stands for Internet Small Computer System Interface, works on top of the Transport Control Protocol (TCP) and allows the SCSI\u00a0command\u00a0to be sent end-to-end over local-area networks (LANs), wide-area networks (WANs) or the\u00a0Internet.\u00a0IBM developed iSCSI as a\u00a0proof of concept\u00a0in 1998, and presented the first draft of the iSCSI\u00a0standard\u00a0to the Internet Engineering [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":308,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[65,67,69,71,73],"class_list":["post-306","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-en","tag-guide-en","tag-iscsi-en","tag-linux-en","tag-tutorial-en","tag-ubuntu-en"],"_links":{"self":[{"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/posts\/306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/langhard.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306"}],"version-history":[{"count":0,"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/posts\/306\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/langhard.net\/index.php?rest_route=\/wp\/v2\/media\/308"}],"wp:attachment":[{"href":"https:\/\/langhard.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/langhard.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/langhard.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}