{"id":660,"date":"2012-05-04T00:31:15","date_gmt":"2012-05-04T00:31:15","guid":{"rendered":"http:\/\/kraftek.com\/blog\/?p=660"},"modified":"2012-05-04T00:31:15","modified_gmt":"2012-05-04T00:31:15","slug":"generate-a-multipath-conf-from-a-multipath-l-output","status":"publish","type":"post","link":"\/blog\/index.php\/generate-a-multipath-conf-from-a-multipath-l-output\/","title":{"rendered":"Generate a multipath.conf from a multipath -l output"},"content":{"rendered":"<p>If you do not have configured multipath.conf, but youjust have<br \/>\nthe module enabled and no lun blacklisted you can use<br \/>\nthis script to generate a multipath.conf:<\/p>\n<p>#!\/bin\/ksh<br \/>\necho &#8220;multipaths {&#8221;<br \/>\nx=0<br \/>\nmultipath -l |egrep &#8216;3600|size&#8217; |gawk &#8216;ORS=NR%2?&#8221;&#8221;:&#8221;n&#8221;&#8216; | awk<br \/>\n&#8216;{ print $1 $2 }&#8217; | sed &#8216;s\/[size=\/ \/g&#8217; | while read<br \/>\nl;do<br \/>\nW=`echo $l |awk &#8216;{ print $1 }&#8217;`<br \/>\nS=`echo $l |awk &#8216;{ print $2 }&#8217;`<br \/>\necho &#8221; multipath {&#8221;<br \/>\necho &#8221; wwid $W&#8221;<br \/>\necho &#8221; alias disk${x}_${S}Gb&#8221;<br \/>\necho &#8221; path_grouping_policy failover&#8221;<br \/>\necho &#8221; path_checker readsector0&#8243;<br \/>\necho &#8221; path_selector &#8220;round-robin0&#8243;&#8221;<\/p>\n<p>echo &#8221; failback immediate&#8221;<br \/>\necho &#8221; }&#8221;<br \/>\nx=`echo &#8220;$x + 1&#8243;|bc`<br \/>\ndone<br \/>\necho &#8220;}&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you do not have configured multipath.conf, but youjust have the module enabled and no lun blacklisted you can use this script to generate a multipath.conf: #!\/bin\/ksh echo &#8220;multipaths {&#8221; x=0 multipath -l |egrep &#8216;3600|size&#8217; |gawk &#8216;ORS=NR%2?&#8221;&#8221;:&#8221;n&#8221;&#8216; | awk &#8216;{ print $1 $2 }&#8217; | sed &#8216;s\/[size=\/ \/g&#8217; | while read l;do W=`echo $l |awk [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-660","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=660"}],"version-history":[{"count":0,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/posts\/660\/revisions"}],"wp:attachment":[{"href":"\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=660"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}