{"id":295,"date":"2016-02-07T23:16:22","date_gmt":"2016-02-07T22:16:22","guid":{"rendered":"\/wordpress\/?p=295"},"modified":"2016-02-17T11:19:02","modified_gmt":"2016-02-17T10:19:02","slug":"iscsi-migrating-from-istgt-to-ctld","status":"publish","type":"post","link":"\/wordpress\/zfs-2\/iscsi-migrating-from-istgt-to-ctld\/","title":{"rendered":"iSCSI: Migrating from istgt to ctld"},"content":{"rendered":"<p>Deciding to upgrade my NAS from FreeBSD 9.2-RELEASE to 10.2-RELEASE, I wanted to try out the new native iSCSI initiator.<\/p>\n<p>As my iSCSI-network is physically separated by vlan I don&#8217;t bother with chap-authentication. I allow the entire network connect to the presented targets.<\/p>\n<p>The only part of the config previously used in istgt that couldn&#8217;t be migrated due to lack of support in ctld was QueueDepth which defaults at 32. My use of iSCSI is presenting LUNs to an ESXi installation that ideally would like a higher queue depth. There doesn&#8217;t seem to be any way to change this in ctld currently. As noted by a <a href=\"https:\/\/forums.freebsd.org\/threads\/how-to-set-the-queue-depth-on-ctl-conf-iscsi-target.53882\/\">forum post<\/a> I also experience it falls back to 32 when the LUN is being accessed.<\/p>\n<h3>\/etc\/ctld.conf<\/h3>\n<pre><code>portal-group pg1 {\r\n  discovery-auth-group no-authentication\r\n  listen 192.168.100.13:3260\r\n}\r\n\r\nauth-group ag1 {\r\n  auth-type none\r\n  initiator-portal 192.168.100.0\/24\r\n}\r\n\r\ntarget iqn.2004-06.net.strahlert.home:esxiL1 {\r\n  portal-group pg1\r\n  auth-group ag1\r\n  lun 0 {\r\n    path \/dev\/zvol\/san\/volumes\/esxiL1\r\n    option rpm 7200\r\n  }\r\n}\r\n\r\ntarget iqn.2004-06.net.strahlert.home:esxiL2 {\r\n  portal-group pg1\r\n  auth-group ag1\r\n  lun 0 {\r\n    path \/dev\/zvol\/san\/volumes\/esxiL2\r\n    option rpm 7200\r\n  }\r\n}\r\n\r\ntarget iqn.2004-06.net.strahlert.home:esxiL3 {\r\n  portal-group pg1\r\n  auth-group ag1\r\n  lun 0 {\r\n    path \/dev\/zvol\/san\/volumes\/esxiL3\r\n    option rpm 7200\r\n  }\r\n}\r\n\r\ntarget iqn.2004-06.net.strahlert.home:esxiL4 {\r\n  portal-group pg1\r\n  auth-group ag1\r\n  lun 0 {\r\n    path \/dev\/zvol\/san\/volumes\/esxiL4\r\n    option rpm 7200\r\n  }\r\n}<\/code><\/pre>\n<h3>ZFS properties<\/h3>\n<p>The following ZFS properties should be set on the parent dataset that will inherit down to each resepective sub-dataset.<\/p>\n<pre><code>san\/volumes  mountpoint            none                   local\r\nsan\/volumes  compression           lz4                    local\r\nsan\/volumes  atime                 off                    local\r\nsan\/volumes  volmode               dev                    local<\/code><\/pre>\n<h3>Caveats<\/h3>\n<p>The LUN id of the targets differ between istgt and ctl. When shutting down istgt, rescanning all hba:s in ESXi, starting ctld and again rescanning all hba:s, the datastores became unavailable. VMware knowledgebase articles didn&#8217;t present any solution. I ended up having to reboot the ESXi-server in order to detach the unavailable datastores.<\/p>\n<p>The LUNs had to be re-added due to this. Simply add storage as Disk\/LUN in the vSphere-client and select the LUN. It recognised that a vmfs filesystem already existed and by resignaturing the LUN, the datastore was back online with its data intact. It had to be renamed as it was a assigned a randomized prefix.<\/p>\n<p>The VM inventory was still pointing to the old datastore and I ended up having to re-add every VM by right-clicking the vmx file of each VM and select add to inventory. I also had to remove the old static discovered targets from the iSCSI software adapter properties.<\/p>\n<p>When having ZFS as backend-storage, the LUN will present itself as an SSD. Unless an option rpm is given per lun set to &gt;1024. To present non-ssd storage as ssd (and the other way around) is generally bad practice. When using VMware as front-end it opens up for faulty configurations such as using non-ssd storage as host cache.<\/p>\n<p>Also when using ZFS as backend-storage, be sure to set <code>zfs_enable=\"YES\"<\/code> in <code>\/etc\/rc.conf<\/code> or ctld will fail to open the zvol.<\/p>\n<h3>Take-aways<\/h3>\n<p>I&#8217;d recommend documenting which VM belong to which resourcepool\/folder before attempting this. Failing that, comparing the outputs of <code>vim-cmd vmsvc\/getallvms|grep Skipping<\/code> with the contents of <code>\/etc\/vmware\/hostd\/vmInventory.xml<\/code> proved useful in finding out the previous placements of the VMs.<\/p>\n<p>The new iSCSI initiator performs a lot better in my environment. The time that it takes for the snapshot backups have more than halved. The transfer rates are now about 2.2 times than what they used to be.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deciding to upgrade my NAS from FreeBSD 9.2-RELEASE to 10.2-RELEASE, I wanted to try out the new native iSCSI initiator. As my iSCSI-network is physically separated by vlan I don&#8217;t bother with chap-authentication. I allow the entire network connect to the presented targets. The only part of the config previously used in istgt that couldn&#8217;t <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"\/wordpress\/zfs-2\/iscsi-migrating-from-istgt-to-ctld\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,26,6],"tags":[27,31,3,5,28,2],"_links":{"self":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/295"}],"collection":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":8,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":304,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/295\/revisions\/304"}],"wp:attachment":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}