{"id":200,"date":"2020-04-13T22:30:46","date_gmt":"2020-04-14T03:30:46","guid":{"rendered":"http:\/\/www.davidhedges.info\/?p=200"},"modified":"2020-04-13T22:30:47","modified_gmt":"2020-04-14T03:30:47","slug":"creating-an-iscsi-target-on-rhel8-centos8","status":"publish","type":"post","link":"https:\/\/www.davidhedges.info\/index.php\/2020\/04\/13\/creating-an-iscsi-target-on-rhel8-centos8\/","title":{"rendered":"Creating an ISCSI target on RHEL8 \/ CentOS8"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I recently bought a HP server that has 40T of storage outside of the OS array. I had set it up to act as an iscsi storage target for a couple of vmware hosts I run in my lab. Looking around on the internet I was able to find a lot of information on how to create iscsi targets with fileio, but not many that many that talked about utilizing direct access to block storage. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I am going to describe configuring your iscsi target on a block storage device. I am also assuming that you don&#8217;t need to open ports in firewalld or have it disabled.<\/p>\n\n\n\n<ul class=\"wp-block-list\" type=\"1\"><li>locate the device your iscsi storage is on:<ul><li>run: fdisk -l<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"914\" height=\"472\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/01iscsi.jpg\" alt=\"\" class=\"wp-image-201\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/01iscsi.jpg 914w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/01iscsi-300x155.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/01iscsi-768x397.jpg 768w\" sizes=\"auto, (max-width: 914px) 100vw, 914px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li> Next install the targetcli package:<ul><li>Run: yum install targetcli -y<\/li><\/ul><\/li><li>Run targetcli<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"99\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/02iscsi.jpg\" alt=\"\" class=\"wp-image-202\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/02iscsi.jpg 457w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/02iscsi-300x65.jpg 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Create the backstores<ul><li>Run: cd backstores\/block<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"46\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/03iscsi.jpg\" alt=\"\" class=\"wp-image-203\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Run: create dev=\/dev\/&lt;storage&gt; name=MyStorage<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"475\" height=\"39\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/04iscsi.jpg\" alt=\"\" class=\"wp-image-204\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/04iscsi.jpg 475w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/04iscsi-300x25.jpg 300w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Running \u201cls\u201d should show something similar to this:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"74\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/06iscsi-1024x74.jpg\" alt=\"\" class=\"wp-image-205\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/06iscsi-1024x74.jpg 1024w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/06iscsi-300x22.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/06iscsi-768x55.jpg 768w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/06iscsi.jpg 1122w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Creating the iscsi Targets<ul><li>Run: cd \/iscsi<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"315\" height=\"39\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/07iscsi.jpg\" alt=\"\" class=\"wp-image-206\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/07iscsi.jpg 315w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/07iscsi-300x37.jpg 300w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Create a iscsi target by creating a custom IQN ( many times the format is iqn.YYYY-MM.com.example:targetdescription )<ul><li>Run: create wwn=iqn.2020-01.com.mydomain:svrstorage<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"552\" height=\"97\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/08iscsi.jpg\" alt=\"\" class=\"wp-image-207\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/08iscsi.jpg 552w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/08iscsi-300x53.jpg 300w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Running ls should show something similar to this:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"128\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/09iscsi-1024x128.jpg\" alt=\"\" class=\"wp-image-208\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/09iscsi-1024x128.jpg 1024w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/09iscsi-300x38.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/09iscsi-768x96.jpg 768w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/09iscsi.jpg 1078w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Add ACLs for the hosts that will connect<ul><li>Run: cd iqn.2020-10.com.mydomain:svrstorage\/tpg1\/acls&nbsp; (using your custome IQN)<\/li><\/ul><ul><li>Create the ACL for the connecting hosts (you must know the IQN of the connecting host)<ul><li>Run: create wwn=iqn.2019-02.com.otherhost:node1<\/li><\/ul><\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"38\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/10iscsi.jpg\" alt=\"\" class=\"wp-image-209\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/10iscsi.jpg 684w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/10iscsi-300x17.jpg 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Running \u201cls\u201d should show something like this:<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"55\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/11iscsi-1024x55.jpg\" alt=\"\" class=\"wp-image-210\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/11iscsi-1024x55.jpg 1024w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/11iscsi-300x16.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/11iscsi-768x41.jpg 768w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/11iscsi.jpg 1086w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>We need to map the LUN to the iscsi target<ul><li>Run cd \/iscsi\/iqn.2020-10.com.mydomain:svrstorage\/tpg1\/luns&nbsp; (the IQN being the remote hosts IQN)<\/li><\/ul><ul><li>Run: create \/backstores\/block\/MyStorage<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"53\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/12iscsi.jpg\" alt=\"\" class=\"wp-image-211\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/12iscsi.jpg 599w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/12iscsi-300x27.jpg 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Running \u201cls\u201d should show you something like this<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"56\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/13iscsi-1024x56.jpg\" alt=\"\" class=\"wp-image-212\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/13iscsi-1024x56.jpg 1024w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/13iscsi-300x16.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/13iscsi-768x42.jpg 768w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/13iscsi.jpg 1069w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Verify it all looks right, and exit<ul><li>Run: cd \/<\/li><\/ul><ul><li>Run: ls&nbsp;&nbsp;&nbsp; and verify that your settings appear correct<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"329\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/14iscsi-1024x329.jpg\" alt=\"\" class=\"wp-image-213\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/14iscsi-1024x329.jpg 1024w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/14iscsi-300x97.jpg 300w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/14iscsi-768x247.jpg 768w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/14iscsi.jpg 1066w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>If all of your devices and ACLs look correct, type exit to save and quit.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"58\" src=\"http:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/15iscsi.jpg\" alt=\"\" class=\"wp-image-214\" srcset=\"https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/15iscsi.jpg 436w, https:\/\/www.davidhedges.info\/wp-content\/uploads\/2020\/04\/15iscsi-300x40.jpg 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Start the iscsi target<ul><li>Run: systemctl enable target<ul><li>This will enable the daemon starting each time the server starts up<\/li><\/ul><\/li><\/ul><ul><li>Run: systemctl start target<ul><li>This will start the iscsi target daemon<\/li><\/ul><\/li><\/ul><ul><li>At this point your remote hosts should be able to connect and see the storage you have shared.<\/li><\/ul><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I recently bought a HP server that has 40T of storage outside of the OS array. I had set it up to act as an iscsi storage target for a couple of vmware hosts I run in my lab. Looking around on the internet I was able to find a lot of information on how [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-200","post","type-post","status-publish","format-standard","category-it-blog","entry"],"_links":{"self":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":1,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":215,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/posts\/200\/revisions\/215"}],"wp:attachment":[{"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.davidhedges.info\/index.php\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}