{"id":19679,"date":"2017-08-24T06:09:14","date_gmt":"2017-08-23T22:09:14","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/24\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-targetcli\/"},"modified":"2021-03-18T17:25:08","modified_gmt":"2021-03-18T09:25:08","slug":"ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-targetcli","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/24\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-targetcli\/","title":{"rendered":"Ubuntu 16.04 LTS \u5b89\u88dd iSCSI Taregt &#8211; targetcli"},"content":{"rendered":"<p>\u53c3\u8003\u7db2\u7ad9\uff1a<br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi&amp;f=2\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Taregt(iscsitarget) : Server World<\/a><br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi&amp;f=3\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Initiator(Ubuntu) : Server World<\/a><br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=Ubuntu_16.04&amp;p=iscsi\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 16.04 LTS : iSCSI Taregt(targetcli) : Server World<\/a><\/p>\n<p>1. \u5b89\u88dd targetcli \u5957\u4ef6<br \/># <span style=\"color: #ff0000\">apt-get -y install targetcli<\/span><\/p>\n<p>2. \u5efa\u7acb\u76ee\u9304<br \/># <span style=\"color: #ff0000\">mkdir \/iscsi_disks<\/span><\/p>\n<p>[@more@]3. \u9032\u5165 iscsi \u7ba1\u7406\u4ecb\u9762<br \/># <span style=\"color: #ff0000\">\/usr\/bin\/targetcli<\/span><br \/><span style=\"color: #0000ff\">Warning: Could not load preferences file \/root\/.targetcli\/prefs.bin.<\/span><br \/><span style=\"color: #0000ff\">targetcli 3.0.pre4.1~ga55d018 (rtslib 3.0.pre4.1~g1b33ceb)<\/span><br \/><span style=\"color: #0000ff\">Copyright (c) 2011-2014 by Datera, Inc.<\/span><br \/><span style=\"color: #0000ff\">All rights reserved.<\/span><\/p>\n<p><span style=\"color: #0000ff\">\/&gt;<\/span> <span style=\"color: #ff0000\">cd backstores\/fileio<\/span><br \/><span style=\"color: #0000ff\">\/backstores\/fileio&gt;<\/span> <span style=\"color: #ff0000\">create linux-disk \/iscsi_disks\/linux-disk.img 10G<\/span><br \/><span style=\"color: #0000ff\">Using buffered mode.<\/span><br \/><span style=\"color: #0000ff\">Created fileio linux-disk.<\/span><br \/><span style=\"color: #0000ff\">\/backstores\/fileio&gt;<\/span> <span style=\"color: #ff0000\">cd \/iscsi<\/span><br \/><span style=\"color: #0000ff\">\/iscsi&gt;<\/span> <span style=\"color: #ff0000\">create iqn.2017-04.tces.test:linux.disk<\/span><br \/><span style=\"color: #0000ff\">Created target iqn.2017-04.tces.test:linux.disk.<\/span><br \/><span style=\"color: #0000ff\">Selected TPG Tag 1.<\/span><br \/><span style=\"color: #0000ff\">Created TPG 1.<br \/><\/span><br \/><span style=\"color: #0000ff\">\/iscsi&gt; <span style=\"color: #ff0000\">cd iqn.2017-04.tces.test:linux.disk\/tpg1\/portals<\/span><br \/>\/iscsi\/iqn.20&#8230;\/tpg1\/portals&gt; <span style=\"color: #ff0000\">create 0.0.0.0<\/span><br \/>Using default IP port 3260<br \/>Created network portal 0.0.0.0:3260.<\/p>\n<p>\/iscsi\/iqn.20&#8230;\/tpg1\/portals&gt;<\/span><span style=\"color: #0000ff\"><\/span> <span style=\"color: #ff0000\">cd ..\/luns<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;isk\/tpg1\/luns&gt;<\/span> <span style=\"color: #ff0000\">create \/backstores\/fileio\/linux-disk<\/span><br \/><span style=\"color: #0000ff\">Selected LUN 0.<\/span><br \/><span style=\"color: #0000ff\">Created LUN 0.<br \/><\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;isk\/tpg1\/luns&gt;<\/span> <span style=\"color: #ff0000\">cd ..\/acls<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;isk\/tpg1\/acls&gt;<\/span> <span style=\"color: #ff0000\">create iqn.2017-04.tces.test:linux-pc<\/span><br \/><span style=\"color: #0000ff\">Created Node ACL for iqn.2017-04.tces.test:linux-pc<\/span><br \/><span style=\"color: #0000ff\">Created mapped LUN 0.<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;isk\/tpg1\/acls&gt;<\/span> <span style=\"color: #ff0000\">cd iqn.2017-04.tces.test:linux-pc<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;test:linux-pc&gt;<\/span> <span style=\"color: #ff0000\">set auth userid=username<\/span><br \/><span style=\"color: #0000ff\">Parameter userid is now &#8216;username&#8217;.<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;test:linux-pc&gt;<\/span> <span style=\"color: #ff0000\">set auth password=password<\/span><br \/><span style=\"color: #0000ff\">Parameter password is now &#8216;password&#8217;.<\/span><br \/><span style=\"color: #0000ff\">\/iscsi\/iqn.20&#8230;test:linux-pc&gt;<\/span> <span style=\"color: #ff0000\">exit<\/span><br \/><span style=\"color: #0000ff\">Comparing startup and running configs&#8230;<\/span><br \/><span style=\"color: #0000ff\">Some changes need saving.<\/span><br \/><span style=\"color: #0000ff\">Save configuration? [Y\/n]:<\/span> <span style=\"color: #ff0000\">y<\/span><br \/><span style=\"color: #0000ff\">Saving new startup configuration<\/span><\/p>\n<p>4. \u6aa2\u67e5\u662f\u5426\u6709\u6b63\u5e38\u57f7\u884c<br \/># <span style=\"color: #ff0000\">netstat -antulp | grep :3260<\/span><br \/><span style=\"color: #0000ff\">tcp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0 0.0.0.0:3260\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.0.0.0:*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LISTEN\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;<\/span><\/p>\n<p>5. \u8a2d\u5b9a\u958b\u6a5f\u555f\u52d5<br \/># <span style=\"color: #ff0000\">systemctl enable target.service<\/span><br \/><span style=\"color: #0000ff\">target.service is not a native service, redirecting to systemd-sysv-install<\/span><br \/><span style=\"color: #0000ff\">Executing \/lib\/systemd\/systemd-sysv-install enable target<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u7db2\u7ad9\uff1aUbuntu 16.04 LTS : iSCSI Taregt(iscsitarget) : Ser &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/08\/24\/ubuntu-16-04-lts-%e5%ae%89%e8%a3%9d-iscsi-taregt-targetcli\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Ubuntu 16.04 LTS \u5b89\u88dd iSCSI Taregt &#8211; targetcli\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187,119],"tags":[],"class_list":["post-19679","post","type-post","status-publish","format-standard","hentry","category-c-105646","category-c-78464"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["690844"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19679"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19679"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19679\/revisions"}],"predecessor-version":[{"id":21175,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19679\/revisions\/21175"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}