{"id":3368,"date":"2017-03-09T20:29:59","date_gmt":"2017-03-09T20:29:59","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3368"},"modified":"2017-03-09T20:29:59","modified_gmt":"2017-03-09T20:29:59","slug":"connecting-storage-volume-using-iscsi","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/03\/09\/connecting-storage-volume-using-iscsi\/","title":{"rendered":"Connecting to your Storage Volume using ISCSI"},"content":{"rendered":"<p>The Open-iSCSI project is a high performance, transport independent, multi-platform implementation of RFC3720 (The iSCSI specification). It consists of a minimal set of kernel modules combined with powerful userspace utilities. Once installed on a system, a daemon process iscsid can be controlled using the iscsiadm management utility. Open-iSCSI requires a Linux kernel of 2.6.16 or greater.<\/p>\n<p>CentOS 5\/6: Open-iSCSI can be installed using yum:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># sudo yum install iscsi-initiator-utils\n\n<\/pre>\n<p>Debian\/Ubuntu: Open-iSCSI can be installed using apt:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># sudo apt-get install open-iscsi\n\n<\/pre>\n<p>Configure iSCSI Drivers and Utilities<\/p>\n<p>Linux<\/p>\n<p>Open \/etc\/iscsi\/iscsid.conf with the text editor of your choice:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># sudo vi \/etc\/iscsi\/iscsid.conf\n\n<\/pre>\n<p>Make the following edits to the configuration file. Set the values of username and password to the CHAP username\/password provided to you when you purchased the block storage.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">node.startup = automatic\nnode.session.auth.authmethod = CHAP\nnode.session.auth.username = \nnode.session.auth.password = \ndiscovery.sendtargets.auth.authmethod = CHAP\ndiscovery.sendtargets.auth.username = \ndiscovery.sendtargets.auth.password = \n\n<\/pre>\n<p>Next, you must run the discovery command against the discovery IP for your block storage device. After the discovery command is run, you must restart the iscsi service.<\/p>\n<p>CentOS 5\/6:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo iscsiadm -m discovery -t sendtargets -p &lt;Discovery IP Address&gt;\n# sudo service iscsi restart\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo iscsiadm -m discovery -t sendtargets -p 192.168.1.106\n192.168.1.106:3260,257 iqn.2005-10.org.freenas.ctl:vol1\n\n<\/pre>\n<p>Debian\/Ubuntu:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># sudo service open-iscsi start\n# sudo iscsiadm -m discovery -t sendtargets -p &lt;Discovery IP Address&gt;\n# sudo service open-iscsi restart\n\n\n<\/pre>\n<p>Setup Storage Volumes<\/p>\n<p>Linux<\/p>\n<p>After successfully discovering your block storage disk, the volume should show as available to the fdisk command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># fdisk -l\n\n....output truncated....\n\n        Disk \/dev\/sdb: 300.0 GB, 300000002048 bytes\n        255 heads, 63 sectors\/track, 36472 cylinders\n        Units = cylinders of 16065 * 512 = 8225280 bytes\n        Sector size (logical\/physical): 512 bytes \/ 4096 bytes\n        I\/O size (minimum\/optimal): 4096 bytes \/ 4096 bytes\n        Disk identifier: 0x00000000\n\n        Disk \/dev\/sda doesn&#039;t contain a valid partition table\n\n<\/pre>\n<p>Or <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# iscsiadm -m session\ntcp: &#x5B;1] 192.168.1.106:3260,257 iqn.2005-10.org.freenas.ctl:vol1 (non-flash)\n<\/pre>\n<p>At this point, you can create filesystems on the disk or configure it as a raw block device as desired:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">    # parted \/dev\/sdb\n    GNU Parted 2.2\n    Using \/dev\/sda\n    Welcome to GNU Parted&amp;gt; ! Type &#039;help&#039; to view a list of commands.\n    (parted) mklabel gpt\n    (parted) mkpart extended 0% 100%\n    (parted) print\n    Model: SolidFir SSD SAN (scsi)\n    Disk \/dev\/sda: 300GB\n    Sector size (logical\/physical): 512B\/4096B\n    Partition Table: gpt\n\n    Number  Start   End    Size   File system  Name      Flags\n     1      1049kB  300GB  300GB               extended\n\n     (parted) quit\n<\/pre>\n<p>Create the format the file system:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">    # mkfs -t ext3 -L myBlockStorage \/dev\/sdb1\n    mke2fs 1.41.11 (14-Mar-2010)\n    Filesystem label=myBlockStorage\n    .... output truncated ....\n\n<\/pre>\n<p>Create a mount point and mount the device<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mkdir \/mnt\/my_block_storage_volume\n# mount \/dev\/sdb1 \/mnt\/my_block_storage_volume\/\n\n<\/pre>\n<p>Get mount information:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# blkid\n\/dev\/mapper\/centos-root: UUID=&quot;198c20b5-d690-404b-8244-6e4ef8e66618&quot; TYPE=&quot;xfs&quot;\n\/dev\/sda2: UUID=&quot;5d57ye-2YQD-vpoo-YV4w-VTUm-gtGA-kGTNzr&quot; TYPE=&quot;LVM2_member&quot;\n\/dev\/sda1: UUID=&quot;bdf1787d-e27b-4cd0-bd47-0de6865c6858&quot; TYPE=&quot;xfs&quot;\n\/dev\/mapper\/centos-swap: UUID=&quot;33d91d50-a9f8-4d1e-94f4-63ab19dc34d1&quot; TYPE=&quot;swap&quot;\n\/dev\/sdb1: LABEL=&quot;storage&quot; UUID=&quot;362c5edb-6c68-4ec9-8745-576cba65133e&quot; SEC_TYPE=&quot;ext2&quot; TYPE=&quot;ext3&quot; PARTLABEL=&quot;extended&quot; PARTUUID=&quot;8689df9d-b059-4812-a5d4-e97fcb3b80c4&quot;\n\n<\/pre>\n<p>Edit fstab to mount on boot:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># nano \/etc\/fstab \n#\/dev\/sdb1       \/mnt\/storage  ext3  defaults     0       0\n\n<\/pre>\n<p>Reboot system to ensure that the device is mounted on boot. If you receive the following error:<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3373\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1-300x183.png\" alt=\"\" width=\"300\" height=\"183\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1-300x183.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1-1024x625.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1-768x469.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/03\/Capture-1.png 1030w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Edit fstab to include the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# \/dev\/sdb1 \/mnt\/storage ext3 _netdev 0 0\n<\/pre>\n<p>This works as well&#8230;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# \/dev\/sdb1       \/mnt\/storage  ext3  acl,user,nofail     0       0\n\n<\/pre>\n<p>Notes:<\/p>\n<ol>\n<li>Use the nofail option in \/etc\/fstab<\/li>\n<li>Make sure the dump field is set to 0 (zero) else the system will stop booting and prompt for the maintenance mode as the device is not available at this time in the boot process.<br \/>\nThe dump option is the fifth entry option in \/etc\/fstab, see man 5 fstab for more information.<\/li>\n<li>Make sure iscsi is enabled at boot &#8211; (CentOS 7 &#8211; systemctl enable iscsi.service).<\/li>\n<\/ol>\n<p>Source: https:\/\/www.novell.com\/support\/kb\/doc.php?id=7004427<\/p>\n<p>NOTE: SAN disks can be slow to format due to the large number of small IOPs required by the formatting utility. To speed the formatting of your disk, you may wish to pass the &#8216;-E lazy_itable_init&#8217; option to mkfs.<\/p>\n<p>In order to automatically connect to your block storage disk on system startup, make the following changes to the \/etc\/iscsi\/iscsi.conf file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# nano \/etc\/iscsi\/iscsid.conf\n# To manually startup the session set to &quot;manual&quot;. The default is automatic.\nnode.startup = automatic\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Open-iSCSI project is a high performance, transport independent, multi-platform implementation of RFC3720 (The iSCSI specification). It consists of a minimal set of kernel modules combined with powerful userspace utilities. Once installed on a system, a daemon process iscsid can be controlled using the iscsiadm management utility. Open-iSCSI requires a Linux kernel of 2.6.16 or &#8230; <a title=\"Connecting to your Storage Volume using ISCSI\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/03\/09\/connecting-storage-volume-using-iscsi\/\" aria-label=\"Read more about Connecting to your Storage Volume using ISCSI\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[],"class_list":["post-3368","post","type-post","status-publish","format-standard","hentry","category-iscsi"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3368"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3368\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}