<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GEOM | 徒然なるままに</title>
	<atom:link href="https://www.seichan.org/tag/geom/feed" rel="self" type="application/rss+xml" />
	<link>https://www.seichan.org</link>
	<description>徒然と日々の出来事(ネタ)を書いていこうかと．主に FreeBSD，Unix系の話題が中心ですが，その他の話題もあつかってみたり．</description>
	<lastBuildDate>Sun, 24 Mar 2024 00:43:02 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>GEOM MULTIPATH でマルチパスを構成する (2)</title>
		<link>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html</link>
					<comments>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Fri, 15 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[GEOM]]></category>
		<category><![CDATA[iSCSI]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=1048</guid>

					<description><![CDATA[GEOM MULTIPATH は，ストレージ IO を複数のインターフェイスで冗長させることができるものです． 前回は「GEOM MULTIPATH でマルチパスを構成する (1)」で iSCSI ターゲットおよびイニシ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">GEOM MULTIPATH は，ストレージ IO を複数のインターフェイスで冗長させることができるものです．</p>



<p class="wp-block-paragraph">前回は「GEOM MULTIPATH でマルチパスを構成する (1)」で iSCSI ターゲットおよびイニシエーターのマルチパスに向けた設定追加を解説しました．</p>



<p class="wp-block-paragraph">今回は GEOM MULTIPATH について纏めます．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">FreeBSD で Multipath を構成する</a><ol><li><a href="#toc2" tabindex="0">マルチパスでディスクを束ねる</a></li><li><a href="#toc3" tabindex="0">マルチパスのモードを変更する</a></li><li><a href="#toc4" tabindex="0">マルチパスの Active / Passive を切り替える</a></li><li><a href="#toc5" tabindex="0">マルチパスを停止する</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">FreeBSD で Multipath を構成する</span></h2>



<p class="wp-block-paragraph">前回，ターゲットおよびイニシエーターの設定を行い以下のとおりでディスクが見えている状態となっています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># iscsictl -L
Target name                          Target portal    State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254   Connected: da4 da5
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254   Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254   Connected: da2
iqn.2023-12.iscsi.org.seichan:target0 172.17.255.254   Connected: da7 da9
iqn.2023-12.iscsi.org.seichan:target1 172.17.255.254   Connected: da8
iqn.2023-12.iscsi.org.seichan:target2 172.17.255.254   Connected: da6
</pre>



<p class="wp-block-paragraph">これらディスクはペア (同じデバイスを指している) の組み合わせと GEOM MULTIPATH で束ねた際の名前を表にまとめます．</p>



<figure class="wp-block-table"><table><tbody><tr><td>GEOM MULTIPATH名</td><td>iSCSI1上のデバイス</td><td>iSCSI2上のデバイス</td></tr><tr><td>target0_0</td><td>da4</td><td>da7</td></tr><tr><td>target0_1</td><td>da5</td><td>da9</td></tr><tr><td>target1_0</td><td>da3</td><td>da8</td></tr><tr><td>target2_0</td><td>da2</td><td>da6</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">GEOM  MULTIPATH は gmultipath というコマンドを通じて利用・管理を行います．簡単に触れますが，詳細はコマンドのオプションの詳細は FreeBSD の マニュアル「<a rel="noopener" href="http://www.koganemaru.co.jp/cgi-bin/mroff.cgi?subdir=man&amp;lc=1&amp;cmd=&amp;man=gmultipath&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">gmultipath</a>」を見てください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath
usage: gmultipath create [-vAR] name prov ...
       gmultipath label [-vAR] name prov ...
       gmultipath configure [-vAPR] name
       gmultipath add [-v] name prov
       gmultipath remove [-v] name prov
       gmultipath prefer [-v] prov ...
       gmultipath fail [-v] name prov
       gmultipath restore [-v] name prov
       gmultipath rotate [-v] name
       gmultipath getactive [-v] name
       gmultipath destroy [-v] name
       gmultipath stop [-v] name
       gmultipath clear [-v] prov ...
       gmultipath help
       gmultipath list [-a] [name ...]
       gmultipath status [-ags] [name ...]
       gmultipath load [-v]
       gmultipath unload [-v]</pre>



<h3 class="wp-block-heading"><span id="toc2">マルチパスでディスクを束ねる</span></h3>



<p class="wp-block-paragraph">まずは毎度のことながらカーネルモジュールをロードします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># kldload geom_multipath

# kldstat
Id Refs Address                Size Name
 1   18 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff8213f000     9290 geom_gate.ko
 3    1 0xffffffff82319000     3218 intpm.ko
 4    1 0xffffffff8231d000     2180 smbus.ko
 5    1 0xffffffff82320000     7490 vmci.ko
 6    1 0xffffffff82328000     f0ac iscsi.ko
 7    1 0xffffffff82338000     589c geom_multipath.ko</pre>



<p class="wp-block-paragraph">また，再起動後に備えて /boot/loader.conf にも記載します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /boot/loader.conf
geom_multipath_load="YES"</pre>



<p class="wp-block-paragraph">gmultipath label コマンドでディスクを束ねることが可能です．オプションとして -A と -R が指定可能で，指定しない場合は -P が使用されるとマニュアルにはあります．</p>



<ul class="wp-block-list">
<li>-A<br>Active / Active でアクティブなパスを全て使い IO を処理する。帯域がパスの数分ある状態。</li>



<li>-R<br>Active / Readonly で通常はアクティブなパスを用いて IO 処理を行う。アクティブパスが切れたら RO として読み取りだけ可能な状態。(これを使うケースはないのでは&#8230;)</li>



<li>-P<br>Active / Passive で通常はアクティブなパスを用いて IO 処理を行う。アクティブパスが切れたらもう一方のパスを利用して IO 処理を行う。</li>
</ul>



<p class="wp-block-paragraph">通常は Active / Active か Active / Passive を利用する事になると思います．da4 と da7 を Active / Active で target0_0 として束ねる場合のコマンドは次のとおりとなります。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath label -A target0_0 da4 da7</pre>



<p class="wp-block-paragraph">エラーが出なければ成功しています．gmultipath list コマンドで状態を確認してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Active
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   State: OPTIMAL
Consumers:
1. Name: da4
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
2. Name: da7
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE</pre>



<p class="wp-block-paragraph">プロバイダーが target0_0，コンシューマーが da4 と da7 であるということ，モードが Active/Active であることが確認できました．</p>



<p class="wp-block-paragraph">このデバイスをフォーマットしてマウント，利用をしてみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># newfs /dev/multipath/target0_0
/dev/multipath/target0_0: 102400.0MB (209715192 sectors) block size 32768, fragment size 4096
        using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,

# mount /dev/multipath/target0_0 /mnt</pre>



<p class="wp-block-paragraph">読み書きは普通にできるとして，マルチパスで Active / Active として iSCSI トラフィックが分散されているのかを確認してみたいと思います．<br>dd を用いて img_X.img ファイルを生成するスクリプトを実行したうえで前後の netstat の結果を見てみました．<br>vmx1 および vmx2 のカウンターが上がっているため，両方のインターフェイスが利用されている状態が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   188843     0     0   20397284   184083     0   29538342     0
vmx1      - 172.16.255.0/ 172.16.255.1        188298     -     -   17728412   191281     -   26959584     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   185433     0     0   18967600   182735     0   24141602     0
vmx2      - 172.17.255.0/ 172.17.255.1        184892     -     -   16346652   186394     -   21581828     -


# ls /mnt
.snap           img_11.img      img_15.img      img_19.img      img_22.img      img_6.img
img_0.img       img_12.img      img_16.img      img_2.img       img_3.img       img_7.img
img_1.img       img_13.img      img_17.img      img_20.img      img_4.img       img_8.img
img_10.img      img_14.img      img_18.img      img_21.img      img_5.img       img_9.img


# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   227611     0     0   22982526   187352     0  139989136     0
vmx1      - 172.16.255.0/ 172.16.255.1        227065     -     -   19770856   267128     -  137364612     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   223336     0     0   21524808   186269     0  132049886     0
vmx2      - 172.17.255.0/ 172.17.255.1        222794     -     -   18373172   260514     -  129440636     -</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h3 class="wp-block-heading"><span id="toc3">マルチパスのモードを変更する</span></h3>



<p class="wp-block-paragraph">先ほどは Active / Active でマルチパスを構成していましたが，これを Active / Passive に変更してみます．</p>



<p class="wp-block-paragraph">gmultipath configure コマンドでモードの変更が可能です．指定できるオプションは label と変わりません．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath configure -P target0_0

# gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Passive
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: OPTIMAL
Consumers:
1. Name: da4
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r2w2e2
   State: ACTIVE
2. Name: da7
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r2w2e2
   State: PASSIVE</pre>



<p class="wp-block-paragraph">この状態で改めて dd のスクリプトを実行した前後の netstat の結果を確認します．<br>vmx1 のカウンターが上がっているため，vmx1 (Active 側) インターフェイスが利用されている状態が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   233417     0     0   23392392   189912     0  154641112     0
vmx1      - 172.16.255.0/ 172.16.255.1        232868     -     -   20099300   277873     -  151980720     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   224383     0     0   21619428   187169     0  132892558     0
vmx2      - 172.17.255.0/ 172.17.255.1        223838     -     -   18452996   261812     -  130270680     -

# ls /mnt
.snap           img_12.img      img_17.img      img_21.img      img_26.img      img_30.img      img_6.img
img_0.img       img_13.img      img_18.img      img_22.img      img_27.img      img_31.img      img_7.img
img_1.img       img_14.img      img_19.img      img_23.img      img_28.img      img_32.img      img_8.img
img_10.img      img_15.img      img_2.img       img_24.img      img_29.img      img_4.img       img_9.img
img_11.img      img_16.img      img_20.img      img_25.img      img_3.img       img_5.img

# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   343298     0     0   30681114   197348     0  469842448     0
vmx1      - 172.16.255.0/ 172.16.255.1        342749     -     -   25849688   493649     -  467077952     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   224464     0     0   21627366   187250     0  132900496     0
vmx2      - 172.17.255.0/ 172.17.255.1        223919     -     -   18459800   261893     -  130277484     -</pre>



<h3 class="wp-block-heading"><span id="toc4">マルチパスの Active / Passive を切り替える</span></h3>



<p class="wp-block-paragraph">マルチパスで Active / Passive 構成をとろうとした際，複数のデバイス毎にアクティブインターフェイスを変えたい．という場合があると思います．<br>そんな場合に label でデバイスの指定順番で制御する事ができますが，後ほどでもアクティブパスを変更することが可能です．</p>



<p class="wp-block-paragraph">パスの変更には gmultipath prefer コマンドを利用します．gmultipath getactive コマンドと共に設定および前後の確認を行ってみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath getactive target0_0
da4

# gmultipath prefer target0_0 da7

# gmultipath getactive target0_0
da7</pre>



<p class="wp-block-paragraph">rotate コマンド実行前は da4 がアクティブパスでした．rotate 後は da7 がアクティブパスに変更されていますので，パスが切り替わった事が確認できます．</p>



<p class="wp-block-paragraph">では先ほどと同様に，dd コマンドを用いたトラフィックの状況を確認してみます．<br>vmx2 のカウンターが上がっているため，実際の動作としても vmx2 がアクティブに変更されている状態が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   352195     0     0   31310250   200892     0  492213664     0
vmx1      - 172.16.255.0/ 172.16.255.1        351643     -     -   26354128   510042     -  489399552     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   225633     0     0   21741846   188412     0  133014532     0
vmx2      - 172.17.255.0/ 172.17.255.1        225085     -     -   18557776   263055     -  130375252     -

# ls /mnt
.snap           img_13.img      img_19.img      img_24.img      img_3.img       img_4.img
img_0.img       img_14.img      img_2.img       img_25.img      img_30.img      img_5.img
img_1.img       img_15.img      img_20.img      img_26.img      img_31.img      img_6.img
img_10.img      img_16.img      img_21.img      img_27.img      img_32.img      img_7.img
img_11.img      img_17.img      img_22.img      img_28.img      img_33.img      img_8.img
img_12.img      img_18.img      img_23.img      img_29.img      img_34.img      img_9.img

# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 &lt;Link#2>      00:50:56:8d:e4:3c   352262     0     0   31316970   200964     0  492220720     0
vmx1      - 172.16.255.0/ 172.16.255.1        351709     -     -   26359864   510114     -  489405600     -
vmx2   1500 &lt;Link#3>      00:50:56:8d:e6:8c   343203     0     0   29539716   196342     0  470304936     0
vmx2      - 172.17.255.0/ 172.17.255.1        342654     -     -   24709620   493956     -  467554636     -
</pre>



<p class="wp-block-paragraph">prefer は明示的にアクティブにするパス(デバイス) を指定しましたが，二つのパスの場合は gmultipath rotate でも十分に利用可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath rotate target0_0

# gmultipath getactive target0_0
da4</pre>



<h3 class="wp-block-heading"><span id="toc5">マルチパスを停止する</span></h3>



<p class="wp-block-paragraph">マルチパスを停止したい場合 gmultipath destroy コマンドを利用してマルチパスの解除，メタデータの削除ができます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmultipath destroy target0_0

# gmultipath status
               Name   Status  Components
multipath/target1_0  OPTIMAL  da2 (ACTIVE)
                              da7 (ACTIVE)
multipath/target2_0  OPTIMAL  da3 (ACTIVE)
                              da5 (ACTIVE)
multipath/target0_1  OPTIMAL  da6 (ACTIVE)
                              da9 (ACTIVE)</pre>



<p class="wp-block-paragraph">他にも，一時的なパスの停止なども gmultipath コマンドで実施可能ですが，フェイルオーバーしてくれますし明示的にやるケースは少ないと思いますので紹介からは省いています．</p>



<p class="wp-block-paragraph">以上 GEOM MULTIPATH の解説でした．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM MULTIPATH でマルチパスを構成する (1)</title>
		<link>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html</link>
					<comments>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Thu, 14 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[GEOM]]></category>
		<category><![CDATA[iSCSI]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=1044</guid>

					<description><![CDATA[GEOM MULTIPATH は，ストレージ IO を複数のインターフェイスで冗長させることができるものです． iSCSI 環境を用いて，GEOM MULTIPATH によるマルチパスアクセスを構成してみます．長くなるの [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">GEOM MULTIPATH は，ストレージ IO を複数のインターフェイスで冗長させることができるものです．</p>



<p class="wp-block-paragraph">iSCSI 環境を用いて，GEOM MULTIPATH によるマルチパスアクセスを構成してみます．<br>長くなるので，今回は iSCSI ターゲット / イニシエーター のマルチパスに向けた設定を解説し，GEOM MULTIPATH については次回に纏めます．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-4" checked><label class="toc-title" for="toc-checkbox-4">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">FreeBSD で Multipath なターゲットを設定する</a><ol><li><a href="#toc2" tabindex="0">設定の再読み込み</a></li></ol></li><li><a href="#toc3" tabindex="0">FreeBSD で Multipath なイニシエーターを設定する</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">FreeBSD で Multipath なターゲットを設定する</span></h2>



<p class="wp-block-paragraph">先日の iSCSI ターゲット/イニシエーターは iSCSI 用ネットワークが一つでしたが，二つの iSCSI ネットワークの構成にアップグレードしていきます．<br>イメージとしてはこのようになります．</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img fetchpriority="high" decoding="async" width="546" height="339" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-27-546x339.png" alt="" class="wp-image-1045" style="width:838px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-27-546x339.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-27-300x186.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-27.png 587w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<p class="wp-block-paragraph"><br>まずは，ターゲット (サーバー) 側でマルチパスに向けた設定に修正していきます．<br>修正と言ってもそんなに多くありません．やったこととしては，172.16.255.0/24 が元々あったネットワークです．これに 172.17.255.0/24 のネットワークを足した形となります．<br>各 auth-group および portal-group に 172.17.255.x を足しました．</p>



<p class="wp-block-paragraph">ctl.conf の詳細については「<a href="https://www.seichan.org/2023/12/freebsd-%E3%81%A7-iscsi-%E3%82%92%E5%88%A9%E7%94%A8%E3%81%99%E3%82%8B-%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC-%E3%82%BF%E3%83%BC%E3%82%B2%E3%83%83%E3%83%88%E7%B7%A8.html" target="_blank">FreeBSD で iSCSI を利用する (サーバー/ターゲット編)</a>」を参照ください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /etc/ctl.conf
auth-group ag0 {
  chap-mutual "iscsi-user1" "Password-user1" "mutual-user" "Password-mutual"
  initiator-portal 172.16.255.0/24
  initiator-portal 172.17.255.0/24
}

auth-group ag1 {
  chap "iscsi-user2" "Password-user2"
  initiator-portal 172.16.255.1/24
  initiator-portal 172.17.255.1/24
}

auth-group ag2 {
  auth-type none
  initiator-portal 172.16.255.1/24
  initiator-portal 172.17.255.1/24
}


portal-group pg0 {
  discovery-auth-group no-authentication
  listen 172.16.255.254:3260
  listen 172.17.255.254:3260
}

target iqn.2023-12.iscsi.org.seichan:target0 {
  alias "target0"
  auth-group ag0
  portal-group pg0
  lun 0 {
    path /dev/da1
    option vendor "FreeBSD"
  }
  lun 1 {
    path /mnt/lun1.img
    option vendor "FreeBSD"
    blocksize 4096
    size 10G
  }
}

target iqn.2023-12.iscsi.org.seichan:target1 {
  alias "target1"
  auth-group ag1
  portal-group pg0
  lun 2 {
    path /mnt/lun2.img
    option vendor "FreeBSD"
    blocksize 4096
    size 10G
  }
}

target iqn.2023-12.iscsi.org.seichan:target2 {
  alias "target2"
  auth-group ag2
  portal-group pg0
  lun 3 {
    path /mnt/lun3.img
    option vendor "FreeBSD"
    blocksize 4096
    size 10G
  }
}</pre>



<h3 class="wp-block-heading"><span id="toc2">設定の再読み込み</span></h3>



<p class="wp-block-paragraph">次のコマンドでサービスに新しい設定を通知します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># /etc/rc.d/ctld reload</pre>



<p class="wp-block-paragraph">以上でターゲット側は完了です．続いてイニシエーター側になります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc3">FreeBSD で Multipath なイニシエーターを設定する</span></h2>



<p class="wp-block-paragraph">イニシエーター側のマルチパスに向けた準備も大きな変更はありません．</p>



<p class="wp-block-paragraph">以下が元々の設定ファイルになります．これを修正していきます．<br>設定ファイルの詳細については「<a href="https://www.seichan.org/2023/12/freebsd-%E3%81%A7-iscsi-%E3%82%92%E5%88%A9%E7%94%A8%E3%81%99%E3%82%8B-%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC-%E3%82%BF%E3%83%BC%E3%82%B2%E3%83%83%E3%83%88%E7%B7%A8.html" target="_blank">FreeBSD で iSCSI を利用する (クライアント/イニシエーター編)</a>」を参照してください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /etc/iscsi.conf
iscsi_target0 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target0;
  authmethod = chap;
  chapiname = "iscsi-user1";
  chapsecret = "Password-user1";
  tgtchapname = "mutual-user";
  tgtchapsecret = "Password-mutual";
}

iscsi_target1 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target1;
  authmethod = chap;
  chapiname = "iscsi-user2";
  chapsecret = "Password-user2";
}

iscsi_target2 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target2;
  authmethod = none;
}</pre>



<p class="wp-block-paragraph">どういう名前付けが良いのか悩みましたが，これが一番分かりやすそうだったのでこうしました．<br>各設定を 172.16.255 と 172.17.255 分増やした形となります．iscsi_target0_0 と iscsi_target_0_1 の違いはこのニックネームの部分と targetaddress のみとなります．<br>これをマルチパスを構成するデバイス分増やしていった形となります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /etc/iscsi.conf
iscsi_target0_0 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target0;
  authmethod = chap;
  chapiname = "iscsi-user1";
  chapsecret = "Password-user1";
  tgtchapname = "mutual-user";
  tgtchapsecret = "Password-mutual";
}

iscsi_target0_1 {
  targetaddress = 172.17.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target0;
  authmethod = chap;
  chapiname = "iscsi-user1";
  chapsecret = "Password-user1";
  tgtchapname = "mutual-user";
  tgtchapsecret = "Password-mutual";
}


iscsi_target1_0 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target1;
  authmethod = chap;
  chapiname = "iscsi-user2";
  chapsecret = "Password-user2";
}

iscsi_target1_1 {
  targetaddress = 172.17.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target1;
  authmethod = chap;
  chapiname = "iscsi-user2";
  chapsecret = "Password-user2";
}

iscsi_target2_0 {
  targetaddress = 172.16.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target2;
  authmethod = none;
}

iscsi_target2_1 {
  targetaddress = 172.17.255.254;
  targetname = iqn.2023-12.iscsi.org.seichan:target2;
  authmethod = none;
}</pre>



<p class="wp-block-paragraph">設定ファイルの修正が終わったら iscsictl を再起動します．本来は手動で追加するか，再起動を入れたほうがいいかもしれません．<br>サービスの再起動時，デバイスをマウントしていない事を確認してください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># /etc/rc.d/iscsictl restart
iscsictl not running?
Starting iscsictl.
iscsictl: ISCSISADD: Device busy
iscsictl: ISCSISADD: Device busy
iscsictl: ISCSISADD: Device busy
/etc/rc.d/iscsictl: WARNING: failed to start iscsictl

# iscsictl -L
Target name                          Target portal    State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254   Connected: da4 da5
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254   Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254   Connected: da2
iqn.2023-12.iscsi.org.seichan:target0 172.17.255.254   Connected: da7 da9
iqn.2023-12.iscsi.org.seichan:target1 172.17.255.254   Connected: da8
iqn.2023-12.iscsi.org.seichan:target2 172.17.255.254   Connected: da6
</pre>



<p class="wp-block-paragraph">エラーが出ちゃってますが，iscsictl -L で見ると二つのネットワークから接続できている事が確認できました．<br>これで GEOM MULTIPATH で束ねる準備ができました．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM PART でディスクパーティションの管理を行う</title>
		<link>https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html</link>
					<comments>https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Wed, 13 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=975</guid>

					<description><![CDATA[今回は GEOM PART によるディスクのパーティション管理について解説します．今まで，パーティションを作成せずに newfs してマウントを行っていました．このようにパーティション自体は必須ではありません．用途に応じ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM PART によるディスクのパーティション管理について解説します．<br>今まで，パーティションを作成せずに newfs してマウントを行っていました．このようにパーティション自体は必須ではありません．<br>用途に応じて分割したい．だったり，複数のディスクの容量をパーティション単位で合わせたい．などだったりの際にパーティションによる管理を行います．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-6" checked><label class="toc-title" for="toc-checkbox-6">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">パーティションとは</a><ol><li><a href="#toc2" tabindex="0">パーティションの種別</a><ol><li><a href="#toc3" tabindex="0">MBR</a></li><li><a href="#toc4" tabindex="0">GPT</a></li></ol></li></ol></li><li><a href="#toc5" tabindex="0">gpart によるパーティションの管理</a><ol><li><a href="#toc6" tabindex="0">パーティションスキームを作成する</a><ol><li><a href="#toc7" tabindex="0">MBR パーティションを作成する</a></li><li><a href="#toc8" tabindex="0">GPT パーティションを作成する</a></li></ol></li></ol></li><li><a href="#toc9" tabindex="0">パーティションを作成する</a></li><li><a href="#toc10" tabindex="0">パーティションの修正を行う</a><ol><li><a href="#toc11" tabindex="0">容量を変更する (増やす)</a></li><li><a href="#toc12" tabindex="0">容量を変更する (減らす)</a></li><li><a href="#toc13" tabindex="0">ラベルを付ける・修正する</a></li><li><a href="#toc14" tabindex="0">パーティションタイプを変更する</a></li></ol></li><li><a href="#toc15" tabindex="0">パーティション・スキームを削除する</a><ol><li><a href="#toc16" tabindex="0">パーティションを削除する</a></li><li><a href="#toc17" tabindex="0">スキームを削除する</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">パーティションとは</span></h2>



<p class="wp-block-paragraph">そもそも，コンピューターにおけるパーティションとは何か．を簡単に説明します．</p>



<p class="wp-block-paragraph">現実世界でも部屋の空間を仕切る為にパーティションを用いる事があると思います．これをコンピューター (ディスク) の世界で実現するものがパーティションです．</p>



<p class="wp-block-paragraph">一つのディスクでパーティションが無い場合，OS 領域とデータ領域が混ざった状態になり，データが肥大してディスクが枯渇，OS に影響を及ぼす事があります．<br>これを，パーティションを OS 用 データ用で分割して利用した場合，データ用が枯渇するのみで OS 用はまだ空きがある為システムとしての影響は最小化する事ができます．<br>パーティションの分割はこのようなイメージになります．</p>



<figure class="wp-block-image aligncenter size-full is-resized"><img decoding="async" width="517" height="184" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-24.png" alt="" class="wp-image-976" style="width:836px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-24.png 517w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-24-300x107.png 300w" sizes="(max-width: 517px) 100vw, 517px" /></figure>



<h3 class="wp-block-heading"><span id="toc2">パーティションの種別</span></h3>



<p class="wp-block-paragraph">パーティションには大きく二つあります．(細かくはもっとあります) ここでは主要な二つのパーティションについて解説します</p>



<h4 class="wp-block-heading"><span id="toc3">MBR</span></h4>



<p class="wp-block-paragraph">Master Boot Record の略称で 1983年より利用されている古いパーティションタイプになります．<br>ドライブの一番最初のセクターを MBR というのですが，これを含めてパーティションタイプとして呼ばれています．<br><br>MBR パーティションの構成はこのような形となり，基本パーティションとしては4つです．4つ目が拡張パーティションとして作成されるケースが多く，さらにこの中にパーティションを作成する事が可能です．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd35ae2&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd35ae2" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img decoding="async" width="639" height="442" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-25.png" alt="" class="wp-image-978" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-25.png 639w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-25-300x208.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-25-546x378.png 546w" sizes="(max-width: 639px) 100vw, 639px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">MBR パーティションには次のような特徴があります</p>



<ul class="wp-block-list">
<li>パーティションの作成できる数に制限がある
<ul class="wp-block-list">
<li>基本パーティションは4つまでしか作る事ができない</li>
</ul>
</li>



<li>OS の起動は基本パーティションからのみ実施可能
<ul class="wp-block-list">
<li>拡張パーティションからの起動はできない</li>
</ul>
</li>



<li>MBR で扱えるディスクサイズは 2TB まで
<ul class="wp-block-list">
<li>2TB を超えるディスクを利用する場合は GPT にする必要がある</li>
</ul>
</li>



<li>古くから利用されているため，様々な OS (昔の OS から今の OS) でサポートされている</li>
</ul>



<p class="wp-block-paragraph">2TB 未満のディスクにおいてはいまでも MBR は現役で利用されます．例えば USB メモリーや SD カードなどは MBR での利用が多いのではないでしょうか．</p>



<h4 class="wp-block-heading"><span id="toc4">GPT</span></h4>



<p class="wp-block-paragraph">GUID Partition Table の略称です．ディスクが大容量化してきた事でパーティション自体も 2TB を超えるものが望まれてきており，新しい規格として登場しました．<br>GPT 自体はインテルが提唱した EFI 標準の一部となります．<br>現在の有効な (アクティブな・サポートされている) 利用されている OS は GPT を扱う事ができます．</p>



<p class="wp-block-paragraph">GPT の構成はこのようになっています．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd36753&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd36753" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="594" height="314" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-26.png" alt="" class="wp-image-980" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-26.png 594w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-26-300x159.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-26-546x289.png 546w" sizes="(max-width: 594px) 100vw, 594px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">もう少し説明します．</p>



<ul class="wp-block-list">
<li>保護MBR<br>一番先頭にあるセクターが MBR として構成してあり，MBR しか扱えないシステムに繋いだとしても破損を防ぐ目的で利用されます．<br>ここのレコードには，ディスク全体が一つのパーティションである旨の情報が記載されており，MBR しか利用できないシステムからは1つの大きなパーティションとして見えます．</li>



<li>プライマリー GPT ヘッダー<br>プライマリー GPT ヘッダーは，パーティションエントリーの場所，パーティションテーブル情報，サイズ情報及びチェックサムが記録されます．</li>



<li>パーティションエントリー<br>パーティションエントリーには，パーティションの種別を表す情報，パーティションの開始と終了のアドレスが記録されます．<br>GPT の仕様としては無制限に作成可能なのですが，OS によって制限があります．例えば Windows だと 128 個の制限があります．</li>



<li>バックアップパーティションエントリー<br>パーティションエントリーのバックアップです．先頭にあるパーティションエントリーが破損した場合に個々のエントリーで復元を試みます．</li>



<li>バックアップ GPT ヘッダー<br>GPT ヘッダーのバックアップです．先頭にあるパーティションエントリーが破損した場合に個々のエントリーで復元を試みます．</li>
</ul>



<p class="wp-block-paragraph">GPT パーティションには次のような特徴があります．</p>



<ul class="wp-block-list">
<li>パーティションの作成できる数に制限はない
<ul class="wp-block-list">
<li>OS による制限はあるので，そこは確認が必要</li>
</ul>
</li>



<li>2TB 以上のパーティションを作成できる
<ul class="wp-block-list">
<li>仕様上一つのパーティションで作成できる最大は 8ZB</li>



<li>OS により制限があり，Windows は 18EB となる</li>
</ul>
</li>



<li>古い OS では利用ができない
<ul class="wp-block-list">
<li>互換性の観点で大きな空のパーティションに見える状態となり，破壊されるわけではない</li>
</ul>
</li>
</ul>



<h2 class="wp-block-heading"><span id="toc5">gpart によるパーティションの管理</span></h2>



<p class="wp-block-paragraph">パーティションの説明が終わった所で，gpart によるパーティションの管理 (作成・修正・削除など) の説明に移ります．</p>



<h3 class="wp-block-heading"><span id="toc6">パーティションスキームを作成する</span></h3>



<p class="wp-block-paragraph">MBR なのか GPT なのか，一番最初に決めて作成する必要があります．このパーティションスキームを作成する為のコマンドが gpart create になります．</p>



<h4 class="wp-block-heading"><span id="toc7">MBR パーティションを作成する</span></h4>



<p class="wp-block-paragraph">MBR のパーティションを作成する場合，次のコマンドを実行します．<br>-s mbr で MBR パーティションを作成する．という事になり，作成するデバイスを引数に渡します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart create -s mbr da2
da2 created</pre>



<p class="wp-block-paragraph">エラーが無く，created が表示されたら成功です．実際にどのように出来ているのかは gpart list コマンドで確認が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart list da2
Geom name: da2
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621439
first: 63
entries: 4
scheme: MBR
Consumers:
1. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0</pre>



<p class="wp-block-paragraph">scheme が MBR である事が確認できます．</p>



<h4 class="wp-block-heading"><span id="toc8">GPT パーティションを作成する</span></h4>



<p class="wp-block-paragraph">コマンドは MBR と同様になり，スキームの指定が変わり，-s gpt を指定します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart create -s gpt da3
da3 created</pre>



<p class="wp-block-paragraph">エラーが無く，created が表示されたら成功です．実際にどのように出来ているのかは gpart list コマンドで確認が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart list da3
Geom name: da3
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621434
first: 6
entries: 128
scheme: GPT
Consumers:
1. Name: da3
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc9">パーティションを作成する</span></h2>



<p class="wp-block-paragraph">実際のパーティションを作成していきます．MBR / GPT 問わず基本的には変わりません．</p>



<p class="wp-block-paragraph">以下の二つの例は MBR と GPT のディスクにおいてそれぞれ 5GB のパーティションを作成しています．gpart add がパーティションを作成するコマンドで，続いてパーティションの種別を指定しています．<br><br>da2 で指定しているのは freebsd となります．これは da2 が MBR で作成しているためとなります．<br>da3 では freebsd-ufs と指定しています．これは GPT で作成しているためこの指定が使えます．<br>freebsd-xxx 以外にも指定する事ができます．例えば，fat16 や fat32 なども指定できます．</p>



<p class="wp-block-paragraph">-s はパーティションの容量です．M/G などの単位を含めた指定が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart add -t freebsd -s 5G da2
da2s1 added

# gpart add -t freebsd-ufs -s 5G da3
da3p1 added</pre>



<p class="wp-block-paragraph">また，パーティションにラベル名を付与する事も可能です．残量を全て割り当てるため -s は除外しています．<br>-l でラベルを付与する事ができます．そして，MBR のパーティションにはラベルが付与できません．GPT へは付与ができます．その為 da2 はエラーとなっています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart add -t freebsd -l da2_2nd da2
gpart: Invalid argument

# gpart add -t freebsd-ufs -l da3_2nd da3
da3p2 added</pre>



<p class="wp-block-paragraph">ラベルが付与された da3 の状態を表示してみます．<br>da3p1 の label は null になっており，da3p2 の label が da3_2nd となっています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart list da3
Geom name: da3
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621434
first: 6
entries: 128
scheme: GPT
Providers:
1. Name: da3p1
   Mediasize: 5368709120 (5.0G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,GPT,de8403ac-981d-11ee-967a-0050568da523,0x8,0x140000)
   rawuuid: de8403ac-981d-11ee-967a-0050568da523
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: (null)
   length: 5368709120
   offset: 32768
   type: freebsd-ufs
   index: 1
   end: 1310727
   start: 8
2. Name: da3p2
   Mediasize: 5368643584 (5.0G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(2,GPT,bd0487eb-981f-11ee-967a-0050568da523,0x140008,0x13fff0)
   rawuuid: bd0487eb-981f-11ee-967a-0050568da523
   rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: da3_2nd
   length: 5368643584
   offset: 5368741888
   type: freebsd-ufs
   index: 2
   end: 2621431
   start: 1310728
Consumers:
1. Name: da3
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0</pre>



<p class="wp-block-paragraph">ラベルを付与した場合はラベルでのアクセスが可能です．newfs も mount もラベルに対して行う事が可能です．<br>従って，デバイスの順番が変わったとしてもラベルを用いたパス指定であれば変更の必要がありません．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># ls -l /dev/gpt
total 0
crw-r-----  1 root  operator  0x6f Dec 11 21:20 da3_2nd

# newfs /dev/gpt/da3_2nd
/dev/gpt/da3_2nd: 5119.9MB (10485632 sectors) block size 32768, fragment size 4096
        using 9 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776

# mount /dev/gpt/da3_2nd /mnt</pre>



<h2 class="wp-block-heading"><span id="toc10">パーティションの修正を行う</span></h2>



<p class="wp-block-paragraph">パーティション情報の修正も gpart で行う事が可能です．</p>



<h3 class="wp-block-heading"><span id="toc11">容量を変更する (増やす)</span></h3>



<p class="wp-block-paragraph">今までの流れで da2 は二つ目のパーティション作成に失敗しており，容量が余っている状態です．ですので，一つ目のパーティションを拡張してみたいと思います．<br>パーティションのサイズ変更を行う場合は gpart resize を利用します．</p>



<p class="wp-block-paragraph">オプションの -i はインデックスになります．何番目のパーティションを操作するかを指定します．今回サイズは指定していないためすべての領域を一つ目のパーティションに割り当てた事になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart resize -i 1 da2
da2s1 resized</pre>



<p class="wp-block-paragraph">da2 の状態を見てみましょう．<br>da2s1 の容量が 10G となっており，すべての容量が割り当てられたことが確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart list /dev/da2
Geom name: da2
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621439
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: da2s1
   Mediasize: 10737156096 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,MBR,00000000,0x40,0x27ffc0)
   rawtype: 165
   length: 10737156096
   offset: 262144
   type: freebsd
   index: 1
   end: 2621439
   start: 64
Consumers:
1. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
</pre>



<h3 class="wp-block-heading"><span id="toc12">容量を変更する (減らす)</span></h3>



<p class="wp-block-paragraph">パーティションの容量を減らすことも可能です．<br>先ほど増やした da2 の容量をもとに戻す (5G) とした場合はこのようになります．<br>ただし，ファイルシステムの拡張はできても，縮小はできないため中のデータは無くなる前提になるのを理解してください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart resize -i 1 -s 5G da2
da2s1 resized

# gpart list /dev/da2
Geom name: da2
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621439
first: 63
entries: 4
scheme: MBR
Providers:
1. Name: da2s1
   Mediasize: 5368709120 (5.0G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,MBR,00000000,0x40,0x140000)
   rawtype: 165
   length: 5368709120
   offset: 262144
   type: freebsd
   index: 1
   end: 1310783
   start: 64
Consumers:
1. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0</pre>



<h3 class="wp-block-heading"><span id="toc13">ラベルを付ける・修正する</span></h3>



<p class="wp-block-paragraph">パーティションへのラベル付けができる旨説明をしました．後からラベルの付与，変更が可能ですのでその方法を紹介します．</p>



<p class="wp-block-paragraph">da3p1 はラベルを付けずにパーティションを作成しましたので，これにラベルを付与したいと思います．<br>このような修正は gpart modify コマンドで実施します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart modify -i 1 -l da3_1st da3
da3p1 modified</pre>



<h3 class="wp-block-heading"><span id="toc14">パーティションタイプを変更する</span></h3>



<p class="wp-block-paragraph">パーティションタイプを付けた後，変えたい．という場合にも gpart modify で変更が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart modify -i 1 -t freebsd-zfs da3
da3p1 modified</pre>



<p class="wp-block-paragraph">ラベルを付け，パーティションタイプを変更した da3s1 の結果は次のとおりとなります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart list da3
Geom name: da3
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 2621434
first: 6
entries: 128
scheme: GPT
Providers:
1. Name: da3p1
   Mediasize: 5368709120 (5.0G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r0w0e0
   efimedia: HD(1,GPT,de8403ac-981d-11ee-967a-0050568da523,0x8,0x140000)
   rawuuid: de8403ac-981d-11ee-967a-0050568da523
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: da3_1st
   length: 5368709120
   offset: 32768
   type: freebsd-zfs
   index: 1
   end: 1310727
   start: 8</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc15">パーティション・スキームを削除する</span></h2>



<p class="wp-block-paragraph">スキーム，パーティションを削除する事も gpart で行うことができます．</p>



<h3 class="wp-block-heading"><span id="toc16">パーティションを削除する</span></h3>



<p class="wp-block-paragraph">間違って作成した．最初から作り直したい．などなどの理由でパーティションを削除したい場合は gpart delete で可能です．<br>da3p2 を削除してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart delete -i 2 da3
da3p2 deleted</pre>



<p class="wp-block-paragraph">gpart list ではなく，gpart show で結果を見てみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart show da3
=>      6  2621429  da3  GPT  (10G)
        6        2       - free -  (8.0K)
        8  1310720    1  freebsd-zfs  (5.0G)
  1310728  1310707       - free -  (5.0G)
</pre>



<h3 class="wp-block-heading"><span id="toc17">スキームを削除する</span></h3>



<p class="wp-block-paragraph">スキーム情報を削除する場合は gpart destroy コマンドを利用します．<br>da3 を例にパーティションが残っている状態で実行してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart destroy da3
gpart: Device busy</pre>



<p class="wp-block-paragraph">このように Device busy のエラーとなります．<br>パーティションを全て削除してから再度実行すると次のとおりスキームの削除まで完了できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gpart delete -i 1 da3
da3p1 deleted

# gpart destroy da3
da3 destroyed</pre>



<p class="wp-block-paragraph">以上で GEOM PART についての説明を終わりたいと思います．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM LABEL で名前による管理を行う</title>
		<link>https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html</link>
					<comments>https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Tue, 12 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[iSCSI]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=965</guid>

					<description><![CDATA[今回は GEOM によるデバイスへのラベル付けが可能になる GEOM LABEL について纏めてみたいと思います．ラベル (名前付け) による管理を用いる事で人間が分かりやすくなる．また，デバイス番号が変わった際にも気に [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM によるデバイスへのラベル付けが可能になる GEOM LABEL について纏めてみたいと思います．<br>ラベル (名前付け) による管理を用いる事で人間が分かりやすくなる．また，デバイス番号が変わった際にも気にする必要がなくなるというメリットがあります．<br>例えば，デバイスが追加されたおかげで元々のデバイス番号順が変わってしまった場合，/etc/fstab の修正が必要になったりしますが，これらもラベルを用いた設定にしておく事で修正が必要ない環境にする事ができます．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-8" checked><label class="toc-title" for="toc-checkbox-8">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">ラベル名での管理の利点</a><ol><li><a href="#toc2" tabindex="0">ラベル管理を行わない場合のデメリット</a></li></ol></li><li><a href="#toc3" tabindex="0">ラベルの種類</a></li><li><a href="#toc4" tabindex="0">ラベルを付ける (glabel)</a><ol><li><a href="#toc5" tabindex="0">ラベルを用いてマウントを行う</a></li></ol></li><li><a href="#toc6" tabindex="0">GEOM LABEL を管理する</a><ol><li><a href="#toc7" tabindex="0">ラベルを付ける</a></li><li><a href="#toc8" tabindex="0">ラベルの状態を確認する (status)</a></li><li><a href="#toc9" tabindex="0">ラベルの状態を確認する (list)</a></li></ol></li><li><a href="#toc10" tabindex="0">ラベルを削除する (stop/destroy)</a><ol><li><a href="#toc11" tabindex="0">ラベルを再開する (refresh)</a></li></ol></li><li><a href="#toc12" tabindex="0">ラベルを削除する (clear)</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">ラベル名での管理の利点</span></h2>



<p class="wp-block-paragraph">前書きでも書きましたが，ラベル名による管理のメリットについて以下記載します．</p>



<p class="wp-block-paragraph">ラベルは，デバイス名やパーティション名に名前を付け，マウント時にラベル名を指定したマウントが出来るようになり，デバイス名を意識しなくてもよくなります．自分や自分の環境がそうなのですが，ディスクが何個もあり，RAID を構成するために同じ型番のディスクを何個も接続していたりします．さらに，ディスクを増やしたり減らしたり．なんて事があります．こうなると増減のタイミング等でデバイス名が変わる事になりますので，デバイス名での管理だと難しくなってしまいます．</p>



<p class="wp-block-paragraph">こういったシチュエーションであらかじめラベルとしてディスクに名前を付けてあげれば，以降はラベル名での管理になるのでディスクにラベル名を印刷したテプラを貼っておくことで何かあった際のデバイス特定も容易になります．</p>



<p class="wp-block-paragraph">こういった，デバイス名(番号)の管理から名前での管理に切り替えて少し運用負荷の軽減を狙ってみてはいかがでしょうか．</p>



<h3 class="wp-block-heading"><span id="toc2">ラベル管理を行わない場合のデメリット</span></h3>



<p class="wp-block-paragraph">ラベルによる管理を行わない場合，デバイス番号が変わる事による弊害が生じる．は先に説明した通りです．例として，前回用意した iSCSI イニシエーターのマシンのローカルディスクを1つ増やしたケースでお話します．</p>



<p class="wp-block-paragraph">元々左のような構成になっている環境に，イニシエーター側にディスクを一つ追加した場合となります．</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="546" height="192" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-23-546x192.png" alt="" class="wp-image-966" style="width:840px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-23-546x192.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-23-300x106.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-23-768x270.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-23.png 1054w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<p class="wp-block-paragraph">左の時点ではこのような状態になっています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># iscsictl -L
Target name                          Target portal    State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254   Connected: da2 da4
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254   Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254   Connected: da1

# cat /etc/fstab
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/da0p2      /               ufs     rw      1       1
/dev/da0p3      none            swap    sw      0       0
/dev/da1        /iscsi/da1      ufs     rw,late 1       0

# camcontrol devlist
&lt;NECVMWar VMware IDE CDR00 1.00>   at scbus0 target 0 lun 0 (pass0,cd0)
&lt;VMware Virtual disk 2.0>          at scbus2 target 0 lun 0 (pass1,da0)
&lt;FreeBSD CTLDISK 0001>             at scbus3 target 0 lun 3 (da1,pass2)
&lt;FreeBSD CTLDISK 0001>             at scbus4 target 0 lun 0 (da2,pass3)
&lt;FreeBSD CTLDISK 0001>             at scbus4 target 0 lun 1 (da4,pass5)
&lt;FreeBSD CTLDISK 0001>             at scbus5 target 0 lun 2 (da3,pass4)</pre>



<p class="wp-block-paragraph">このマシンにオンラインのまま1つディスクを追加してみます．<br>そうすると，daX は最後の番号にインクリメントされて生成されます．今回は da5 として認識しました．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">pvscsi0: MSG: device addition at scsi0:1:0
da5 at pvscsi0 bus 0 scbus2 target 1 lun 0
da5: &lt;VMware Virtual disk 2.0> Fixed Direct Access SPC-4 SCSI device
da5: 750.000MB/s transfers
da5: Command Queueing enabled
da5: 102400MB (209715200 512 byte sectors)
da5: quirks=0x140&lt;RETRY_BUSY,STRICT_UNMAP>

# camcontrol devlist
&lt;NECVMWar VMware IDE CDR00 1.00>   at scbus0 target 0 lun 0 (pass0,cd0)
&lt;VMware Virtual disk 2.0>          at scbus2 target 0 lun 0 (pass1,da0)
&lt;VMware Virtual disk 2.0>          at scbus2 target 1 lun 0 (da5,pass6)
&lt;FreeBSD CTLDISK 0001>             at scbus3 target 0 lun 3 (da1,pass2)
&lt;FreeBSD CTLDISK 0001>             at scbus4 target 0 lun 0 (da2,pass3)
&lt;FreeBSD CTLDISK 0001>             at scbus4 target 0 lun 1 (da4,pass5)
&lt;FreeBSD CTLDISK 0001>             at scbus5 target 0 lun 2 (da3,pass4)</pre>



<p class="wp-block-paragraph">この状態で再起動を行ってみるとどうなるか見てみましょう．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd3ddc0&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd3ddc0" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="553" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-15-45_No-00.png" alt="" class="wp-image-968" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-15-45_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-15-45_No-00-300x217.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-15-45_No-00-546x395.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">「<em><strong>/dev/da1: invalied fstype</strong></em>」というエラーが発生しました．一度 fstab の該当行をコメントアウトして起動，状態を見てみましょう．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># iscsictl -L
Target name                          Target portal    State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254   Connected: da4 da5
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254   Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254   Connected: da2

# camcontrol devlist
&lt;NECVMWar VMware IDE CDR00 1.00>   at scbus0 target 0 lun 0 (pass0,cd0)
&lt;VMware Virtual disk 2.0>          at scbus2 target 0 lun 0 (pass1,da0)
&lt;VMware Virtual disk 2.0>          at scbus2 target 1 lun 0 (pass2,da1)
&lt;FreeBSD CTLDISK 0001>             at scbus3 target 0 lun 3 (da2,pass3)
&lt;FreeBSD CTLDISK 0001>             at scbus4 target 0 lun 2 (da3,pass4)
&lt;FreeBSD CTLDISK 0001>             at scbus5 target 0 lun 0 (da4,pass5)
&lt;FreeBSD CTLDISK 0001>             at scbus5 target 0 lun 1 (da5,pass6)</pre>



<p class="wp-block-paragraph">元々 iSCSI デバイスとして見えていた da1 が da2 に変更になっています．<br>そして，追加したディスクが da5 から da1 に変更になりました．</p>



<p class="wp-block-paragraph">デバイス名での管理を行っている場合，こういった番号が変更になってしまう事があり，それに伴い意図しない不具合・障害が発生する事になります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc3">ラベルの種類</span></h2>



<p class="wp-block-paragraph">GEOM LABEL クラスではいくつかのラベルの種類があります．正確にはファイルシステム毎にラベル機構が用意されています．また，これらのファイルシステムに依存せずにラベルを管理する方法もあります．</p>



<p class="wp-block-paragraph">ファイルシステムで用意されているもので FreeBSD でよくつかわれそうなものとして以下が挙げられます．各ファイルシステム毎のディレクトリ以下にラベル名のデバイスファイルが生成されます．</p>



<ul class="wp-block-list">
<li>UFS1/UFS2 のボリューム名 (/dev/ufs)</li>



<li>UFS1/UFS2 のファイルシステムID (/dev/ufsid)</li>



<li>FAT12/16/32 等の MSDOSFS (/dev/msdosfs)</li>



<li>CD-ROM 等の ISO9660 (/dev/iso9660)</li>



<li>NTFS (/dev/ntfs)</li>
</ul>



<p class="wp-block-paragraph">また，GPT パーティションではパーティション単位でもラベルを付与出来ます．</p>



<ul class="wp-block-list">
<li>GPT ラベル&nbsp; (/dev/gpt)</li>



<li>GPT UUID (/dev/gptid)</li>
</ul>



<h2 class="wp-block-heading"><span id="toc4">ラベルを付ける (glabel)</span></h2>



<p class="wp-block-paragraph">glabel はファイルシステムに依存せずにラベルを管理する事が出来ます．ファイルシステムでラベルが用意されていない場合や複数のファイルシステムを扱うため，統一的に管理したい．なんていう場合に有用だと思います．</p>



<p class="wp-block-paragraph">ラベルを付けるには，下のように&nbsp;<em><strong>glabel label [ラベル名] [デバイス名]</strong></em>&nbsp;という引数で実行します．<br><span class="red">サブコマンドが label ではなく create の場合，ディスクにラベル名が書かれませんので再起動時にクリアされてしまいます．試験等の一時的なラベル付与等の場合は create を使いますが，恒久的にラベルを使いたい場合は label サブコマンドを指定してください．</span></p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel label iscsi-lun3 /dev/da2</pre>



<p class="wp-block-paragraph">ラベルが設定されれば，以下のように <strong>status</strong> で確認することが出来ます．この例では今回設定したものだけ表示させています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel status
                                      Name  Status  Components
                    ufsid/6575ba6a5bc67fd7     N/A  da2
                  diskid/DISK-MYSERIAL0003     N/A  da2
                          label/iscsi-lun3     N/A  da2</pre>



<p class="wp-block-paragraph">また，glabel の場合は /dev/label 以下にデバイスファイルが生成されていますので，こちらでも確認が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># ls -l /dev/label
total 0
crw-r-----  1 root  operator  0x71 Dec 11 10:30 iscsi-lun3</pre>



<h3 class="wp-block-heading"><span id="toc5">ラベルを用いてマウントを行う</span></h3>



<p class="wp-block-paragraph">作成したラベルを用いたマウントを試行してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># mount /dev/label/iscsi-lun3 /iscsi/da1

# df
Filesystem            1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2             19279260 3141160 14595760    18%    /
devfs                         1       1        0   100%    /dev
/dev/label/iscsi-lun3  10144028       8  9332500     0%    /iscsi/da1</pre>



<p class="wp-block-paragraph">ラベル名によるデバイスの指定が無事出来ましたので，これを再起動後も動作するように /etc/fstab に反映します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /etc/fstab
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/da0p2      /               ufs     rw      1       1
/dev/da0p3      none            swap    sw      0       0
/dev/label/iscsi-lun3 /iscsi/da1 ufs    rw,late 1       0</pre>



<p class="wp-block-paragraph">再起動後もこの状態で起動するのかを確認します．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd3ec42&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd3ec42" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="553" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-43-28_No-00.png" alt="" class="wp-image-970" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-43-28_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-43-28_No-00-300x217.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-11_10-43-28_No-00-546x395.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">正常に起動しました．また，マウントの状況も以下のとおり正常に行われています．</p>



<h2 class="wp-block-heading"><span id="toc6">GEOM LABEL を管理する</span></h2>



<p class="wp-block-paragraph">glabel のオプション群について以下纏めていきます．<br>実際のオペレーションとしては glabel 単体よりも，gpart を使って．が多いかもしれませんが，自身の備忘録も兼ねて．</p>



<h3 class="wp-block-heading"><span id="toc7">ラベルを付ける</span></h3>



<p class="wp-block-paragraph">上でも書きましたが，ラベルを付与するには&nbsp;<em><strong>glabel label [ラベル名] [デバイス名]</strong></em>&nbsp;という引数で実行します．<br><strong><em>glabel create  [ラベル名] [デバイス名]&nbsp;</em></strong>でも付与は可能ですが一時的なものとなります．<br>指定できるデバイス名は RW なデバイス (HDD,SSD 等) になります．<br><br>以下，未使用の da1 (ローカルディスク) でコマンドを実行，結果を見ていく形とします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel label local-hdd1 da1</pre>



<h3 class="wp-block-heading"><span id="toc8">ラベルの状態を確認する (status)</span></h3>



<p class="wp-block-paragraph">ラベルの状況を確認するコマンドとして <strong>status</strong> と <strong>list</strong> があります．status がサマリーで，list が詳細です．<br><strong>status に渡せるものとしてデバイス名を渡すことができ</strong>，その場合はそのデバイスの情報だけが出力されます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel status
                                      Name  Status  Components
gptid/e49c97b1-8d16-11ee-ad0a-0050568da523     N/A  da0p1
                          label/iscsi-lun3     N/A  da2
                  diskid/DISK-MYSERIAL0002     N/A  da3
                    ufsid/6572f98e0f76158d     N/A  da4
                  diskid/DISK-MYSERIAL0000     N/A  da4
                  diskid/DISK-MYSERIAL0001     N/A  da5
                          label/local-hdd1     N/A  da1

# glabel status da1
            Name  Status  Components
label/local-hdd1     N/A  da1</pre>



<h3 class="wp-block-heading"><span id="toc9">ラベルの状態を確認する (list)</span></h3>



<p class="wp-block-paragraph">ラベルの状況を確認するコマンドとして <strong>status</strong> と <strong>list</strong> があります．status がサマリーで，list が詳細です．<br>list の場合はデバイスの容量やパーティション情報などのディスクの詳細も合わせて表示されます．</p>



<p class="wp-block-paragraph">以下 list の結果ですが，長くなるのでローカルディスクとマウントしている iSCSI ボリュームのみ掲載しています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel list
Geom name: da0p1
Providers:
1. Name: gptid/e49c97b1-8d16-11ee-ad0a-0050568da523
   Mediasize: 524288 (512K)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 1024
   length: 524288
   index: 0
Consumers:
1. Name: da0p1
   Mediasize: 524288 (512K)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0

Geom name: da2
Providers:
1. Name: label/iscsi-lun3
   Mediasize: 10737414144 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r1w1e1
   secoffset: 0
   offset: 0
   seclength: 20971512
   length: 10737414144
   index: 0
Consumers:
1. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 4096
   Stripesize: 32768
   Stripeoffset: 0
   Mode: r1w1e2

Geom name: da1
Providers:
1. Name: label/local-hdd1
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 209715199
   length: 107374181888
   index: 0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0
</pre>



<p class="wp-block-paragraph">オプションとしてデバイス名を付与する事でそのデバイスだけの詳細を表示する事ができます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel list da1
Geom name: da1
Providers:
1. Name: label/local-hdd1
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 209715199
   length: 107374181888
   index: 0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc10">ラベルを削除する (stop/destroy)</span></h2>



<p class="wp-block-paragraph">ラベル情報を一時的に破棄したい場合 <strong>glabel destroy</strong> (または <strong>stop</strong>) コマンドを利用します．<br><span class="red">渡す引数ですが，デバイス名ではなくラベル名である事に注意してください．</span></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel destroy label/local-hdd1

# glabel status
                                      Name  Status  Components
gptid/e49c97b1-8d16-11ee-ad0a-0050568da523     N/A  da0p1
                          label/iscsi-lun3     N/A  da2
                  diskid/DISK-MYSERIAL0002     N/A  da3
                    ufsid/6572f98e0f76158d     N/A  da4
                  diskid/DISK-MYSERIAL0000     N/A  da4
                  diskid/DISK-MYSERIAL0001     N/A  da5</pre>



<p class="wp-block-paragraph">このように status に表示されない状態となります．<br>ただ，destroy / stop はメタデータの削除までは行われませんので復旧する事が可能です．</p>



<h3 class="wp-block-heading"><span id="toc11">ラベルを再開する (refresh)</span></h3>



<p class="wp-block-paragraph">destroy / stop で破棄したラベルを戻したい場合は <strong>glabel refresh</strong> コマンドを利用します．<br><span class="red">この場合はラベル名ではなく，デバイス名である事に注意してください．</span></p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel refresh da1
Metadata from da1 refreshed.

# glabel status
                                      Name  Status  Components
gptid/e49c97b1-8d16-11ee-ad0a-0050568da523     N/A  da0p1
                          label/iscsi-lun3     N/A  da2
                  diskid/DISK-MYSERIAL0002     N/A  da3
                    ufsid/6572f98e0f76158d     N/A  da4
                  diskid/DISK-MYSERIAL0000     N/A  da4
                  diskid/DISK-MYSERIAL0001     N/A  da5
                          label/local-hdd1     N/A  da1</pre>



<h2 class="wp-block-heading"><span id="toc12">ラベルを削除する (clear)</span></h2>



<p class="wp-block-paragraph">destroy / stop は一時的な破棄で，メタデータは維持されると説明しました．メタデータも消去する場合は <strong>glabel clear</strong> を利用します．<br><span class="red">clear の場合，ラベル名ではなくデバイス名となり，複数のラベルを持っている場合はそれらすべてが消去されますのでその点を認識してください．</span></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># glabel clear da1

# glabel status
                                      Name  Status  Components
gptid/e49c97b1-8d16-11ee-ad0a-0050568da523     N/A  da0p1
                          label/iscsi-lun3     N/A  da2
                  diskid/DISK-MYSERIAL0002     N/A  da3
                    ufsid/6572f98e0f76158d     N/A  da4
                  diskid/DISK-MYSERIAL0000     N/A  da4
                  diskid/DISK-MYSERIAL0001     N/A  da5</pre>



<p class="wp-block-paragraph">clear で消去した場合，refresh で戻す事は不可能ですので，ラベルを戻したい/別の名前を付けたい場合は glabel label コマンドで改めてラベルを付与してください．</p>



<p class="wp-block-paragraph">以上で GEOM LABEL についての説明を終わりたいと思います．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM GATE を使ってみる</title>
		<link>https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html</link>
					<comments>https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Sat, 09 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=916</guid>

					<description><![CDATA[今回は GEOM によるネットワーク経由のデバイス共有の仕組みである GATE について纏めてみたいと思います． 目次 GEOM GATE のイメージGEOM の利用 (サーバー側)GEOM の利用 (クライアント側)ハ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>今回は GEOM によるネットワーク経由のデバイス共有の仕組みである GATE について纏めてみたいと思います．</p>


<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-10" checked><label class="toc-title" for="toc-checkbox-10">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM GATE のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM の利用 (サーバー側)</a></li><li><a href="#toc3" tabindex="0">GEOM の利用 (クライアント側)</a><ol><li><a href="#toc4" tabindex="0">ハードディスクをマウントする</a></li><li><a href="#toc5" tabindex="0">サーバー側で確認してみる</a></li></ol></li><li><a href="#toc6" tabindex="0">CD ドライブをマウントする</a></li><li><a href="#toc7" tabindex="0">注意点</a><ol><li><a href="#toc8" tabindex="0">rc.d スクリプトが用意されていない</a></li><li><a href="#toc9" tabindex="0">ネットワークの暗号化はされていない</a></li><li><a href="#toc10" tabindex="0">提供したデバイスを接続できるクライアントは1台のみ</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM GATE のイメージ</span></h2>



<p class="wp-block-paragraph">GATE のイメージはこのような形です．gates が GEOM GATE でデバイスを提供する側 (サーバー) で，gatec が GEOM GATE でデバイスを提供される側 (クライアント) です．<br>サーバーではハードディスクである da1 と CD-ROM ドライブである cd0 を提供し，クライアントがネットワーク経由でマウントする．というイメージになります．</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="546" height="155" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-20-546x155.png" alt="" class="wp-image-919" style="width:839px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-20-546x155.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-20-300x85.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-20-768x217.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-20.png 940w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<h2 class="wp-block-heading"><span id="toc2">GEOM の利用 (サーバー側)</span></h2>



<p class="wp-block-paragraph">前準備として，カーネルモジュールのロードおよびサーバーデーモンの起動が必要になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server # kldload geom_gate.ko

server # kldstat
Id Refs Address                Size Name
 1   11 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff82319000     3218 intpm.ko
 3    1 0xffffffff8231d000     2180 smbus.ko
 4    1 0xffffffff82320000     7490 vmci.ko
 5    1 0xffffffff82328000     4538 geom_gate.ko</pre>



<p class="wp-block-paragraph">再起動後も有効とするために /boot/loader.conf にも記載しましょう．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server # cat /boot/loader.conf
geom_gate_load="YES"</pre>



<p class="wp-block-paragraph">続いて，NFS で利用する /etc/exports のようなファイルを作成する必要があります．ファイルは /etc/gg.exports です．<br>構文も NFS の exports に似ている構文となります．<br>アクセスを許可するクライアント　RW/RO　提供するデバイス</p>



<p class="wp-block-paragraph">上図イメージのとおり，da1 と cd0 を提供する gg.exports は次のとおりです．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">192.168.241.41 RW /dev/da1
192.168.241.41 RO /dev/cd0</pre>



<p class="wp-block-paragraph">gg.exports ファイルの作成が終わったら，ggated デーモンを起動します．rc スクリプトになっていない為手動でプログラムを実行します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server # ggated /etc/gg.exports

ggated /etc/gg.exports
8292  0  S+      0:00.00 grep ggate</pre>



<p class="wp-block-paragraph">以上でサーバー側の準備は完了です．</p>



<h2 class="wp-block-heading"><span id="toc3">GEOM の利用 (クライアント側)</span></h2>



<p class="wp-block-paragraph">クライアント側もサーバーと同様に前準備として，カーネルモジュールのロードおよびサーバーデーモンの起動が必要になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # kldload geom_gate.ko

client # kldstat
Id Refs Address                Size Name
 1   11 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff82319000     3218 intpm.ko
 3    1 0xffffffff8231d000     2180 smbus.ko
 4    1 0xffffffff82320000     7490 vmci.ko
 5    1 0xffffffff82328000     4538 geom_gate.ko</pre>



<p class="wp-block-paragraph">再起動後も有効とするために /boot/loader.conf にも記載しましょう．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # cat /boot/loader.conf
geom_gate_load="YES"</pre>



<h3 class="wp-block-heading"><span id="toc4">ハードディスクをマウントする</span></h3>



<p class="wp-block-paragraph">ggatec コマンドを利用して，サーバーのリソースをつかみます．<br>mount コマンドに似た構文となります．<br>create で GEOM GATE デバイスを生成します<br>-o は RW/RO/WO が指定可能です．<br>サーバーのアドレスおよび提供しているデバイス名を指定します．<br>成功すると ggate[x] というデバイスが作成されます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # ggatec create -o rw 192.168.241.43 /dev/da1
ggate0</pre>



<p class="wp-block-paragraph">ハードディスクを ggate0 というデバイスで接続出来たので，フォーマットしてマウントしてみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # newfs /dev/ggate0
/dev/ggate0: 102400.0MB (209715200 sectors) block size 32768, fragment size 4096
        using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,

client # mount /dev/ggate0 /mnt

client # df
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2   19279260 3140820 14596100    18%    /
devfs               1       1        0   100%    /dev
/dev/ggate0 101561756       8 93436808     0%    /mnt</pre>



<p class="wp-block-paragraph">このように，通常のハードディスクと同様に扱う事が可能です．<br>実際にデータを置いてみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # dd if=/dev/random of=/mnt/random.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.699479 secs (110700980 bytes/sec)

client # ls -l /mnt
total 1048868
drwxrwxr-x  2 root  operator         512 Dec  8 20:10 .snap
-rw-r--r--  1 root  wheel     1073741824 Dec  8 20:12 random.img</pre>



<p class="wp-block-paragraph">これをアンマウントし，サーバー側でディスクをマウントしてみて実際にデータが置かれているのか確認してみましょう．<br>まずはクライアント側でアンマウントし，そして ggate0 デバイスを削除します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # umount /mnt

client # ggatec destroy -u 0</pre>



<h3 class="wp-block-heading"><span id="toc5">サーバー側で確認してみる</span></h3>



<p class="wp-block-paragraph">サーバー側でも ggated を止めた方がいいのですが，掴まれていない場合は止めなくても扱えます．</p>



<p class="wp-block-paragraph">このように，クライアント側で読み書きしたデータが確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">server # mount /dev/da1 /mnt

server # ls -l /mnt
total 1048868
drwxrwxr-x  2 root  operator         512 Dec  8 20:10 .snap
-rw-r--r--  1 root  wheel     1073741824 Dec  8 20:12 random.img

server # umount /mnt</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc6">CD ドライブをマウントする</span></h2>



<p class="wp-block-paragraph">クライアントにて /dev/cd0 を指定して ggatec コマンドを実行します．<br>(イメージと合わせる為ハードディスクは再度マウントしています)</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # ggatec create -o rw 192.168.241.43 /dev/da1
ggate0

client # ggatec create -o ro 192.168.241.43 /dev/cd0
ggate1</pre>



<p class="wp-block-paragraph">ggate1 が CD ドライブとなりますので，これをマウントしてみます．<br>サーバー側の CD ドライブには，FreeBSD のインストーラーをセット済みでした．ls で見てみるとメディアの内容が表示されており，CD ドライブとしての利用が可能であることがわかります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">client # mount_cd9660 /dev/ggate1 /mnt

client # ls -l /mnt
total 92
-rw-r--r--   2 root  wheel   1023 Apr  7  2023 .cshrc
-rw-r--r--   2 root  wheel    507 Apr  7  2023 .profile
drwxr-xr-x   3 root  wheel   2048 Apr  7  2023 .rr_moved
-r--r--r--   1 root  wheel   6109 Apr  7  2023 COPYRIGHT
drwxr-xr-x   2 root  wheel   6144 Apr  7  2023 bin
drwxr-xr-x  14 root  wheel  10240 Apr  7  2023 boot
dr-xr-xr-x   2 root  wheel   2048 Apr  7  2023 dev
drwxr-xr-x  29 root  wheel  14336 Apr  7  2023 etc
drwxr-xr-x   5 root  wheel  10240 Apr  7  2023 lib
drwxr-xr-x   3 root  wheel   2048 Apr  7  2023 libexec
drwxr-xr-x   2 root  wheel   2048 Apr  7  2023 media
drwxr-xr-x   2 root  wheel   2048 Apr  7  2023 mnt
drwxr-xr-x   2 root  wheel   2048 Apr  7  2023 net
dr-xr-xr-x   2 root  wheel   2048 Apr  7  2023 proc
drwxr-xr-x   2 root  wheel   2048 Apr  7  2023 rescue
drwxr-xr-x   2 root  wheel   2048 Apr  7  2023 root
drwxr-xr-x   2 root  wheel  20480 Apr  7  2023 sbin
drwxrwxrwt   2 root  wheel   2048 Apr  7  2023 tmp
drwxr-xr-x  13 root  wheel   2048 Apr  7  2023 usr
drwxr-xr-x  24 root  wheel   4096 Apr  7  2023 var
</pre>



<h2 class="wp-block-heading"><span id="toc7">注意点</span></h2>



<p class="wp-block-paragraph">このように，簡単にネットワーク越しにデバイスを共有できるのですが，いくつか注意点があります．</p>



<ul class="wp-block-list">
<li>rc.d スクリプトが用意されていない</li>



<li>ネットワークの暗号化はされていない</li>



<li>提供したデバイスを接続できるクライアントは1台のみ</li>
</ul>



<h3 class="wp-block-heading"><span id="toc8">rc.d スクリプトが用意されていない</span></h3>



<p class="wp-block-paragraph">起動・停止にあたり /etc/rc.conf および rc.d スクリプトがない為，自前で起動時，停止・再起動時の処理を書く必要があります．<br>サーバー側は rc.local に先のコマンドを記載するだけで大丈夫ですが，クライアント側はマウント処理が終わり次第，必要なサービスを起動させる等の対処が必要となります．</p>



<h3 class="wp-block-heading"><span id="toc9">ネットワークの暗号化はされていない</span></h3>



<p class="wp-block-paragraph">NFS も同様なのであまり気にするポイントではないかもしれませんが，盗聴のリスクがある事は理解しておく必要があります．<br>必要に応じて IPSec 張る等を考えなければなりません</p>



<h3 class="wp-block-heading"><span id="toc10">提供したデバイスを接続できるクライアントは1台のみ</span></h3>



<p class="wp-block-paragraph">複数のクライアントに同じデバイスを提供，複数のクライアントが同時に接続する事はできません．<br>一番最初に掴んだクライアントが優先され，以降のクライアントは接続に失敗します．</p>



<p class="wp-block-paragraph">iSCSI 経由のディスクマウントと同じような利用方法はできません．</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">FreeBSD 10.0 より，iSCSI Target が標準で利用できるようになっている為，GEOM GATE の出番はほぼ無いと思います．が，簡単に共有ができるのでちょっとしたデバイスの論理的な移動を行いたい場合には使いようはあるかと思います．</p>



<p class="wp-block-paragraph">以上で GEOM GATE についての解説を終了します．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM GVIRSTORを使ってみる</title>
		<link>https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html</link>
					<comments>https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Fri, 08 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=898</guid>

					<description><![CDATA[今回は GEOM GVIRSTOR によるシンプロビジョニングボリュームの提供について纏めてみます．実ディスクより大きいサイズのディスクを提供する事ができ，利用状況に合わせて拡張していくという使い方が可能になります． 目 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM GVIRSTOR によるシンプロビジョニングボリュームの提供について纏めてみます．<br>実ディスクより大きいサイズのディスクを提供する事ができ，利用状況に合わせて拡張していくという使い方が可能になります．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-12" checked><label class="toc-title" for="toc-checkbox-12">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM VIRSTOR のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM VIRSTOR の利用・管理</a></li><li><a href="#toc3" tabindex="0">シンプロビジョニングディスクを作成する</a></li><li><a href="#toc4" tabindex="0">実際に利用した場合の状態を確認してみる</a></li><li><a href="#toc5" tabindex="0">GEOM VIRSTOR にディスクを追加する</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM VIRSTOR のイメージ</span></h2>



<p class="wp-block-paragraph">GEOM VIRSTORのイメージはこのようになります．<br>VIRSTOR としてのディスク容量は 100GB ですが，実際の容量は 10GB のディスクを用います．<br>今回は物理側ディスク溢れの状況を作りたいので小さいディスクを使用します．</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="224" height="393" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-19.png" alt="" class="wp-image-900"/></figure>



<h2 class="wp-block-heading"><span id="toc2">GEOM VIRSTOR の利用・管理</span></h2>



<p class="wp-block-paragraph">GEOM VIRSTOR は <strong><em>gvirstor</em></strong> というコマンドを通じて利用・管理を行います．簡単に触れますが，詳細はコマンドのオプションの詳細は FreeBSD の マニュアル「<a rel="noopener" href="http://koganemaru.co.jp/cgi-bin/mroff.cgi?subdir=man&amp;lc=1&amp;cmd=&amp;man=gvirstor&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">gvirstor</a>」を見てください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor
usage: gvirstor clear [-v] prov ...
       gvirstor dump prov ...
       gvirstor label [-h] [-v] [-m chunk_size] [-s vir_size] name provider0 [provider1 ...]
       gvirstor destroy [-fv] name ...
       gvirstor stop [-fv] name ... (alias for "destroy")
       gvirstor add [-vh] name prov [prov ...]
       gvirstor remove [-v] name ...
       gvirstor help
       gvirstor list [-a] [name ...]
       gvirstor status [-ags] [name ...]
       gvirstor load [-v]
       gvirstor unload [-v]</pre>



<p class="wp-block-paragraph">GEOM VIRSTOR は <strong>create サブコマンドがない</strong>ので，再起動したらどうなるのか．というのはスキップします．</p>



<h2 class="wp-block-heading"><span id="toc3">シンプロビジョニングディスクを作成する</span></h2>



<p class="wp-block-paragraph"><strong><em>gvirstor label</em></strong> コマンドで仮想的なシンプロビジョニングを作成し，配下に RAID3 ボリュームの raid3-0 に紐づけます．<br>-s 1000G のオプションはプロビジョニングサイズで，OS から見たらこのサイズのディスクに見える形となります．</p>



<p class="wp-block-paragraph">GEOM VIRSTOR は実行した段階で自動的にロードされますが，明示的に読み込みさせる事をお勧めします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># kldload geom_virstor
# gvirstor label -s 100G vstor0 da1</pre>



<p class="wp-block-paragraph">再起動時に必ず有効になるように /boot/loader.conf に明示的に記述する事をお勧めします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /boot/loader.conf
geom_virstor_load="YES"</pre>



<p class="wp-block-paragraph"><strong><em>gvirstor status</em></strong> コマンドでステータスを表示できます．<br>以下は vstor0 のステータスです．da1 に紐づけられている事が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor status
          Name              Status  Components
virstor/vstor0  100% physical free  da1</pre>



<p class="wp-block-paragraph"><strong><em>gvirstor list</em></strong> コマンドで詳細を表示する事ができます．<br>VirtualSize や Provider の Mediasize が OS から見えるディスクサイズになります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 10737418240
PhysicalBacking: 10%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 2560
PhysicalFree: 100%
ChunkSize: 4194304
State: 100% physical free
Status: Components=1, Online=1
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r0w0e0
   StorageFree: 100%
   ChunksReserved: 2
   ChunksUsed: 2
   ChunkCount: 2560
   ComponentIndex: 0</pre>



<p class="wp-block-paragraph"><strong><em>newfs</em></strong> でフォーマットを行います．データがあるディスクを組み込んでも利用できないので注意してください．その後，マウント，マウントの結果を確認します．/mnt にマウントをしています．<br>これを /etc/fstab に記載した状態で再起動を行ってみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># newfs /dev/virstor/vstor0
/dev/virstor/vstor0: 102400.0MB (209715200 sectors) block size 32768, fragment size 4096
        using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,

# mount /dev/virstor/vstor0 /mnt

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2774064 14962856    16%    /
devfs                       1       1        0   100%    /dev
/dev/virstor/vstor0 101561756       8 93436808     0%    /mnt

# cat /etc/fstab
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/da0p2      /               ufs     rw      1       1
/dev/da0p3      none            swap    sw      0       0
/dev/virstor/vstor0     /mnt    ufs     rw      1       1</pre>



<h2 class="wp-block-heading"><span id="toc4">実際に利用した場合の状態を確認してみる</span></h2>



<p class="wp-block-paragraph">このディスクを利用した際，どのように扱われるのか．を確認してみます．<br>ファイルを dd を用いて作成して実ボリュームの 10GB を埋めてみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_0.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.385553 secs (114403677 bytes/sec)

# ls /mnt
.snap           1G_0.img

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2774064 14962856    16%    /
devfs                       1       1        0   100%    /dev
/dev/virstor/vstor0 101561756 1048872 92387944     1%    /mnt
</pre>



<p class="wp-block-paragraph">これを淡々と続けていき，10GB まで埋めていきます．8回実施 (計9回) の状況です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_1.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.142144 secs (117449678 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_2.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.359638 secs (114720447 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_3.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.166272 secs (117140514 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_4.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.156702 secs (117262948 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_5.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.147463 secs (117381383 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_6.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.175452 secs (117023315 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_7.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.151995 secs (117323258 bytes/sec)
root@bsd13:/ # dd if=/dev/zero of=/mnt/1G_8.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.159731 secs (117224170 bytes/sec)

# gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 10737418240
PhysicalBacking: 10%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 2560
PhysicalFree: 1%
ChunkSize: 4194304
State: 1% physical free
Status: Components=1, Online=1
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2
   StorageFree: 1%
   ChunksReserved: 2
   ChunksUsed: 2540
   ChunkCount: 2560
   ComponentIndex: 0</pre>



<p class="wp-block-paragraph">次実行で実ボリュームはすべて使い切る形になりますので，この際にどのような挙動になるのか確認します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_9.img bs=1M count=1024</pre>



<p class="wp-block-paragraph">コマンドが完了せず，この状態のまま待ちとなります．<strong><em>gvirstor</em></strong> のステータスを見ると次のようになります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 10737418240
PhysicalBacking: 10%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 2560
PhysicalFree: 0%
ChunkSize: 4194304
State: 0% physical free
Status: Components=1, Online=1
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2
   StorageFree: 0%
   ChunksReserved: 2
   ChunksUsed: 2560
   ChunkCount: 2560
   ComponentIndex: 0</pre>



<p class="wp-block-paragraph">PhysicalFree や State をみると完全に使い切っている状態ですので，このまま IO 完了待ちの状態が継続するようです．</p>



<p class="wp-block-paragraph">したがって，ディスクを追加して実容量を増やしていきます．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc5">GEOM VIRSTOR にディスクを追加する</span></h2>



<p class="wp-block-paragraph"><strong><em>gvirstor add</em></strong> コマンドを使用して新しいディスクを追加できます．ここでは vstor0 に da2 を追加しています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor add vstor0 da2</pre>



<p class="wp-block-paragraph">追加が完了すると，先の IO 待ちの状態が解消して書き込みが再開します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_9.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 233.283381 secs (4602736 bytes/sec)</pre>



<p class="wp-block-paragraph">さて，<strong><em>gvirstor list</em></strong> で状況をみようかと思った所で<strong> kernel panic で再起動が走りました&#8230;</strong></p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd4ac41&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd4ac41" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="554" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-33-24_No-00.png" alt="" class="wp-image-901" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-33-24_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-33-24_No-00-300x218.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-33-24_No-00-546x396.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">ここで明示的にマウントを行うと<strong>残念なことに再度 kernel panic が発生しました</strong>．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd4b4c1&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd4b4c1" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="554" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-38-14_No-00.png" alt="" class="wp-image-902" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-38-14_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-38-14_No-00-300x218.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_16-38-14_No-00-546x396.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">実ボリュームを溢れさせた為こうなったのかもしれません．これでは何も進まないので最初からやり直してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor label -s 100G vstor0 da1

# newfs /dev/virstor/vstor0
/dev/virstor/vstor0: 102400.0MB (209715200 sectors) block size 32768, fragment size 4096
        using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,

# mount /dev/virstor/vstor0 /mnt

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2957100 14779820    17%    /
devfs                       1       1        0   100%    /dev
/dev/virstor/vstor0 101561756       8 93436808     0%    /mnt
</pre>



<p class="wp-block-paragraph">ここから，使い切らない範囲で dd を実施します．1GB x 8 個．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_0.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.157406 secs (117253932 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_1.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.182170 secs (116937698 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_2.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.118827 secs (117749999 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_3.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.147965 secs (117374943 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_4.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.157894 secs (117247682 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_5.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.156020 secs (117271684 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_6.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.352406 secs (114809150 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_7.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.381967 secs (114447411 bytes/sec)
</pre>



<p class="wp-block-paragraph">この時点で gvirstor list の結果の残量が 10% でした．ですので，ここでディスクを追加します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 10737418240
PhysicalBacking: 10%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 2560
PhysicalFree: 10%
ChunkSize: 4194304
State: 10% physical free
Status: Components=1, Online=1
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2
   StorageFree: 10%
   ChunksReserved: 2
   ChunksUsed: 2308
   ChunkCount: 2560
   ComponentIndex: 0</pre>



<p class="wp-block-paragraph">da2 を追加，状態はこのようになりました．55% が空いているという状況ですね．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor add vstor0 da2

# gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 21474836480
PhysicalBacking: 20%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 5120
PhysicalFree: 55%
ChunkSize: 4194304
State: 55% physical free
Status: Components=2, Online=2
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2
   StorageFree: 10%
   ChunksReserved: 2
   ChunksUsed: 2308
   ChunkCount: 2560
   ComponentIndex: 0
2. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2</pre>



<p class="wp-block-paragraph">先ほど，10回目で kernel panic になったので，まずはここから2回 dd を打ってみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/zero of=/mnt/1G_8.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.160023 secs (117220424 bytes/sec)

# dd if=/dev/zero of=/mnt/1G_9.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.154714 secs (117288402 bytes/sec)</pre>



<p class="wp-block-paragraph">今度は問題なく完了しました．gvirstor list で結果を見てみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gvirstor list
Geom name: vstor0
VirtualSize: 107374182400
PhysicalBackingSize: 21474836480
PhysicalBacking: 20%
ChunkVirtualCount: 25600
ChunkPhysicalCount: 5120
PhysicalFree: 46%
ChunkSize: 4194304
State: 46% physical free
Status: Components=2, Online=2
Providers:
1. Name: virstor/vstor0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2
   StorageFree: 100%
   ChunksReserved: 0
   ChunksUsed: 0
   ChunkCount: 4294965248
   ComponentIndex: 77234808
2. Name: da2
   Mediasize: 10737418240 (10G)
   Sectorsize: 512
   Mode: r1w1e2</pre>



<p class="wp-block-paragraph">2本目のディスクに書かれているのか全く分かりません&#8230; もう一度 dd を実行すると必ず2本目を使用しますので実行してみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> # dd if=/dev/zero of=/mnt/1G_10.img bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 9.155170 secs (117282570 bytes/sec)

# gvirstor list</pre>



<p class="wp-block-paragraph">と <strong><em>gvirstor list</em></strong> を実行したとたん <strong>kernel panic になり再起動を繰り返しました&#8230;</strong></p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd4bfc4&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd4bfc4" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="554" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_20-43-41_No-00.png" alt="" class="wp-image-903" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_20-43-41_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_20-43-41_No-00-300x218.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13-1seichanlocal-VMware-Workstation_2023-12-6_20-43-41_No-00-546x396.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<p class="wp-block-paragraph">このバージョン特有の問題なのか分かりませんが，使えないですね&#8230;</p>



<p class="wp-block-paragraph">残念ですが，GEOM VIRTSTOR の紹介をこれにて終わります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM CACHE を使ってみる</title>
		<link>https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html</link>
					<comments>https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Thu, 07 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=891</guid>

					<description><![CDATA[今回は GEOM によるディスクの読み出しキャッシュ (リードキャッシュ) について纏めてみたいと思います．GEOM CACHE は GEOM RAID3 の読み出しが遅くなる問題の解決方法として作成されたようですが，R [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM によるディスクの読み出しキャッシュ (リードキャッシュ) について纏めてみたいと思います．<br>GEOM CACHE は GEOM RAID3 の読み出しが遅くなる問題の解決方法として作成されたようですが，RAID3 ボリューム以外にも利用可能です．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-14" checked><label class="toc-title" for="toc-checkbox-14">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM CACHE のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM CACHE の利用・管理</a></li><li><a href="#toc3" tabindex="0">create で作った場合はどうなるのか?</a></li><li><a href="#toc4" tabindex="0">恒久的に使う場合は label を利用しよう</a></li><li><a href="#toc5" tabindex="0">キャッシュの効果について確認してみる (キャッシュ有効時)</a></li><li><a href="#toc6" tabindex="0">キャッシュの効果について確認してみる (キャッシュ無効時)</a></li><li><a href="#toc7" tabindex="0">キャッシュを制御する</a></li><li><a href="#toc8" tabindex="0">sysctl の値を変えて追試してみる</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM CACHE のイメージ</span></h2>



<p class="wp-block-paragraph">GEOM CACHE の RAID3 ボリュームのキャッシュとしたイメージはこのような形です．<br>前述していますが，RAID3 以外の GEOM STRIPE や MIRROR および単体のディスクに対してもこのようなキャッシュデバイスとしてつける事が可能です．</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="517" height="460" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-17.png" alt="" class="wp-image-893" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-17.png 517w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-17-300x267.png 300w" sizes="(max-width: 517px) 100vw, 517px" /></figure>



<h2 class="wp-block-heading"><span id="toc2">GEOM CACHE の利用・管理</span></h2>



<p class="wp-block-paragraph">GEOM CACHE は <strong><em>gcache</em></strong> というコマンドを通じて利用・管理を行います．簡単に触れますが，詳細はコマンドのオプションの詳細は FreeBSD の マニュアル「<a rel="noopener" href="http://www.koganemaru.co.jp/cgi-bin/mroff.cgi?subdir=man&amp;lc=1&amp;cmd=&amp;man=gcache&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">gcache</a>」を見てください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache
usage: gcache clear [-v] prov ...
       gcache configure [-v] [-b blocksize] [-s size] name
       gcache create [-v] [-b blocksize] [-s size] name prov
       gcache destroy [-fv] name ...
       gcache dump prov ...
       gcache label [-v] [-b blocksize] [-s size] name prov
       gcache reset [-v] name ...
       gcache stop [-fv] name ...
       gcache help
       gcache list [-a] [name ...]
       gcache status [-ags] [name ...]
       gcache load [-v]
       gcache unload [-v]</pre>



<p class="wp-block-paragraph">GEOM 関連のコマンドは <strong><em>gconcat</em></strong> の際にも触れましたが <strong><em>create</em></strong> と <strong><em>label</em></strong> の両方があり分かりづらいのですが，<strong>create は一時的</strong>，<strong>label は恒久的</strong>と覚えるのがよいです．</p>



<h2 class="wp-block-heading"><span id="toc3">create で作った場合はどうなるのか?</span></h2>



<p class="wp-block-paragraph"><strong><em>create</em></strong> で作成してマウント，再起動を行うとどのようになるのかを以下に一連の流れを記載します．</p>



<p class="wp-block-paragraph"><strong><em>gcache create</em></strong> コマンドでキャッシュデバイスを作成し，RAID3 ボリュームの raid3-0 に紐づけます．<br>-s 1G のオプションはキャッシュサイズで，これがメモリからキャッシュ用に確保される領域になります．</p>



<p class="wp-block-paragraph">GEOM CACHE は実行した段階で自動的にロードされますが，明示的に読み込みさせる事をお勧めします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># kldload geom_cache
# gcache create -s 1G cache3-0 /dev/raid3/raid3-0</pre>



<p class="wp-block-paragraph">再起動時に必ず有効になるように /boot/loader.conf に明示的に記述する事をお勧めします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /boot/loader.conf
geom_cache_load="YES"</pre>



<p class="wp-block-paragraph"><strong><em>gcache status</em></strong> コマンドでステータスを表示できます．<br>以下は cache0 のステータスです．raid3-0 に紐づけられている事が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache status
          Name  Status  Components
cache/cache3-0     N/A  raid3/raid3-0</pre>



<p class="wp-block-paragraph"><strong><em>gcache list</em></strong> コマンドで詳細を表示する事ができます．<br>Size がキャッシュサイズになります．キャッシュヒットやキャッシュミス等の統計値もここに表示されます．<br>(マウントもしていないのに値が出るのはなぜ? という状態ですが)</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache list
Geom name: cache3-0
WroteBytes: 12288
Writes: 2
CacheFull: 0
CacheMisses: 4
CacheHits: 15
CacheReadBytes: 287744
CacheReads: 19
ReadBytes: 312320
Reads: 37
InvalidEntries: 0
UsedEntries: 1
Entries: 1
TailOffset: 322122481664
BlockSize: 65536
Size: 1073741824
Providers:
1. Name: cache/cache3-0
   Mediasize: 322122546176 (300G)
   Sectorsize: 1024
   Mode: r1w1e1
Consumers:
1. Name: raid3/raid3-0
   Mediasize: 322122546176 (300G)
   Sectorsize: 1024
   Mode: r1w1e1</pre>



<p class="wp-block-paragraph">マウントおよびマウントの結果です．/mnt にマウントをしています．<br>これを /etc/fstab に記載した状態で再起動を行ってみます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># mount /dev/cache/cache3-0 /mnt

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2773948  14962972    16%    /
devfs                       1       1         0   100%    /dev
/dev/cache/cache3-0 203123604 1499460 185374256     1%    /mnt

# cat /etc/fstab
# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/da0p2      /               ufs     rw      1       1
/dev/da0p3      none            swap    sw      0       0
/dev/cache/cache3-0     /mnt    ufs     rw      1       1</pre>



<p class="wp-block-paragraph">残念な事に (想定どおりです)，デバイスが無く起動途中に失敗してしまっています．<br>これは <strong><em>create</em></strong> で作成した為，ディスクに GEOM CACHE の情報が記録されてい為作成したデバイスが存在しておらず，この状態となります．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd526ac&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd526ac" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="553" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-5_19-18-18_No-00.png" alt="" class="wp-image-896" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-5_19-18-18_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-5_19-18-18_No-00-300x217.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-5_19-18-18_No-00-546x395.png 546w" sizes="(max-width: 764px) 100vw, 764px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc4">恒久的に使う場合は label を利用しよう</span></h2>



<p class="wp-block-paragraph">先ほどと変わって <strong><em>create</em></strong> ではなく <strong><em>label</em></strong> で cache3-0 を作成しました．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache label -s 1G cache3-0 /dev/raid3/raid3-0</pre>



<p class="wp-block-paragraph"><strong><em>create</em></strong> と同じように指定している為，<strong><em>status</em></strong> および <em>list</em> の結果は先ほどと変わりません．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 3
CacheHits: 14
CacheReadBytes: 74752
CacheReads: 17
ReadBytes: 87040
Reads: 26
InvalidEntries: 0
UsedEntries: 3
Entries: 3
TailOffset: 214748299264
BlockSize: 65536
Size: 1073741824
Providers:
1. Name: cache/cache3-0
   Mediasize: 214748362752 (200G)
   Sectorsize: 1024
   Mode: r0w0e0
Consumers:
1. Name: raid3/raid3-0
   Mediasize: 214748363776 (200G)
   Sectorsize: 1024
   Mode: r0w0e0</pre>



<p class="wp-block-paragraph">GEOM CACHE の場合，大本のデータを壊す等はないので気にせずに作業しちゃいましょう．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># mount /dev/cache/cache3-0 /mnt

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2773948  14962972    16%    /
devfs                       1       1         0   100%    /dev
/dev/cache/cache3-0 203123604 1499460 185374256     1%    /mnt</pre>



<h2 class="wp-block-heading"><span id="toc5">キャッシュの効果について確認してみる (キャッシュ有効時)</span></h2>



<p class="wp-block-paragraph">キャッシュがどの程度有効なのかを試してみたいと思います．<br>上でキャッシュ経由でマウントを行いましたので，キャッシュありからテストします．</p>



<p class="wp-block-paragraph">テストの方法ですが，FreeBSD の src を /mnt に展開します．<br>そのファイル群を tar cf /dev/null ./src という形で読み取りを行い，それにかかった時間や IO 等を見ていく形とします．</p>



<p class="wp-block-paragraph"><strong>1回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:20:08 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:20:08 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 34 seconds, throughput 41246 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:20:44 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   897 72.2    0   0.0  13.7   72   1.0  13.7   72   1.0   8.9   44   0.4   0  0  1  0 99
   2  1919 27.3    2   0.1  32.0  472  14.7  32.0  472  14.8   0.0    0   0.0   1  0  7  1 92
   0    43  0.0    0   0.0  32.0  878  27.4  32.0  878  27.4   0.0    0   0.0   2  0 13  1 84
   0    19  0.0    0   0.0  32.0  741  23.1  32.0  741  23.1   0.0    0   0.0   3  0 15  1 82
   0    19  0.0    0   0.0  32.0  774  24.2  32.0  774  24.2   0.0    0   0.0   3  0 16  1 80
   0    19  0.0    0   0.0  32.0  789  24.7  32.0  789  24.7   0.0    0   0.0   3  0 13  2 82
   0    19  0.0    0   0.0  32.0  780  24.4  32.0  780  24.4   0.0    0   0.0   3  0 14  1 82
   0    19  0.0    0   0.0  32.0  833  26.0  32.0  833  26.0   0.0    0   0.0   3  0 14  1 83


# gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 28127
CacheHits: 373201
CacheReadBytes: 2016825344
CacheReads: 401328
ReadBytes: 2016825344
Reads: 401328
InvalidEntries: 0
UsedEntries: 3290
Entries: 3290
TailOffset: 214748299264
BlockSize: 65536
Size: 1073741824</pre>



<p class="wp-block-paragraph">1回目の結果は36秒となりました．CacheHits しているのはなぜ? とも思いますが&#8230;</p>



<p class="wp-block-paragraph"><strong>２回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:21:33 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:21:33 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 31 seconds, throughput 45237 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:22:07 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   893 72.0    0   0.0  14.6   75   1.1  14.6   75   1.1   8.9   43   0.4   0  0  1  0 99
   2  1925 24.0    1   0.0  32.0  378  11.8  32.0  378  11.8   0.0    0   0.0   0  0  7  1 92
   0    43  0.0    0   0.0  32.0  923  28.8  32.0  923  28.8   0.0    0   0.0   1  0 11  1 87
   0    19  0.0    0   0.0  32.0  862  26.9  32.0  862  26.9   0.0    0   0.0   3  0 16  1 80
   0    19  0.0    0   0.0  32.0  922  28.8  32.0  922  28.8   0.0    0   0.0   3  0 15  1 81
   0    19  0.0    0   0.0  32.0  927  29.0  32.0  927  29.0   0.0    0   0.0   3  0 13  1 83
   0    19 16.8    1   0.0  32.0  816  25.5  32.0  816  25.5   0.0    0   0.0   3  0 20  1 75
   0    52  4.0    0   0.0  32.0  844  26.4  32.0  844  26.4   0.0    0   0.0   3  0 18  2 76

# gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 56809
CacheHits: 745847
CacheReadBytes: 4033650688
CacheReads: 802656
ReadBytes: 4033650688
Reads: 802656
InvalidEntries: 0
UsedEntries: 3342
Entries: 3342
TailOffset: 214748299264
BlockSize: 65536
Size: 1073741824</pre>



<p class="wp-block-paragraph">2回目の結果は 34秒でした．誤差の範囲と言えそうなレベルです．ただ，CacheHits はもっと増えていますね．</p>



<p class="wp-block-paragraph"><strong>3回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:26:07 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:26:07 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 27 seconds, throughput 51939 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:26:35 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   873 71.4    0   0.0  15.4   76   1.1  15.4   76   1.1   8.9   42   0.4   0  0  1  0 99
   2  1901 24.0    1   0.0  32.0  992  31.0  32.0  992  31.0   0.0    0   0.0   0  0  6  1 92
   0    43  0.0    0   0.0  32.0  946  29.5  32.0  946  29.5   0.0    0   0.0   4  0 16  1 79
   0    19  0.0    0   0.0  32.0  926  28.9  32.0  926  28.9   0.0    0   0.0   3  0 16  1 80
   0    19  0.0    0   0.0  32.0  906  28.3  32.0  906  28.3   0.0    0   0.0   4  0 18  0 78
   0    19  0.0    0   0.0  32.0  892  27.9  32.0  892  27.9   0.0    0   0.0   4  0 18  1 77
   0   107  0.0    0   0.0  32.0  829  25.9  32.0  829  25.9   0.0    0   0.0   3  0 14  1 81

# gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 84275
CacheHits: 1119709
CacheReadBytes: 6050476032
CacheReads: 1203984
ReadBytes: 6050476032
Reads: 1203984
InvalidEntries: 0
UsedEntries: 3342
Entries: 3342
TailOffset: 214748299264
BlockSize: 65536
Size: 1073741824</pre>



<p class="wp-block-paragraph">3回目の結果は 28秒となりました．より速くなっています．何度か読み出しが行われる必要がありそうなので最後にもう一度だけやってみます．</p>



<p class="wp-block-paragraph"><strong>4回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:29:11 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:29:11 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 27 seconds, throughput 51939 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:29:40 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   862 71.2    0   0.0  16.2   78   1.2  16.2   78   1.2   8.9   41   0.4   0  0  1  0 99
   2  1925 24.0    1   0.0  32.0  921  28.8  32.0  921  28.8   0.0    0   0.0   1  0  8  0 90
   0    43  0.0    0   0.0  32.0  978  30.6  32.0  978  30.6   0.0    0   0.0   3  0 17  0 79
   0    19  0.0    0   0.0  32.0  926  28.9  32.0  926  28.9   0.0    0   0.0   3  0 15  1 82
   0    19  0.0    0   0.0  32.0  917  28.7  32.0  917  28.7   0.0    0   0.0   5  0 17  1 77
   0    19  0.0    0   0.0  32.0  904  28.2  32.0  904  28.3   0.0    0   0.0   3  0 16  1 80
   0   112  0.0    0   0.0  32.0  922  28.8  32.0  922  28.8   0.0    0   0.0   3  0 17  1 79

# gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 112114
CacheHits: 1493198
CacheReadBytes: 8067301376
CacheReads: 1605312
ReadBytes: 8067301376
Reads: 1605312
InvalidEntries: 0
UsedEntries: 3342
Entries: 3342
TailOffset: 214748299264
BlockSize: 65536
Size: 1073741824</pre>



<p class="wp-block-paragraph">29秒と3回目より悪い結果になりました．キャッシュサイズとの関係性なのかがよく分からずですが，1回目よりは2回目以降は速くなっているのは確認できました．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc6">キャッシュの効果について確認してみる (キャッシュ無効時)</span></h2>



<p class="wp-block-paragraph">続いて，キャッシュを挟まない場合で実施してみます．GEOM RAID3 ボリュームを直接マウントします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># umount /mnt
# mount /dev/raid3/raid3-0 /mnt</pre>



<p class="wp-block-paragraph"><strong>1回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date; dump -f - -0 /dev/raid3/raid3-0 > /dev/null; date
Tue Dec  5 21:34:38 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:34:38 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/raid3/raid3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 64 seconds, throughput 21912 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:35:43 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   845 70.5    0   0.0  17.2   80   1.3  17.2   80   1.3   8.9   39   0.3   0  0  1  0 99
   2  1941 24.0    1   0.0   4.1 3274  13.2   4.1 3274  13.2   0.0    0   0.0   1  0  8  2 89
   0    19  0.0    0   0.0   2.3 6281  14.3   2.3 6281  14.3   0.0    0   0.0   1  0 10  4 84
   0    19  0.0    0   0.0   2.4 6206  14.4   2.4 6206  14.4   0.0    0   0.0   1  0 12  3 84
   0    19  0.0    0   0.0   2.4 6242  14.8   2.4 6242  14.8   0.0    0   0.0   1  0 11  3 85
   0    19  0.0    0   0.0   2.4 6155  14.3   2.4 6155  14.3   0.0    0   0.0   1  0 10  3 86
   0    19  0.0    0   0.0   2.4 6271  14.5   2.4 6270  14.5   0.0    0   0.0   1  0 11  3 85
   0    52  0.0    0   0.0   2.3 6190  14.1   2.3 6190  14.1   0.0    0   0.0   1  0 12  3 84
   0    19  0.0    0   0.0   2.4 6267  14.5   2.4 6267  14.5   0.0    0   0.0   2  0 10  4 84</pre>



<p class="wp-block-paragraph">65秒かかっています．キャッシュありの初回よりも遅いです．という事はやはりキャッシュは効いているものと考えられます．<br>dump は vfs キャッシュが効かないようなので2回目も同様の結果になるはずです．</p>



<p class="wp-block-paragraph"><strong>2回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/raid3/raid3-0 > /dev/null ; date
Tue Dec  5 21:37:59 JST 2023
  DUMP: WARNING: should use -L when dumping live read-write filesystems!
  DUMP: Date of this level 0 dump: Tue Dec  5 21:37:59 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/raid3/raid3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 65 seconds, throughput 21574 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:39:06 JST 2023

# iostat -n 4 5
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1   833 70.2    0   0.0  11.6  125   1.4  11.6  125   1.4   8.9   38   0.3   0  0  1  0 99
   2  2058 19.6    2   0.0   4.2 3217  13.2   4.2 3217  13.2   0.0    0   0.0   1  0  9  2 88
   0    19  0.0    0   0.0   2.3 5625  12.8   2.3 5625  12.8   0.0    0   0.0   2  0 14  2 82
   0    19  0.0    0   0.0   2.4 6080  14.1   2.4 6080  14.1   0.0    0   0.0   2  0 10  2 87
   0    19  0.0    0   0.0   2.4 5963  14.0   2.4 5963  14.0   0.0    0   0.0   2  0 11  2 85
   0    19  0.0    0   0.0   2.4 5865  13.5   2.4 5865  13.5   0.0    0   0.0   1  0 10  3 86
   0    19  0.0    0   0.0   2.4 6020  14.0   2.4 6020  14.0   0.0    0   0.0   2  0 11  2 85
   0    19  0.0    0   0.0   2.3 5956  13.3   2.3 5956  13.3   0.0    0   0.0   1  0 11  3 86
</pre>



<p class="wp-block-paragraph">2回目は67秒かかりました．キャッシュの有効性は確認できたと思います．<br>キャッシュヒットの条件が不明ですが，それなりな効果は期待できると言っていいのではないでしょうか．</p>



<h2 class="wp-block-heading"><span id="toc7">キャッシュを制御する</span></h2>



<p class="wp-block-paragraph"><strong><em>gcache configure</em></strong> コマンドでキャッシュサイズの変更，ブロックサイズの変更が可能です．<br>例えば，キャッシュサイズを 1G から 2G に変えた場合はこのようになります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gcache configure -s 2G cache3-0

# gcache list
Geom name: cache3-0
WroteBytes: 12288
Writes: 2
CacheFull: 0
CacheMisses: 124861
CacheHits: 1628979
CacheReadBytes: 8849994752
CacheReads: 1753840
ReadBytes: 8850007040
Reads: 1753849
InvalidEntries: 0
UsedEntries: 3342
Entries: 3342
TailOffset: 214748299264
BlockSize: 65536
Size: 2147483648</pre>



<p class="wp-block-paragraph">また，sysctl でキャッシュの制御ができるようです．<br>used_hi と timeout を変えると先ほどの試験の結果も変わりそうです．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># sysctl -a | grep kern.geom.cache.
kern.geom.cache.used_hi: 20
kern.geom.cache.used_lo: 5
kern.geom.cache.idletime: 5
kern.geom.cache.timeout: 10
kern.geom.cache.enable: 1
kern.geom.cache.debug: 0</pre>



<h2 class="wp-block-heading"><span id="toc8">sysctl の値を変えて追試してみる</span></h2>



<p class="wp-block-paragraph">ドキュメント，マニュアルに全く記載がないので想定で設定してみます．<br>kern.geom.cache.used_hi はきっとハイウォーターマークだと想定し，これを超えて kern.geom.cache.timeout の時間を超えたものがキャッシュからパージされてしまうのではないかと考えてみました．</p>



<p class="wp-block-paragraph">ですので，以下のように設定して2回ほど dump を実行してみます．<br>カウンターだけリセットもしています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># sysctl kern.geom.cache.used_hi=80
kern.geom.cache.used_hi: 20 -> 80

# sysctl kern.geom.cache.timeout=120
kern.geom.cache.timeout: 10 -> 120

# gcache reset cache3-0
# gcache list
Geom name: cache3-0
WroteBytes: 0
Writes: 0
CacheFull: 0
CacheMisses: 0
CacheHits: 0
CacheReadBytes: 0
CacheReads: 0
ReadBytes: 0
Reads: 0
InvalidEntries: 0
UsedEntries: 3342
Entries: 3342
TailOffset: 214748299264
BlockSize: 65536
Size: 2147483648</pre>



<p class="wp-block-paragraph"><strong>1回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:52:46 JST 2023
  DUMP: Date of this level 0 dump: Tue Dec  5 21:52:46 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 25 seconds, throughput 56094 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:53:12 JST 2023</pre>



<p class="wp-block-paragraph">26秒ですね．先ほどと変わらずです．キャッシュに残っているものがあるのでそれが利用された為．なのかな?</p>



<p class="wp-block-paragraph"><strong>2回目</strong></p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># date ; dump -f - -0 /dev/cache/cache3-0 > /dev/null ; date
Tue Dec  5 21:54:13 JST 2023
  DUMP: Date of this level 0 dump: Tue Dec  5 21:54:13 2023
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/cache/cache3-0 to standard output
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 1405443 tape blocks.
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: DUMP: 1402371 tape blocks
  DUMP: finished in 25 seconds, throughput 56094 KBytes/sec
  DUMP: DUMP IS DONE
Tue Dec  5 21:54:39 JST 2023</pre>



<p class="wp-block-paragraph">2回目も26秒．んー&#8230; わからない&#8230;</p>



<p class="wp-block-paragraph">すっきりしない結果とはなりましたが，GEOM CACHE の効果自体は確認はできました．<br>UFS を利用してファイルサーバーやメールスプールを提供している場合などは有効ではないでしょうか．</p>



<p class="wp-block-paragraph">以上，GEOM CACHE の紹介でした．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM RAID3を使ってみる</title>
		<link>https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html</link>
					<comments>https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Wed, 06 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=871</guid>

					<description><![CDATA[今回は GEOM による RAID3 について纏めてみたいと思います．RAID3 は複数のディスクに対して分散してデータを書き、耐障害性の為パリティデータを1本のディスクに保持する冗長方式です．3本以上のディスクが必要に [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM による RAID3 について纏めてみたいと思います．<br>RAID3 は複数のディスクに対して分散してデータを書き、耐障害性の為パリティデータを1本のディスクに保持する冗長方式です．<br>3本以上のディスクが必要になり GEOM RAID3 の場合は <strong>3, 5, 9, 17 と 2のn乗 +1 の数量が必要</strong>となります．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-16" checked><label class="toc-title" for="toc-checkbox-16">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM RAID3 のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM RAID3 の利用・管理</a><ol><li><a href="#toc3" tabindex="0">RAID3 ボリュームを作成してみる</a></li></ol></li><li><a href="#toc4" tabindex="0">IOについて確認してみる</a></li><li><a href="#toc5" tabindex="0">障害発生時のディスク交換手順 (完全に見えなくなった場合)</a></li><li><a href="#toc6" tabindex="0">自発的にディスクを交換する (メディアエラー等の不調の場合)</a></li><li><a href="#toc7" tabindex="0">ディスクを拡張する</a></li><li><a href="#toc8" tabindex="0">GEOM RAID3 デバイスを終了 (破壊) する</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM RAID3 のイメージ</span></h2>



<p class="wp-block-paragraph">RAID3 のイメージはこのような形です．ディスク3本の場合，5本の場合を表しています．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fadd59997&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fadd59997" class="wp-block-image size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="1453" height="405" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-14.png" alt="" class="wp-image-873" style="width:839px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-14.png 1453w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-14-300x84.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-14-546x152.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-14-768x214.png 768w" sizes="(max-width: 1453px) 100vw, 1453px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button></figure>



<h2 class="wp-block-heading"><span id="toc2">GEOM RAID3 の利用・管理</span></h2>



<p class="wp-block-paragraph">GEOM RAID3 は <strong><em>graid3</em></strong> というコマンドを通じて利用・管理を行います．簡単に触れますが，詳細はコマンドのオプションの詳細は FreeBSD の マニュアル「<a rel="noopener" href="http://www.koganemaru.co.jp/cgi-bin/mroff.cgi?subdir=man&amp;lc=1&amp;cmd=&amp;man=graid3&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">graid3</a>」を見てください．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3
usage: graid3 clear [-v] prov ...
       graid3 configure [-adfFhnrRvwW] name
       graid3 dump prov ...
       graid3 insert [-hv] &lt;-n number> name prov
       graid3 label [-hFnrvw] [-s blocksize] name prov prov prov ...
       graid3 rebuild [-v] name prov
       graid3 remove [-v] &lt;-n number> name
       graid3 stop [-fv] name ...
       graid3 help
       graid3 list [-a] [name ...]
       graid3 status [-ags] [name ...]
       graid3 load [-v]
       graid3 unload [-v]</pre>



<p class="wp-block-paragraph"><strong><em>gconcat</em></strong>, <strong><em>gstripe</em></strong> 等と違い <strong><em>create</em></strong> サブコマンドはなく，作成は <strong><em>label</em></strong> サブコマンドだけとなります．<br>(間違いがなくなるからこれでいいと思います)</p>



<h3 class="wp-block-heading"><span id="toc3">RAID3 ボリュームを作成してみる</span></h3>



<p class="wp-block-paragraph">RAID3 ボリュームを作成してマウントするまでの流れを以下に記載します．</p>



<p class="wp-block-paragraph">先に geom_raid3 カーネルモジュールをロードします．<br>その後，<strong><em>graid3 label</em></strong> コマンドで ディスク da1，da2，da3 を指定して RAID3 ボリュームの raid3-0 を作成します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># kldload geom_raid3

# kldstat
Id Refs Address                Size Name
 1   10 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff82319000     3218 intpm.ko
 3    1 0xffffffff8231d000     2180 smbus.ko
 4    1 0xffffffff82320000     7490 vmci.ko
 5    1 0xffffffff82328000     d788 geom_raid3.ko

# graid3 label raid3-0 da1 da2 da3</pre>



<p class="wp-block-paragraph">再起動時に必ず有効になるように明示的にロードさせる事をお勧めします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># cat /boot/loader.conf
geom_raid3_load="YES"</pre>



<p class="wp-block-paragraph"><strong><em>graid3 status</em></strong> コマンドでステータスを表示できます．<br>以下は raid3-0 のステータスです．da1，da2，da3 がコンポーネントとして含まれており，ステータスが COMPLETE の状態です．<br>COMPLETE の状態とは，この RAID3 ボリュームで指定しているディスクの同期が取れている状態となります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 status
         Name    Status  Components
raid3/raid3-0  COMPLETE  da1 (ACTIVE)
                         da2 (ACTIVE)
                         da3 (ACTIVE)</pre>



<p class="wp-block-paragraph"><strong><em>graid3 list</em></strong> コマンドで詳細を表示する事ができます．<br>100GB HDD 3本で構成している為，raid3-0 のボリュームが 200GB となっています．<br>また，da3 がパリティディスクとして指定されている事が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 list
Geom name: raid3-0
State: COMPLETE
Components: 3
Flags: NONE
GenID: 0
SyncID: 1
ID: 2182500346
Zone64kFailed: 0
Zone64kRequested: 0
Zone16kFailed: 0
Zone16kRequested: 0
Zone4kFailed: 0
Zone4kRequested: 50
Providers:
1. Name: raid3/raid3-0
   Mediasize: 214748363776 (200G)
   Sectorsize: 1024
   Mode: r0w0e0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 0
   Type: DATA
2. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 1
   Type: DATA
3. Name: da3
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 2
   Type: PARITY</pre>



<p class="wp-block-paragraph"><strong><em>newfs</em></strong> でファイルシステムを作成します．指定するデバイスは GEOM RAID3 の場合は /dev/raid3 以下に指定した名前のデバイスファイルが作成されますので，これを指定します．<br>今回は作成の際に raid3-0 を名前としたため，<strong>/dev/raid3/raid3-0</strong> がデバイスファイルとなります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># newfs /dev/raid3/raid3-0
/dev/raid3/raid3-0: 204800.0MB (419430392 sectors) block size 32768, fragment size 4096
        using 328 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,
....</pre>



<p class="wp-block-paragraph">マウントおよびマウントの結果です．/mnt にマウントをしています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># mount /dev/raid3/raid3-0 /mnt

# df
Filesystem         1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2          19279260 2591140  15145780    15%    /
devfs                      1       1         0   100%    /dev
/dev/raid3/raid3-0 203123604       8 186873708     0%    /mnt</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc4">IOについて確認してみる</span></h2>



<p class="wp-block-paragraph">RAID3 はデータは分散して書き込み，パリティを1本が受け持つ形となります．従ってすべてのディスクに IO がかかるのですが，実際にどの様な IO が発生しているのかを確認してみます．</p>



<p class="wp-block-paragraph">dd でランダムデータを生成，random.img としてファイル書き込みの IO を発生させました．<br>見て頂くと分かる通り da1 と da2 の両方に IO がかかっています．<br>このことから，分散してのディスクの読み書きが行われる事が分かります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># dd if=/dev/random of=/mnt/random.img

# iostat -n 4 2
       tty             da0              da1              da2              da3             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1    79 18.7    2   0.0   169    4   0.7   169    4   0.7   172    4   0.7   0  0  1  0 99
   0   285  0.0    0   0.0   256   35   8.9   256   35   8.7   256   31   7.9   1  0  6  0 93
   0   177  0.0    0   0.0   255  132  32.8   255  137  34.0   255  136  33.8   1  0 28  0 71
   0   113  0.0    0   0.0   256   65  16.2   256   56  14.0   256   60  15.0   1  0 12  0 87
   0   109  0.0    0   0.0   240   22   5.2   243   28   6.6   242   25   6.0   0  0  5  0 95

# ls /mnt
.snap           random.img</pre>



<p class="wp-block-paragraph">イメージとしてはこのような形ですね．</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="484" height="521" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-15.png" alt="" class="wp-image-874" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-15.png 484w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-15-300x323.png 300w" sizes="(max-width: 484px) 100vw, 484px" /></figure>



<h2 class="wp-block-heading"><span id="toc5">障害発生時のディスク交換手順 (完全に見えなくなった場合)</span></h2>



<p class="wp-block-paragraph">ディスクが故障した際に，交換，リビルドが必要になります．<br>今回は da1 が故障したというシチュエーションで復旧を試みます．</p>



<p class="wp-block-paragraph">障害の状態によりますが，ディスクが停止してしまったなどが発生すると <strong><em>status</em></strong> サブコマンドの結果はこのように <strong>DEGRADED</strong> となり，da1 の表記が無くなります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 status
         Name    Status  Components
raid3/raid3-0  DEGRADED  da2 (ACTIVE)
                         da3 (ACTIVE)</pre>



<p class="wp-block-paragraph">このような場合は新しいディスクに交換後 <strong><em>insert</em></strong> サブコマンドを使用して組み込みを行います．<br>組み込みが成功すると <strong><em>status </em></strong>サブコマンドでリビルドが実行されている事が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 insert raid3-0 da1

# graid3 status
         Name    Status  Components
raid3/raid3-0  DEGRADED  da2 (ACTIVE)
                         da3 (ACTIVE)
                         da1 (SYNCHRONIZING, 2%)</pre>



<p class="wp-block-paragraph">リビルドが完了すると <strong><em>status</em></strong> サブコマンドの結果は COMPLETE になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 status
         Name    Status  Components
raid3/raid3-0  COMPLETE  da2 (ACTIVE)
                         da3 (ACTIVE)
                         da1 (ACTIVE)</pre>



<h2 class="wp-block-heading"><span id="toc6">自発的にディスクを交換する (メディアエラー等の不調の場合)</span></h2>



<p class="wp-block-paragraph">ディスクが突然見えなくなるという障害より，セクター不良等のメディアエラーの障害のケースが多いと思います．<br>ここでは，自発的にディスクを交換する手順を説明します．</p>



<p class="wp-block-paragraph">メディアエラーが出たとしても即 DEGRADED になるわけではありません．<br>以下のようにステータス上は問題が無いとしても例えば messages や dmesg で da2 にエラーの兆候が出てたとします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 status
         Name    Status  Components
raid3/raid3-0  COMPLETE  da2 (ACTIVE)
                         da3 (ACTIVE)
                         da1 (ACTIVE)

エラー例
(da2:ahcich3:0:0:0): WRITE_FPDMA_QUEUED. ACB: 61 08 e0 4d 50 40 5a 01 00 00 00 00
(da2:ahcich3:0:0:0): CAM status: Command timeout
(da2:ahcich3:0:0:0): Retrying command, 3 more tries remain</pre>



<p class="wp-block-paragraph">まずは da2 を取り外します．取り外すにあたって <strong><em>list</em></strong> サブコマンドを利用してディスク番号を確認します．<br>この場合，da2 は 1 になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 list
Geom name: raid3-0
State: COMPLETE
Components: 3
Flags: NONE
GenID: 0
SyncID: 1
ID: 2182500346
Zone64kFailed: 0
Zone64kRequested: 990
Zone16kFailed: 0
Zone16kRequested: 1205
Zone4kFailed: 0
Zone4kRequested: 2141
Providers:
1. Name: raid3/raid3-0

Consumers:
1. Name: da2
   Number: 0

2. Name: da3
   Number: 1

3. Name: da1
   Number: 2</pre>



<p class="wp-block-paragraph">続いて <strong><em>remove</em></strong> サブコマンドで取り外します．<br>取り外すとステータスは <strong>DEGRADED</strong> に変化します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 remove -n 1 raid3-0

# graid3 status
         Name    Status  Components
raid3/raid3-0  DEGRADED  da3 (ACTIVE)
                         da1 (ACTIVE)
</pre>



<p class="wp-block-paragraph">新しいディスクに交換後 <strong><em>insert</em></strong> サブコマンドを使用して組み込みを行います．<br>組み込みが成功すると <strong><em>status</em></strong> サブコマンドでリビルドが実行されている事が確認できます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 insert raid3-0 da2

# graid3 status
         Name    Status  Components
raid3/raid3-0  DEGRADED  da3 (ACTIVE)
                         da1 (ACTIVE)
                         da2 (SYNCHRONIZING, 1%)</pre>



<p class="wp-block-paragraph">リビルドが完了すると <strong><em>status</em></strong> サブコマンドの結果は <strong>COMPLETE</strong> になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 status
         Name    Status  Components
raid3/raid3-0  COMPLETE  da3 (ACTIVE)
                         da1 (ACTIVE)
                         da2 (ACTIVE)</pre>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc7">ディスクを拡張する</span></h2>



<p class="wp-block-paragraph">GEOM MIRROR のように玉突きで大きなディスクに入れ替えていって拡張が出来るか確認してみましたが，どうやら出来ないようです．<br>ディスクの入れ替えは出来ますが，プロバイダー側デバイス (今回だと raid3-0) を拡張する方法がありませんでした．<br>GEOM CONCAT と組み合わせて拡張することは可能です．やり方は RAID10 と同様ですので「<a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a>」を参考にしてください．</p>



<h2 class="wp-block-heading"><span id="toc8">GEOM RAID3 デバイスを終了 (破壊) する</span></h2>



<p class="wp-block-paragraph">ファイルシステムとして用済みになった．であったり，別用途に転用する為に初期化したい場合を説明します．</p>



<p class="wp-block-paragraph">当然ながら，ファイルシステムはアンマウントする必要があります．<br>また，STRIPE や MIRROR の場合は <strong><em>destroy</em></strong> サブコマンドがあったのですが，RAID3 には存在しません．<br>従って <em>stop</em> で停止させる．という方法になります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 stop raid3-0

# graid3 status</pre>



<p class="wp-block-paragraph">もし間違って stop した場合ですが，ドキュメントだと load で再度読み込めるはずですが失敗します．再起動実施の上で load を行えば読み込めます．<br>再起動を行わずに復活させたい場合は再度 label を同じ引数で渡すことで復活させる事が可能です．<br>やらかしてしまった&#8230; という事案の場合は慌てずにそっと元に戻しましょう．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># graid3 label raid3-0 da1 da2 da3

# graid3 status
         Name    Status  Components
raid3/raid3-0  COMPLETE  da1 (ACTIVE)
                         da2 (ACTIVE)
                         da3 (ACTIVE)

# mount /dev/raid3/raid3-0 /mnt

# ls /mnt
.snap           random.img</pre>



<p class="wp-block-paragraph">以上で GEOM RAID3 の紹介を終わります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM STRIPE + MIRROR で RAID10 を構成してみる</title>
		<link>https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html</link>
					<comments>https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Tue, 05 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=864</guid>

					<description><![CDATA[今回は GEOM STRIPE と MIRROR を組み合わせた RAID10 について纏めてみたいと思います．ストライピングは複数のディスクを束ねた分散の読み書きが可能で IO 性能の向上が見込まれますが，耐障害性はあ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM STRIPE と MIRROR を組み合わせた RAID10 について纏めてみたいと思います．<br>ストライピングは複数のディスクを束ねた分散の読み書きが可能で IO 性能の向上が見込まれますが，耐障害性はありません．<br>一方，ミラーリングはデータを複数のディスクに保持する為耐障害性を得る事が可能となりますが，容量と IO 性能 はディスク1本分の性能となります．<br>その為ストライピングとミラーリングを組み合わせた RAID10 とする事で両方の弱点を補う事が可能となります．<br>デメリットは，RAID3 以降の技術と比較してディスク本数と容量の兼ね合いで損失が大きい事になります．通常，パフォーマンスは RAID10 の方が向上が見込めます．<br>「通常」というのは GEOM の仕組みだと制限があるのでこの書き方となっています．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-18" checked><label class="toc-title" for="toc-checkbox-18">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM による RAID10 のイメージ</a><ol><li><a href="#toc2" tabindex="0">RAID10 の作成</a></li></ol></li><li><a href="#toc3" tabindex="0">ディスクを拡張する</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM による RAID10 のイメージ</span></h2>



<p class="wp-block-paragraph">GEOM STRIPE と MIRROR の組み合わせによる RAID10 のイメージです．<br>MIRROR の2セットを STRIPE で束ねる事で容量と IO 性能の向上，耐障害性の向上が図れます．</p>



<figure class="wp-block-image aligncenter size-large"><img loading="lazy" decoding="async" width="546" height="492" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-12-546x492.png" alt="" class="wp-image-869" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-12-546x492.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-12-300x270.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-12.png 643w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<h3 class="wp-block-heading"><span id="toc2">RAID10 の作成</span></h3>



<p class="wp-block-paragraph">実施にあたり，カーネルモジュールは先にロードしておきます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""> cat /boot/loader.conf
geom_stripe_load="YES"
geom_mirror_load="YES"</pre>



<p class="wp-block-paragraph">まずは2つのミラーリングのセットを作成します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror label mirror0 da1 da2
root@bsd13:~ # gmirror label mirror1 da3 da4
root@bsd13:~ # gmirror status
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)
mirror/mirror1  COMPLETE  da3 (ACTIVE)
                          da4 (ACTIVE)

# gmirror list
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 226490004
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0

Geom name: mirror1
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 518624559
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror1
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0</pre>



<p class="wp-block-paragraph">続いて，作成したミラーリングデバイスをストライプで束ねます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gstripe label stripe0 /dev/mirror/mirror0 /dev/mirror/mirror1

# gstripe status
          Name  Status  Components
stripe/stripe0      UP  mirror/mirror0
                        mirror/mirror1

# gstripe list
Geom name: stripe0
State: UP
Status: Total=2, Online=2
Type: AUTOMATIC
Stripesize: 65536
ID: 200779422
Providers:
1. Name: stripe/stripe0
   Mediasize: 214748233728 (200G)
   Sectorsize: 512
   Stripesize: 65536
   Stripeoffset: 0
   Mode: r0w0e0
Consumers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Number: 0
2. Name: mirror/mirror1
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Number: 1</pre>



<p class="wp-block-paragraph">ファイルシステムを作成してマウントします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># newfs /dev/stripe/stripe0
/dev/stripe/stripe0: 204799.9MB (419430144 sectors) block size 32768, fragment size 4096
        using 328 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,
...

# mount /dev/stripe/stripe0 /mnt

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2591108  15145812    15%    /
devfs                       1       1         0   100%    /dev
/dev/stripe/stripe0 203123480       8 186873596     0%    /mnt</pre>



<p class="wp-block-paragraph">以上で RAID10 ボリュームの利用が可能となります．<br>ディスクが1本障害となった場合は GEOM MIRROR のディスク交換の手順「<a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html#toc7" target="_blank">ミラーデバイスを取り外す</a>」と「<a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html#toc6" target="_blank">ミラーデバイスを追加する</a>」で交換，リビルドが行えます．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc3">ディスクを拡張する</span></h2>



<p class="wp-block-paragraph">GEOM MIRROR を STRIPE で束ねている事から，さらに MIRROR デバイスを追加した拡張は「<a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#toc6" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる の ディスクを拡張する</a>」で記載したように実施出来ません．<br><br>MIRROR 側を玉突きで大きなディスクに入れ替えての拡張もこの構成だと上位レイヤーに STRIPE がある為不可能です．<br><br>今回のつくり方の場合，最初の段階で最大値を構成する必要がありますので注意してください．</p>



<p class="wp-block-paragraph">RAID10 については別のアプローチで実現が可能ですので改めて纏めたいと思います．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</title>
		<link>https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html</link>
					<comments>https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Mon, 04 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[MIRROR]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=858</guid>

					<description><![CDATA[前回に引き続き GEOM によるディスクのミラーリング (RAID1) について纏めてみたいと思います．前回は作成・削除・拡張について説明しましたが，今回は主に拡張の別のアプローチや管理面の説明となります． 目次 GEO [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">前回に引き続き GEOM によるディスクのミラーリング (RAID1) について纏めてみたいと思います．<br>前回は作成・削除・拡張について説明しましたが，今回は主に拡張の別のアプローチや管理面の説明となります．</p>



<ul class="wp-block-list">
<li>GEOM に関するお話
<ul class="wp-block-list">
<li><a href="https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html" target="_blank">FreeBSD GEOM 再々学習</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-%e3%82%b9%e3%83%88%e3%83%a9%e3%82%a4%e3%83%97-raid0-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE (ストライプ/RAID0) を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-1.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html" target="_blank">GEOM MIRROR (ミラーリング/RAID1) を使ってみる (2)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-stripe-mirror-%e3%81%a7-raid10-%e3%82%92%e6%a7%8b%e6%88%90%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM STRIPE + MIRROR で RAID10 を構成してみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-raid3%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM RAID3を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-cache-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CACHE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gvirstor%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GVIRSTORを使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-gate-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM GATE を使ってみる</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-label-%e3%81%a7%e5%90%8d%e5%89%8d%e3%81%ab%e3%82%88%e3%82%8b%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM LABEL で名前による管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-part-%e3%81%a7%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e7%ae%a1%e7%90%86%e3%82%92%e8%a1%8c%e3%81%86.html" target="_blank">GEOM PART でディスクパーティションの管理を行う</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-1.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (1)</a></li>



<li><a href="https://www.seichan.org/2023/12/geom-multipath-%e3%81%a7%e3%83%9e%e3%83%ab%e3%83%81%e3%83%91%e3%82%b9%e3%82%92%e6%a7%8b%e6%88%90%e3%81%99%e3%82%8b-2.html" target="_blank">GEOM MULTIPATH でマルチパスを構成する (2)</a></li>
</ul>
</li>
</ul>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-20" checked><label class="toc-title" for="toc-checkbox-20">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">GEOM CONCAT を併用してディスクを拡張する</a><ol><li><a href="#toc2" tabindex="0">mirror0 をコンカチデバイスの配下に組み入れる</a></li><li><a href="#toc3" tabindex="0">追加用の mirror ボリュームを作成する</a></li><li><a href="#toc4" tabindex="0">追加した mirror ボリュームをコンカチに組み入れる</a></li></ol></li><li><a href="#toc5" tabindex="0">GEOM MIRROR 管理</a></li><li><a href="#toc6" tabindex="0">読み出し方式の変更</a></li><li><a href="#toc7" tabindex="0">リビルド処理の自動化・手動化</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM CONCAT を併用してディスクを拡張する</span></h2>



<p class="wp-block-paragraph">前回は玉突きで大きなディスクに入れ替える．という手法を紹介しました．今回は別のアプローチとして，ミラーリング + コンカチ を紹介します．<br><strong>GEOM は重ね掛けでの利用が可能</strong>ですのでこういった方法も可能です．<br>拡張のイメージはこのような形です．</p>



<figure class="wp-block-image aligncenter size-large"><img loading="lazy" decoding="async" width="546" height="499" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-9-546x499.png" alt="" class="wp-image-859" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-9-546x499.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-9-300x274.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-9.png 691w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<p class="wp-block-paragraph">このような拡張を事前に考慮している場合は最初からコンカチまで GEOM でやっていればいいのですが，後から拡張したい場合もあると思います．<br>そのようなシチュエーションを考え，以下の流れでの拡張を紹介します．</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="546" height="152" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-546x152.png" alt="" class="wp-image-860" style="width:839px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-546x152.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-300x84.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-768x214.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-1536x429.png 1536w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-10-2048x571.png 2048w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



<p class="wp-block-paragraph">現状は上図の一番左の状態とします．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">gmirror status
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2591092 15145828    15%    /
devfs                       1       1        0   100%    /dev
/dev/mirror/mirror0 101561752   62888 93373924     0%    /mnt</pre>



<h3 class="wp-block-heading"><span id="toc2">mirror0 をコンカチデバイスの配下に組み入れる</span></h3>



<p class="wp-block-paragraph">まずはこの mirror0 デバイスをコンカチデバイスとして取り扱います．<strong><em>gconcat label</em></strong> で実行しますが，マウントしている状態だとこれは出来ない為，一度マウントを解除の上コマンドを発行します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># umount /mnt

# gconcat label concat0 /dev/mirror/mirror0

# gconcat status
          Name  Status  Components
concat/concat0      UP  mirror/mirror0</pre>



<p class="wp-block-paragraph"><strong><em>status</em></strong> サブコマンドで UP の状態であれば，このデバイスをマウントする事が可能です．データは mirror0 の時の物がそのまま維持されています．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># mount /dev/concat/concat0 /mnt

# ls /mnt
.snap           random.img</pre>



<h3 class="wp-block-heading"><span id="toc3">追加用の mirror ボリュームを作成する</span></h3>



<p class="wp-block-paragraph">続いて，拡張用の RAID1 ボリュームの mirror1 を作成します．<br><strong><em>label</em></strong> サブコマンドを用いて新しいミラーボリュームを作成，<strong><em>status</em></strong> サブコマンドで <strong>COMPLETE / ACTIVE</strong> を確認します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror label mirror1 da3 da4

# gmirror status
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)
mirror/mirror1  COMPLETE  da3 (ACTIVE)
                          da4 (ACTIVE)</pre>



<h3 class="wp-block-heading"><span id="toc4">追加した mirror ボリュームをコンカチに組み入れる</span></h3>



<p class="wp-block-paragraph">続いて，作成した mirror1 を concat0 に追加を行います．「<a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html" target="_blank">GEOM CONCAT (ディスクの連結) を使ってみる</a>」の「<a href="https://www.seichan.org/2023/12/geom-concat-%e3%83%87%e3%82%a3%e3%82%b9%e3%82%af%e3%81%ae%e9%80%a3%e7%b5%90-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b.html#toc6" target="_blank">ディスクを拡張する</a>」でも触れていますが，オンラインのままではできません．<br>ですので実際は上記でマウントを行っていますが行わずに一気に拡張をやってしまった方が時間は節約できます．<br>ただ，オペレーションの都度確認を入れたほうが安全ではあります．</p>



<p class="wp-block-paragraph">以下一気に記載をしてしまっていますが，<br>アンマウントを行い，<strong><em>gconcat label</em></strong> で mirror1 の追加を行っています．<br>その後ステータスを確認してマウントを行っています．この状態だとまだ容量は増えていません．<br>最後に <strong><em>growfs</em></strong> でファイルシステムの拡張を行いました．<br>なお，<strong><em>growfs</em></strong> はオンライン/オフラインどちらでも実施が可能です．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># umount /mnt

# gconcat label concat0 /dev/mirror/mirror0 /dev/mirror/mirror1

# gconcat status
          Name  Status  Components
concat/concat0      UP  mirror/mirror0
                        mirror/mirror1
# gconcat list
Geom name: concat0
State: UP
Status: Total=2, Online=2
Type: AUTOMATIC
ID: 945551655
Providers:
1. Name: concat/concat0
   Mediasize: 214748362752 (200G)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Start: 0
   End: 107374181376
2. Name: mirror/mirror1
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Start: 107374181376
   End: 214748362752

# mount /dev/concat/concat0 /mnt

# growfs /dev/concat/concat0
Device is mounted read-write; resizing will result in temporary write suspension for /mnt.
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/concat/concat0, mounted on /mnt, from 100GB to 200GB? [yes/no] yes
super-block backups (for fsck_ffs -b #) at:
 209993664, 211274112, 212554560, 213835008, 215115456, 216395904, 217676352, 218956800, 220237248, 221517696, 222798144,
 224078592, 225359040, 226639488, 227919936, 229200384, 230480832, 231761280, 233041728, 234322176, 235602624, 236883072,
 238163520, 239443968, 240724416, 242004864, 243285312, 244565760, 245846208, 247126656, 248407104, 249687552, 250968000,
 252248448, 253528896, 254809344, 256089792, 257370240, 258650688, 259931136, 261211584, 262492032, 263772480, 265052928,

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2591088  15145832    15%    /
devfs                       1       1         0   100%    /dev
/dev/concat/concat0 203123604   62888 186810828     0%    /mnt</pre>



<p class="wp-block-paragraph">一度オフラインにする必要がある．という制限はありますが，玉突きではなく純増で増やしていきたい場合の方法として，GEOM MIRROR + CONCAT という手法を紹介しました．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>



<h2 class="wp-block-heading"><span id="toc5">GEOM MIRROR 管理</span></h2>



<p class="wp-block-paragraph">前回，作成・削除・拡張を特にオプション無しで実施していますが，GEOM MIRROR には GEOM STRIPE や CONCAT と違ってサブコマンドやオプションが豊富です．<br>ここで少し紹介したいと思います．</p>



<p class="wp-block-paragraph"><strong><em>gmirror list</em></strong> を実行すると先頭に Balance は Slice，Type 等の項目が表示されます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r1w1e2</pre>



<h2 class="wp-block-heading"><span id="toc6">読み出し方式の変更</span></h2>



<p class="wp-block-paragraph">Balance は4つあり，ディスクの読み出しの際にどういったアクセスを行うか．を決定するものになります．</p>



<ul class="wp-block-list">
<li>load<br>IO負荷の低いディスクから読み出しを行います．label や create 時に指定しない場合これがデフォルトとして採用されます</li>



<li>prefer<br>mirror 内の Priority 値が大きいディスクから読み出しを行います</li>



<li>round-robin<br>ラウンドロビンで読み出しを行います</li>



<li>split<br>指定のバイト数毎に読み取るディスクを切り替えていく方式となります</li>
</ul>



<p class="wp-block-paragraph">基本的にはデフォルトの load でもよいと思いますが，読み出しの割合が多い環境でパフォーマンスを引き出したい場合は round-robin や split を選択するのは有効だと思います．</p>



<p class="wp-block-paragraph">変更する場合は <strong><em>configure</em></strong> サブコマンドで設定値を変更が可能です．round-robin にする場合はこのような形となります．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror configure -b round-robin mirror0

# gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC
</pre>



<p class="wp-block-paragraph">split の場合は <strong><em>configure</em></strong> サブコマンドでオプションを2つ渡します．-s を指定しない場合は 4096 byte がデフォルト値として採用されます．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror configure -b split -s 8192 mirror0

# gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: split
Slice: 8192
Flags: NONE
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC
</pre>



<p class="wp-block-paragraph">prefer の場合も <strong><em>configure</em></strong> サブコマンドを使用します．<br>その後，デバイスの優先度を変更します．Consumers の Priority が変化している事を確認します．<br>(長くなるので Priority だけ記載しています)</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror configure -b prefer mirror0

# gmirror configure -p 10 mirror0 da1

# gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: prefer
Slice: 8192
Flags: NONE
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r1w1e2
Consumers:
1. Name: da1
   Priority: 10
2. Name: da2
   Priority: 1</pre>



<h2 class="wp-block-heading"><span id="toc7">リビルド処理の自動化・手動化</span></h2>



<p class="wp-block-paragraph">Type は AUTOMATIC と NOAUTOSYNC の2つがあります．自動で同期処理を行うのか，マニュアル制御で行うのか．という違いになります．<br>手動でオペレーションを行わないといけない．というシチュエーションは少ないと思いますが，方法を記載します．<br>こちらも <strong><em>configure</em></strong> サブコマンドを用いて設定します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror configure -n mirror0

# gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: round-robin
Slice: 4096
Flags: NOAUTOSYNC
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC
</pre>



<p class="wp-block-paragraph">手動から自動に戻したい場合も同様に <strong><em>configure</em></strong> サブコマンドを用いて設定します．</p>



<pre class="EnlighterJSRAW" data-enlighter-language="shell" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># gmirror configure -a mirror0

# gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3673431046
Type: AUTOMATIC</pre>



<p class="wp-block-paragraph">以上で GEOM MIRROR によるミラーリングについての解説を終わります．</p>


<div class=".for-sp">
<div class="table">
<span class="body">
<!-- imobile wiki_上部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846007"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_上部_SP_1 -->
</span>
<span class="body">
<!-- imobile wiki_下部_SP_1 -->
<script type="text/javascript">
 imobile_tag_ver = "0.3"; 
 imobile_pid = "81546"; 
 imobile_asid = "1846017"; 
 imobile_type = "inline";
</script>
<script type="text/javascript" src="https://spad.i-mobile.co.jp/script/adssp.js?20110215"></script>
<!-- imobile wiki_下部_SP_1 -->
</span>
</div>
</div>

<div class=".for-pc">
<div class="table">
<span class="body">
<!-- imobile blog_seichan_記事中_1 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1846028"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_1 -->
</span>
<span class="body">
<!-- imobile blog_seichan_記事中_2 -->
<script type="text/javascript">
 imobile_pid = "81546"; 
 imobile_asid = "1845876"; 
 imobile_width = 300; 
 imobile_height = 250;
</script>
<script type="text/javascript" src="https://spdeliver.i-mobile.co.jp/script/ads.js?20101001"></script>
<!-- imobile blog_seichan_記事中_2 -->
</span>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/12/geom-mirror-%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0-raid1-%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-2.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
