{"id":42474,"date":"2024-10-03T14:36:40","date_gmt":"2024-10-03T06:36:40","guid":{"rendered":"https:\/\/server.hk\/cnblog\/42474\/"},"modified":"2024-10-03T14:36:40","modified_gmt":"2024-10-03T06:36:40","slug":"centos-6-5-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2-iscsi-%e5%85%b1%e4%ba%ab%e5%ad%98%e5%84%b2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/42474\/","title":{"rendered":"CentOS 6.5 \u5b89\u88dd\u90e8\u7f72 iSCSI \u5171\u4eab\u5b58\u5132"},"content":{"rendered":"<h1 id=\"centos-6-5-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2-iscsi-%e5%85%b1%e4%ba%ab%e5%ad%98%e5%84%b2-ZXKZkmiElo\">CentOS 6.5 \u5b89\u88dd\u90e8\u7f72 iSCSI \u5171\u4eab\u5b58\u5132<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u4e2d\u5fc3\u74b0\u5883\u4e2d\uff0ciSCSI\uff08Internet Small Computer Systems Interface\uff09\u662f\u4e00\u7a2e\u6d41\u884c\u7684\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u80fd\u5920\u901a\u904e\u7db2\u7d61\u5c07\u5b58\u5132\u8a2d\u5099\u9023\u63a5\u5230\u4f3a\u670d\u5668\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 6.5 \u4e0a\u5b89\u88dd\u548c\u90e8\u7f72 iSCSI \u5171\u4eab\u5b58\u5132\uff0c\u5e6b\u52a9\u7528\u6236\u6709\u6548\u5730\u7ba1\u7406\u548c\u5229\u7528\u5b58\u5132\u8cc7\u6e90\u3002<\/p>\n<h2 id=\"iscsi-%e7%b0%a1%e4%bb%8b-ZXKZkmiElo\">iSCSI \u7c21\u4ecb<\/h2>\n<p>iSCSI \u662f\u4e00\u7a2e\u57fa\u65bc IP \u7684\u5b58\u5132\u7db2\u7d61\u5354\u8b70\uff0c\u5141\u8a31\u7528\u6236\u901a\u904e TCP\/IP \u7db2\u7d61\u4f86\u50b3\u8f38 SCSI \u547d\u4ee4\u3002\u9019\u4f7f\u5f97\u7528\u6236\u80fd\u5920\u5728\u4e0d\u540c\u7684\u4f3a\u670d\u5668\u4e4b\u9593\u5171\u4eab\u5b58\u5132\u8cc7\u6e90\uff0c\u4e26\u4e14\u53ef\u4ee5\u5728\u4e0d\u9700\u8981\u5c08\u7528\u5b58\u5132\u7db2\u7d61\u7684\u60c5\u6cc1\u4e0b\uff0c\u5229\u7528\u73fe\u6709\u7684\u7db2\u7d61\u57fa\u790e\u8a2d\u65bd\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-iscsi-%e7%9b%ae%e6%a8%99-ZXKZkmiElo\">\u5b89\u88dd iSCSI \u76ee\u6a19<\/h2>\n<p>\u5728 CentOS 6.5 \u4e0a\u5b89\u88dd iSCSI \u76ee\u6a19\u9700\u8981\u4ee5\u4e0b\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e8%bb%9f%e4%bb%b6%e5%8c%85-ZXKZkmiElo\">1. \u5b89\u88dd\u5fc5\u8981\u7684\u8edf\u4ef6\u5305<\/h3>\n<pre><code>sudo yum install targetcli<\/code><\/pre>\n<p>\u9019\u500b\u547d\u4ee4\u5c07\u5b89\u88dd iSCSI \u76ee\u6a19\u6240\u9700\u7684\u8edf\u4ef6\u5305\u3002<\/p>\n<h3 id=\"2-%e9%85%8d%e7%bd%ae-iscsi-%e7%9b%ae%e6%a8%99-ZXKZkmiElo\">2. \u914d\u7f6e iSCSI \u76ee\u6a19<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5 targetcli\uff1a<\/p>\n<pre><code>sudo targetcli<\/code><\/pre>\n<p>\u5728 targetcli \u754c\u9762\u4e2d\uff0c\u60a8\u53ef\u4ee5\u5275\u5efa\u4e00\u500b\u65b0\u7684 iSCSI \u76ee\u6a19\u3002\u4ee5\u4e0b\u662f\u5275\u5efa\u76ee\u6a19\u7684\u6b65\u9a5f\uff1a<\/p>\n<pre><code>\/&gt; backstores\/block create name=mydisk dev=\/dev\/sdb<\/code><\/pre>\n<pre><code>\/&gt; iscsi\/ create iqn.2023-10.com.example:mytarget<\/code><\/pre>\n<pre><code>\/&gt; iscsi\/iqn.2023-10.com.example:mytarget\/tpg1\/luns\/ create \/backstores\/block\/mydisk<\/code><\/pre>\n<pre><code>\/&gt; iscsi\/iqn.2023-10.com.example:mytarget\/tpg1\/acls\/ create iqn.2023-10.com.example:client<\/code><\/pre>\n<p>\u9019\u4e9b\u547d\u4ee4\u5c07\u5275\u5efa\u4e00\u500b\u540d\u70ba mydisk \u7684 iSCSI \u76ee\u6a19\uff0c\u4e26\u5141\u8a31\u4f86\u81ea iqn.2023-10.com.example:client \u7684\u8a2a\u554f\u3002<\/p>\n<h3 id=\"3-%e5%95%9f%e5%8b%95-iscsi-%e6%9c%8d%e5%8b%99-ZXKZkmiElo\">3. \u555f\u52d5 iSCSI \u670d\u52d9<\/h3>\n<p>\u5b8c\u6210\u914d\u7f6e\u5f8c\uff0c\u60a8\u9700\u8981\u555f\u52d5 iSCSI \u670d\u52d9\uff1a<\/p>\n<pre><code>sudo service target start<\/code><\/pre>\n<p>\u4e26\u8a2d\u7f6e\u5176\u5728\u555f\u52d5\u6642\u81ea\u52d5\u904b\u884c\uff1a<\/p>\n<pre><code>sudo chkconfig target on<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-iscsi-%e7%99%bc%e8%b5%b7%e5%99%a8-ZXKZkmiElo\">\u5b89\u88dd iSCSI \u767c\u8d77\u5668<\/h2>\n<p>\u5728\u5ba2\u6236\u7aef\u4f3a\u670d\u5668\u4e0a\uff0c\u60a8\u9700\u8981\u5b89\u88dd iSCSI \u767c\u8d77\u5668\u4ee5\u9023\u63a5\u5230 iSCSI \u76ee\u6a19\uff1a<\/p>\n<pre><code>sudo yum install iscsi-initiator-utils<\/code><\/pre>\n<h3 id=\"1-%e9%85%8d%e7%bd%ae-iscsi-%e7%99%bc%e8%b5%b7%e5%99%a8-ZXKZkmiElo\">1. \u914d\u7f6e iSCSI \u767c\u8d77\u5668<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u7de8\u8f2f \/etc\/iscsi\/initiatorname.iscsi \u6587\u4ef6\uff0c\u8a2d\u7f6e\u767c\u8d77\u5668\u540d\u7a31\uff1a<\/p>\n<pre><code>InitiatorName=iqn.2023-10.com.example:client<\/code><\/pre>\n<h3 id=\"2-%e9%80%a3%e6%8e%a5%e5%88%b0-iscsi-%e7%9b%ae%e6%a8%99-ZXKZkmiElo\">2. \u9023\u63a5\u5230 iSCSI \u76ee\u6a19<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767c\u73fe iSCSI \u76ee\u6a19\uff1a<\/p>\n<pre><code>sudo iscsiadm -m discovery -t sendtargets -p <i>target_ip<\/i><\/code><\/pre>\n<p>\u7136\u5f8c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u9304\u5230\u76ee\u6a19\uff1a<\/p>\n<pre><code>sudo iscsiadm -m node --login<\/code><\/pre>\n<h2 id=\"%e6%aa%a2%e6%9f%a5-iscsi-%e9%80%a3%e6%8e%a5-ZXKZkmiElo\">\u6aa2\u67e5 iSCSI \u9023\u63a5<\/h2>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5 iSCSI \u9023\u63a5\u72c0\u614b\uff1a<\/p>\n<pre><code>sudo iscsiadm -m session<\/code><\/pre>\n<p>\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u770b\u5230\u5df2\u9023\u63a5\u7684 iSCSI \u76ee\u6a19\u3002<\/p>\n<h2 id=\"%e6%a0%bc%e5%bc%8f%e5%8c%96%e5%92%8c%e6%8e%9b%e8%bc%89-iscsi-%e5%ad%98%e5%84%b2-ZXKZkmiElo\">\u683c\u5f0f\u5316\u548c\u639b\u8f09 iSCSI \u5b58\u5132<\/h2>\n<p>\u6700\u5f8c\uff0c\u60a8\u9700\u8981\u683c\u5f0f\u5316 iSCSI \u5b58\u5132\u4e26\u5c07\u5176\u639b\u8f09\u5230\u6587\u4ef6\u7cfb\u7d71\u4e2d\uff1a<\/p>\n<pre><code>sudo mkfs.ext4 \/dev\/sdb<\/code><\/pre>\n<p>\u7136\u5f8c\u5275\u5efa\u4e00\u500b\u639b\u8f09\u9ede\u4e26\u639b\u8f09\u5b58\u5132\uff1a<\/p>\n<pre><code>sudo mkdir \/mnt\/iscsi<\/code><\/pre>\n<pre><code>sudo mount \/dev\/sdb \/mnt\/iscsi<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ZXKZkmiElo\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u5df2\u6210\u529f\u5728 CentOS 6.5 \u4e0a\u5b89\u88dd\u548c\u90e8\u7f72 iSCSI \u5171\u4eab\u5b58\u5132\u3002\u9019\u7a2e\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\u4e0d\u50c5\u80fd\u5920\u63d0\u9ad8\u5b58\u5132\u7684\u9748\u6d3b\u6027\uff0c\u9084\u80fd\u5920\u6709\u6548\u5730\u5229\u7528\u73fe\u6709\u7684\u7db2\u7d61\u8cc7\u6e90\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u5b58\u5132\u7ba1\u7406\u7684\u7528\u6236\u4f86\u8aaa\uff0ciSCSI \u662f\u4e00\u500b\u7406\u60f3\u7684\u9078\u64c7\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u6216\u5176\u4ed6\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\u6709\u8208\u8da3\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install and deploy iSCSI shared storage on CentOS 6.5 for efficient data management and enhanced network storage solutions.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-42474","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=42474"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42474\/revisions"}],"predecessor-version":[{"id":42475,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/42474\/revisions\/42475"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=42474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=42474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=42474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}