<?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>RAID | 徒然なるままに</title>
	<atom:link href="https://www.seichan.org/tag/raid/feed" rel="self" type="application/rss+xml" />
	<link>https://www.seichan.org</link>
	<description>徒然と日々の出来事(ネタ)を書いていこうかと．主に FreeBSD，Unix系の話題が中心ですが，その他の話題もあつかってみたり．</description>
	<lastBuildDate>Sun, 24 Mar 2024 00:44:42 +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 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-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">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 fetchpriority="high" 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-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">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 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;6ab8fad1ade46&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1ade46" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img 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;6ab8fad1aea3d&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1aea3d" 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;6ab8fad1afb90&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1afb90" 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-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">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;6ab8fad1bbd28&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1bbd28" 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-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">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;6ab8fad1c4ca0&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1c4ca0" 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-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 による 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-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 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>
		<item>
		<title>GEOM MIRROR (ミラーリング/RAID1) を使ってみる (1)</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-1.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-1.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Sun, 03 Dec 2023 17:05:01 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=840</guid>

					<description><![CDATA[今回は GEOM によるディスクのミラーリング (RAID1) について纏めてみたいと思います．ミラーリングは複数のディスクに対して同じデータを格納し、ディスク障害が発生してもデータの損失を防ぐ技術です．コンカチやストラ [&#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-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 MIRROR のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM MIRROR の利用・管理</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">IOについて確認してみる</a></li><li><a href="#toc6" tabindex="0">GEOM RAID MIRROR デバイスを管理する</a><ol><li><a href="#toc7" tabindex="0">ミラーデバイスを追加する</a></li><li><a href="#toc8" tabindex="0">ミラーデバイスを取り外す</a></li><li><a href="#toc9" tabindex="0">ディスクを拡張する</a></li><li><a href="#toc10" tabindex="0">GEOM MIRROR デバイスを終了 (破壊) する</a></li></ol></li></ol>
    </div>
  </div>

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



<p class="wp-block-paragraph">ミラーリングのイメージはこのような形です．ディスクが2本の場合，３本の場合を表しています．</p>



<figure class="wp-block-image aligncenter size-large"><img loading="lazy" decoding="async" width="546" height="259" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-5-546x259.png" alt="" class="wp-image-842" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-5-546x259.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-5-300x142.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-5-768x365.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-5.png 851w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



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



<p class="wp-block-paragraph">GEOM MIRROR は <strong><em>gmirror</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=gmirror&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">gmirror</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=""># gmirror
usage: gmirror activate [-v] name prov ...
       gmirror clear [-v] prov ...
       gmirror configure [-adfFhnv] [-b balance] [-s slice] name
       gmirror configure [-v] -p priority name prov
       gmirror create [-Fnv] [-b balance] [-s slice] name prov ...
       gmirror deactivate [-v] name prov ...
       gmirror destroy [-fv] name ...
       gmirror dump prov ...
       gmirror forget name ...
       gmirror label [-Fhnv] [-b balance] [-s slice] name prov ...
       gmirror insert [-hiv] [-p priority] name prov ...
       gmirror rebuild [-v] name prov ...
       gmirror remove [-v] name prov ...
       gmirror resize [-s size] [-v] name
       gmirror stop [-fv] name ...
       gmirror help
       gmirror list [-a] [name ...]
       gmirror status [-ags] [name ...]
       gmirror load [-v]
       gmirror 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 は一時的，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>gmirror create</em></strong> コマンドで ディスク da1 と da2 をミラーリングして 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=""># kldload geom_mirror
# gmirror create mirror0 da1 da2</pre>



<p class="wp-block-paragraph"><strong><em>gconcat</em></strong> や <strong><em>gstripe</em></strong> の場合はコマンド実行時に自動でカーネルモジュールがロードされるのですが，<strong><em>gmirror</em></strong> は<strong>「gmirror: Class not found: &#8220;MIRROR&#8221;」</strong>というエラーが出力されてしまいます．<br>ですのでコマンド実行前に明示的にモジュールをロードさせてから <strong><em>gmirror</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=""># 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     fef0 geom_mirror.ko</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_mirror_load="YES"</pre>



<p class="wp-block-paragraph"><strong><em>gmirror status</em></strong> コマンドでステータスを表示できます．<br>以下は mirror0 のステータスです．da1, da2 がコンポーネントとして含まれており，ステータスが COMPLETE の状態です．<br>COMPLETE の状態とは，このミラーリングで指定しているディスクの同期が取れている状態となります．</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)</pre>



<p class="wp-block-paragraph"><strong><em>gmirror list</em></strong> コマンドで詳細を表示する事ができます．<br>da1, da2 が 100GB のディスクでこれを RAID1 でミラーリングしている為，mirror0 は 100G となっています．</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
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 2029918663
Type: MANUAL
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 3804043814
2. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 1
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 3614838224</pre>



<p class="wp-block-paragraph"><strong><em>newfs</em></strong> でファイルシステムを作成します．指定するデバイスは GEOM MIRROR の場合は <strong>/dev/mirror</strong> 以下に指定した名前のデバイスファイルが作成されますので，これを指定します．<br>今回は <strong><em>create</em></strong> の際に mirror0 を名前としたため，<strong>/dev/mirror/mirror0</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/mirror/mirror0
/dev/mirror/mirror0: 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,
....</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/mirror/mirror0 /mnt

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2590868 15146052    15%    /
devfs                       1       1        0   100%    /dev
/dev/mirror/mirror0 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/mirror/mirror0     /mnt    ufs     rw      1       1</pre>



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



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fad1d6afc&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1d6afc" 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-3_22-0-27_No-00.png" alt="" class="wp-image-845" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-3_22-0-27_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-3_22-0-27_No-00-300x217.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-3_22-0-27_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> で 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=""># gmirror label mirror0 da1 da2</pre>



<p class="wp-block-paragraph">同じディスクを同じように指定している為，<strong><em>status</em></strong> および <strong><em>list</em></strong> の結果は先ほどと変わりません．<br>また，<strong><em>create</em></strong> で作成した際に <strong><em>newfs</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 status mirror0
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)

# gmirror status mirror0
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)
root@bsd13:~ # gmirror list mirror0
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 4078222260
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 3192641748
2. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 1
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 159192916</pre>



<p class="wp-block-paragraph">ですので，<strong><em>create</em></strong> と <strong><em>label</em></strong> を間違った&#8230; という場合でも正しくコマンドを発行してあげる事で今までの状態を復元できますので，データがなくなってしまった．という事は起きませんので安心してください．<br>いずれにせよ&#8230; <strong><em>label</em></strong> で作成しましょう．が教訓となりますが&#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=""># mount /dev/mirror/mirror0 /mnt

# df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2590884 15146036    15%    /
devfs                       1       1        0   100%    /dev
/dev/mirror/mirror0 101561756       8 93436808     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="toc5">IOについて確認してみる</span></h2>



<p class="wp-block-paragraph">ミラーリングですので，ミラーしているディスク全てに同じデータが書き込まれます．実際にどの様な 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 2
       tty             da0              da1              da2             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   0     4 17.7    0   0.0   223    0   0.0   230    0   0.0   0  0  0  0 100
   0   231 32.0    0   0.0   256   45  11.2   256   53  13.2   1  0  4  0 96
   0   159  0.0    0   0.0   256   34   8.6   256   39   9.8   0  0  4  0 96
   0    81  0.0    0   0.0   255  156  38.8   254  142  35.3   1  0 16  0 83
   0    79  0.0    0   0.0   256  116  29.1   256  114  28.6   1  0 11  0 88

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



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



<figure class="wp-block-image aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="307" height="513" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-7.png" alt="" class="wp-image-849" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-7.png 307w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-7-300x501.png 300w" sizes="(max-width: 307px) 100vw, 307px" /></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="toc6">GEOM RAID MIRROR デバイスを管理する</span></h2>



<h3 class="wp-block-heading"><span id="toc7">ミラーデバイスを追加する</span></h3>



<p class="wp-block-paragraph">ミラー先を追加，取り外しを行う事でのバックアップ運用が可能です．2つ以上のディスクをローテーションして管理する事で複数世代のバックアップも可能です．<br>もちろん，オペミスだったり，取り外したディスクの管理 (静電袋に入れてエアキャップ保存とか) は重要になります．</p>



<p class="wp-block-paragraph">ミラーの追加は <strong><em>insert</em></strong> サブコマンドを使用して行う事が可能です．<br>追加後のステータスを確認すると <strong>DEGRADED</strong> 状態となり，追加したデバイスが <strong>SYNCHRONIZING</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 insert mirror0 da3

# gmirror status mirror0
          Name    Status  Components
mirror/mirror0  DEGRADED  da1 (ACTIVE)
                          da2 (ACTIVE)
                          da3 (SYNCHRONIZING, 3%)
</pre>



<h3 class="wp-block-heading"><span id="toc8">ミラーデバイスを取り外す</span></h3>



<p class="wp-block-paragraph">同期が完了したら取り外す事が可能です．<br>取り外しは <strong><em>remove</em></strong> サブコマンドを使用して行う事が可能です．</p>



<p class="wp-block-paragraph">まずはステータスが <strong>COMPLETE</strong> である事を確認します．<br>その次に <strong><em>remove</em></strong> でディスクをミラーから切り離します．その後，切り離しが完了した事を確認します．<br>この場合は da3 を切り離しを行っており，<strong><em>status</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 status mirror0
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)
                          da3 (ACTIVE)

# gmirror remove mirror0 da3

# gmirror status mirror0
          Name    Status  Components
mirror/mirror0  COMPLETE  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>



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



<p class="wp-block-paragraph">ディスク というか，ファイルシステムを拡張する事が可能です．<br>今回説明するシチュエーションとしては，da1, da2 を玉突きで大きいディスクに置き換えていく．というシチュエーションを想定して説明します．</p>



<p class="wp-block-paragraph">このようなイメージで da1 を取り外し，大きなディスクに交換の上ミラーに組み込み．<br>da2 を取り外し，大きなディスクに交換の上ミラーに組み込み．という流れとなります．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fad1d798b&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1d798b" class="wp-block-image size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="1818" height="415" 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-8.png" alt="" class="wp-image-850" style="width:828px;height:auto" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-8.png 1818w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-8-300x68.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-8-546x125.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-8-768x175.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-8-1536x351.png 1536w" sizes="(max-width: 1818px) 100vw, 1818px" /><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><em>remove</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 status
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)
# gmirror remove mirror0 da1
# gmirror status
          Name    Status  Components
mirror/mirror0  COMPLETE  da2 (ACTIVE)
</pre>



<p class="wp-block-paragraph">次に容量の大きいディスクと交換し <strong><em>insert</em></strong> サブコマンドを実行して mirror0 に組み込みます．<br><strong><em>status</em></strong> サブコマンドで確認するとリビルド処理が走っている事が確認できます．</p>



<p class="wp-block-paragraph">また，<strong><em>list</em></strong> サブコマンドで確認すると da1 が 150GB である事が確認できます．</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 insert mirror0 da1

# gmirror status
          Name    Status  Components
mirror/mirror0  DEGRADED  da2 (ACTIVE)
                          da1 (SYNCHRONIZING, 0%)

# gmirror list
Geom name: mirror0
State: DEGRADED
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3318650467
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r2w1e1
Consumers:
1. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 1
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 3061855275
2. Name: da1
   Mediasize: 161061273600 (150G)
   Sectorsize: 512
   Mode: r1w1e1
   State: SYNCHRONIZING
   Priority: 0
   Flags: DIRTY, SYNCHRONIZING
   GenID: 0
   SyncID: 1
   BytesSynced: 1282408448
   Synchronized: 1%
   ID: 1348065949
</pre>



<p class="wp-block-paragraph"><strong><em>status</em></strong> サブコマンドで <strong>COMPLETE</strong> である事を確認し，<strong><em>remove</em></strong> サブコマンドで da2 の切り離しを行います．<br>その後容量の大きいディスクに入れ替えて <em>insert</em> サブコマンドで mirror0 に組み込みます．<br><strong><em>status</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 status
          Name    Status  Components
mirror/mirror0  COMPLETE  da2 (ACTIVE)
                          da1 (ACTIVE)

# gmirror remove mirror0 da2

# gmirror status
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)

# gmirror insert mirror0 da2

# gmirror status mirror0
          Name    Status  Components
mirror/mirror0  DEGRADED  da1 (ACTIVE)
                          da2 (SYNCHRONIZING, 0%)
</pre>



<p class="wp-block-paragraph">この際，<strong><em>list</em></strong> サブコマンドで確認すると，<strong>da1，da2 の両方が 150GB ですが，mirror0 は 100GB のまま</strong>となっています．<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=""># gmirror list mirror0
Geom name: mirror0
State: DEGRADED
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3318650467
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r2w1e1
Consumers:
1. Name: da1
   Mediasize: 161061273600 (150G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 1348065949
2. Name: da2
   Mediasize: 161061273600 (150G)
   Sectorsize: 512
   Mode: r1w1e1
   State: SYNCHRONIZING
   Priority: 0
   Flags: DIRTY, SYNCHRONIZING
   GenID: 0
   SyncID: 1
   BytesSynced: 9633267712
   Synchronized: 8%
   ID: 2184573350
</pre>



<p class="wp-block-paragraph">リビルドが完了したら，<strong><em>resize</em></strong> サブコマンドを実行して mirror0 の拡張を行います．<br>その後 <strong><em>list</em></strong> サブコマンドで <strong>mirror0 の容量が増えている事</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 status mirror0
          Name    Status  Components
mirror/mirror0  COMPLETE  da1 (ACTIVE)
                          da2 (ACTIVE)

# gmirror resize mirror0

# gmirror list
Geom name: mirror0
State: COMPLETE
Components: 2
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3318650467
Type: AUTOMATIC
Providers:
1. Name: mirror/mirror0
   Mediasize: 161061273088 (150G)
   Sectorsize: 512
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 161061273600 (150G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 1348065949
2. Name: da2
   Mediasize: 161061273600 (150G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 2184573350</pre>



<p class="wp-block-paragraph">ただし，まだこの時点ではファイルシステムは現状のままですので <strong><em>growfs</em></strong> でファイルシステムを拡張する必要があります．<br><strong><em>growfs</em></strong> は<strong>オンライン (マウントした状態) で実施可能</strong>です．<em>growfs</em> 実施前後の df の結果を見ると正しく拡張されている事が確認できます．</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=""># df
Filesystem          1K-blocks    Used    Avail Capacity  Mounted on
/dev/da0p2           19279260 2590916 15146004    15%    /
devfs                       1       1        0   100%    /dev
/dev/mirror/mirror0 101561752   89608 93347204     0%    /mnt

# growfs /dev/mirror/mirror0
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/mirror/mirror0, mounted on /mnt, from 100GB to 150GB? [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 2590916  15146004    15%    /
devfs                       1       1         0   100%    /dev
/dev/mirror/mirror0 152342680   89608 140065660     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>



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



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



<p class="wp-block-paragraph">当然ながら，ファイルシステムはアンマウントする必要があります．<br>また，完全に終了 (停止・破壊) する場合は <strong><em>stop</em></strong> ではなく <strong><em>destroy</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
# gmirror destroy mirror0
# gmirror list</pre>



<p class="wp-block-paragraph">もし間違って <strong><em>destory</em></strong> を実行してしまった場合ですが，これだけのオペレーションの場合だと <strong><em>label</em></strong> 情報がなくなっただけなので，再度 <strong><em>label</em></strong> を同じ引数で渡すことで復活させる事が可能です．<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=""># gmirror label mirror0 da1 da2
# mount /dev/mirror/mirror0 /mnt
# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2590920  15146000    15%    /
devfs                       1       1         0   100%    /dev
/dev/mirror/mirror0 152342680   89608 140065660     0%    /mnt

# ls /mnt
.snap           random.img</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>
]]></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-1.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GEOM STRIPE (ストライプ/RAID0) を使ってみる</title>
		<link>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</link>
					<comments>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#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Sat, 02 Dec 2023 13:00:00 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[STRIPE]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=817</guid>

					<description><![CDATA[今回は GEOM によるディスクのストライピング (RAID0) について纏めてみたいと思います．ストライピングは複数のディスクを分散して読み書き利用する技術で，大きなディスク領域の確保，読み書き速度の向上を図る技術です [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">今回は GEOM によるディスクのストライピング (RAID0) について纏めてみたいと思います．<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-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 STRIPE のイメージ</a></li><li><a href="#toc2" tabindex="0">GEOM STRIPE の利用・管理</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">IOについて確認してみる</a></li><li><a href="#toc6" tabindex="0">ディスクを拡張する</a></li><li><a href="#toc7" tabindex="0">GEOM STRIPE デバイスを終了 (破壊) する</a></li></ol>
    </div>
  </div>

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



<p class="wp-block-paragraph">ストライピングのイメージはこのような形です．ディスクが2本の場合，３本の場合を表しています．</p>



<figure class="wp-block-image aligncenter size-large"><img loading="lazy" decoding="async" width="546" height="258" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-3-546x258.png" alt="" class="wp-image-820" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-3-546x258.png 546w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-3-300x142.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-3-768x362.png 768w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-3.png 856w" sizes="(max-width: 546px) 100vw, 546px" /></figure>



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



<p class="wp-block-paragraph">GEOM STRIPE は <strong><em>gstripe</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=gstripe&amp;dir=jpman-13.2.2%2Fman&amp;sect=0" target="_blank">gstripe</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=""># gstripe
usage: gstripe clear [-v] prov ...
       gstripe create [-v] [-s stripesize] name prov prov ...
       gstripe destroy [-fv] name ...
       gstripe dump prov ...
       gstripe label [-hv] [-s stripesize] name prov prov ...
       gstripe stop [-fv] name ...
       gstripe help
       gstripe list [-a] [name ...]
       gstripe status [-ags] [name ...]
       gstripe load [-v]
       gstripe unload [-v]</pre>



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



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



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



<p class="wp-block-paragraph"><strong><em>gstripe create</em></strong> コマンドで ディスク da1 と da2 をストライピングして stripe0 を作成します．</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 create stripe0 da1 da2</pre>



<p class="wp-block-paragraph"><strong><em>gstripe create</em></strong> や <strong><em>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="">root@bsd13:/ # kldstat
Id Refs Address                Size Name
 1   10 0xffffffff80200000  1f3e2d0 kernel
 3    1 0xffffffff82319000     3218 intpm.ko
 4    1 0xffffffff8231d000     2180 smbus.ko
 5    1 0xffffffff82320000     7490 vmci.ko
 6    1 0xffffffff82328000     44a0 geom_stripe.ko</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_stripe_load="YES"</pre>



<p class="wp-block-paragraph"><strong><em>gstripe status</em></strong> コマンドでステータスを表示できます．<br>以下は stripe0 のステータスです．da1, 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=""># gstripe status
          Name  Status  Components
stripe/stripe0      UP  da1
                        da2</pre>



<p class="wp-block-paragraph"><strong><em>gstripe list</em></strong> コマンドで詳細を表示する事ができます．<br>da1, da2 が 100GB のディスクでこれを RAID0 でストライピングしている為，stripe0 は 200G となっています．</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 list
Geom name: stripe0
State: UP
Status: Total=2, Online=2
Type: MANUAL
Stripesize: 65536
ID: 2870193427
Providers:
1. Name: stripe/stripe0
   Mediasize: 214748364800 (200G)
   Sectorsize: 512
   Stripesize: 65536
   Stripeoffset: 0
   Mode: r0w0e0
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Number: 0
2. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   Number: 1</pre>



<p class="wp-block-paragraph"><strong><em>newfs</em></strong> でファイルシステムを作成します．指定するデバイスは GEOM STRIPE の場合は <strong>/dev/stripe 以下に指定した名前のデバイスファイルが作成されます</strong>ので，これを指定します．<br>今回は create の際に stripe0 を名前としたため，<strong>/dev/stripe/stripe0</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/stripe/stripe0
/dev/stripe/stripe0: 204800.0MB (419430400 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 にマウントをしています．<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/stripe/stripe0 /mnt

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2582452  15154468    15%    /
devfs                       1       1         0   100%    /dev
/dev/stripe/stripe0 203123608       8 186873712     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/stripe/stripe0     /mnt    ufs     rw      1       1</pre>



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



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fad1e0213&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1e0213" class="wp-block-image aligncenter size-full is-resized wp-lightbox-container"><img loading="lazy" decoding="async" width="764" height="556" 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-1_19-0-52_No-00.png" alt="" class="wp-image-822" style="width:768px" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-1_19-0-52_No-00.png 764w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-1_19-0-52_No-00-300x218.png 300w, https://www.seichan.org/blog/wp-content/uploads/2023/12/SnapCrab_bsd13seichanlocal-VMware-Workstation_2023-12-1_19-0-52_No-00-546x397.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> で stripe0 を作成しました．</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 da1 da2</pre>



<p class="wp-block-paragraph">同じディスクを同じように指定している為，<strong><em>status</em></strong> および <strong><em>list</em></strong> の結果は先ほどと変わりません．<br>また，<strong><em>create</em></strong> で作成した際に <strong><em>newfs</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=""># gstripe status stripe0
          Name  Status  Components
stripe/stripe0      UP  da1
                        da2

# gstripe list stripe0
Geom name: stripe0
State: UP
Status: Total=2, Online=2
Type: AUTOMATIC
Stripesize: 65536
ID: 2858675290
Providers:
1. Name: stripe/stripe0
   Mediasize: 214748233728 (200G)
   Sectorsize: 512
   Stripesize: 65536
   Stripeoffset: 0
   Mode: r1w1e1
Consumers:
1. Name: da1
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e2
   Number: 0
2. Name: da2
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e2
   Number: 1</pre>



<p class="wp-block-paragraph">ですので，<strong><em>create</em></strong> と <strong><em>label</em></strong> を間違った&#8230; という場合でも正しくコマンドを発行してあげる事で今までの状態を復元できますので，データがなくなってしまった．という事は起きませんので安心してください．<br>いずれにせよ&#8230; <strong><em>label</em></strong> で作成しましょう．が教訓となりますが&#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=""># mount /dev/stripe/stripe0 /mnt

# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2582484  15154436    15%    /
devfs                       1       1         0   100%    /dev
/dev/stripe/stripe0 203123608       8 186873712     0%    /mnt</pre>



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



<p class="wp-block-paragraph">コンカチと違い RAID0 でのストライピングですので分散して書き込みが行われます．実際にどの様な 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 2
       tty             da0              da1              da2             cpu
 tin  tout KB/t  tps  MB/s  KB/t  tps  MB/s  KB/t  tps  MB/s  us ni sy in id
   1    89 18.3    5   0.1  60.0   10   0.6  61.6   10   0.6   0  0  1  0 99
   0   228 13.3    1   0.0  62.7  832  50.9  62.1  863  52.4   2  0 38  2 59
   0   163  0.0    0   0.0  64.0   77   4.8  56.9   90   5.0   0  0  4  0 96
   0    80  0.0    0   0.0  64.0  422  26.4  59.6  425  24.7   1  0 21  1 78
   0    73  0.0    0   0.0  61.1  549  32.8  64.0  552  34.5   1  0 25  2 72
   0    83  0.0    0   0.0  60.9  852  50.7  64.0  793  49.5   4  0 37  1 58

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



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



<figure class="wp-block-image aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="312" height="513" src="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-4.png" alt="" class="wp-image-823" srcset="https://www.seichan.org/blog/wp-content/uploads/2023/12/image-4.png 312w, https://www.seichan.org/blog/wp-content/uploads/2023/12/image-4-300x493.png 300w" sizes="(max-width: 312px) 100vw, 312px" /></figure>



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



<p class="wp-block-paragraph">結論から先に．<strong><span class="bold-red">GEOM STRIPE によるディスクの拡張(追加)は不可能です．</span></strong><br>GEOM CONCAT と同様のオペレーションは完了するのですが，<strong><em>growfs</em></strong> した後におかしくなります．<br>当然ですが，再作成であれば問題ありません．</p>



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



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



<p class="wp-block-paragraph">当然ながら，ファイルシステムはアンマウントする必要があります．<br>また，完全に終了 (停止・破壊) する場合は <strong><em>stop</em></strong> ではなく <strong><em>destroy</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
# gstripe destroy stripe0
# gstripe list</pre>



<p class="wp-block-paragraph">もし間違って <strong><em>destory</em></strong> を実行してしまった場合ですが，これだけのオペレーションの場合だとラベル情報がなくなっただけなので，再度 <strong><em>label</em></strong> を同じ引数で渡すことで復活させる事が可能です．<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=""># gstripe label stripe0 da1 da2
# mount /dev/stripe/stripe0 /mnt
# df
Filesystem          1K-blocks    Used     Avail Capacity  Mounted on
/dev/da0p2           19279260 2582504  15154416    15%    /
devfs                       1       1         0   100%    /dev
/dev/stripe/stripe0 203123480  139048 186734556     0%    /mnt

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



<p class="wp-block-paragraph">以上で GEOM STRIPE によるストライピング (RAID0) のやり方についての解説を終了します．</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-%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/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>FreeBSD GEOM 再々学習</title>
		<link>https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html</link>
					<comments>https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html#respond</comments>
		
		<dc:creator><![CDATA[seichan]]></dc:creator>
		<pubDate>Thu, 30 Nov 2023 11:02:15 +0000</pubDate>
				<category><![CDATA[GEOM]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Multipath]]></category>
		<category><![CDATA[RAID]]></category>
		<guid isPermaLink="false">https://www.seichan.org/blog/?p=791</guid>

					<description><![CDATA[FreeBSD も 13 になり，14 が見えている為 GEOM (modular disk I/O request transformation framework) を再々度学習をしてみています．再々と書いているのは [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">FreeBSD も 13 になり，14 が見えている為 GEOM (modular disk I/O request transformation framework) を再々度学習をしてみています．<br>再々と書いているのは，Pukiwiki の <a title="FreeBSD で GEOM を試してみる" href="https://www.seichan.org/wiki/index.php?FreeBSD-GEOM" target="_blank">FreeBSD で GEOM を試してみる</a> に昔一度纏めたことがあるからです．<br>Depricated (非推奨) になった物があったりなどアップデートがありますね．</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 とは</a><ol><li><a href="#toc2" tabindex="0">現在利用可能な GEOM フレームワーク</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">GEOM とは</span></h2>



<p class="wp-block-paragraph">GEOM は「<strong>modular disk I/O request transformation framework</strong>」の略称で VFS とファイルシステムの間に位置する層でディスクデバイスをコントロールする機能です．</p>



<p class="wp-block-paragraph">2015年の BSD Con で発表された資料と思われますが「<a rel="noopener" href="https://www.bsdcan.org/2015/schedule/attachments/310_iosched-v3.pdf" target="_blank">https://www.bsdcan.org/2015/schedule/attachments/310_iosched-v3.pdf</a>」に GEOM レイヤーの絵がありましたので引用させて頂きます．</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6ab8fad1e8502&quot;}" data-wp-interactive="core/image" data-wp-key="6ab8fad1e8502" class="wp-block-image aligncenter size-large wp-lightbox-container"><img loading="lazy" decoding="async" width="546" height="325" 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/2024/01/GEOM_Layer-546x325.png" alt="" class="wp-image-1411" srcset="https://www.seichan.org/blog/wp-content/uploads/2024/01/GEOM_Layer-546x325.png 546w, https://www.seichan.org/blog/wp-content/uploads/2024/01/GEOM_Layer-300x178.png 300w, https://www.seichan.org/blog/wp-content/uploads/2024/01/GEOM_Layer-768x457.png 768w, https://www.seichan.org/blog/wp-content/uploads/2024/01/GEOM_Layer.png 997w" sizes="(max-width: 546px) 100vw, 546px" /><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">GEOM はモジュール設計になっており，GEOM の機能をスタックさせて利用することができます．<br>詳細は次回以降の記事を見て頂きたいですが，GEOM MIRROR でミラー化したデバイスを GEOM CONCAT で束ねてファイルシステムを拡張させる．という使い方ができます．</p>



<h3 class="wp-block-heading"><span id="toc2">現在利用可能な GEOM フレームワーク</span></h3>



<p class="wp-block-paragraph">FreeBSD 13.x 現在，GEOM フレームワークを通じて利用できるものは以下のとおりとなります．</p>



<ul class="wp-block-list">
<li>gcache &#8211; control utility for CACHE GEOM class
<ul class="wp-block-list">
<li>主に GRAID3 向けのディスクキャッシュを提供する</li>
</ul>
</li>



<li>gconcat &#8211; disk concatenation control utility
<ul class="wp-block-list">
<li>ディスクを連結 (コンカチネーション・JBOD) を提供する</li>
</ul>
</li>



<li>geli &#8211; control utility for the cryptographic GEOM class
<ul class="wp-block-list">
<li>ストレージ(デバイス)レベルの暗号化を提供する</li>
</ul>
</li>



<li>gjournal &#8211; control utility for journaled devices
<ul class="wp-block-list">
<li>ブロックレベルのジャーナリングを提供する</li>
</ul>
</li>



<li>glabel &#8211; disk labelization control utility
<ul class="wp-block-list">
<li>ディスク，パーティションのラベル(名前)管理を提供する</li>
</ul>
</li>



<li>gmirror &#8211; control utility for mirrored devices
<ul class="wp-block-list">
<li>ディスクのミラーリング (RAID1) を提供する</li>
</ul>
</li>



<li>gmountver &#8211; control utility for disk mount verification GEOM class
<ul class="wp-block-list">
<li>デバイスのマウント状態を制御する機能を提供する (説明が難しい&#8230;)</li>
</ul>
</li>



<li>gmultipath &#8211; disk multipath control utility
<ul class="wp-block-list">
<li>ディスク，ストレージのマルチパス機能を提供する</li>
</ul>
</li>



<li>gnop &#8211; control utility for NOP GEOM class
<ul class="wp-block-list">
<li>デバッグや試験の際に利用する NOP (Non Operation) 機能を提供する</li>
</ul>
</li>



<li>gpart &#8211; control utility for the disk partitioning GEOM class
<ul class="wp-block-list">
<li>パーティション管理機能を提供する</li>
</ul>
</li>



<li>graid3 &#8211; control utility for RAID3 devices
<ul class="wp-block-list">
<li>RAID3 機能を提供する</li>
</ul>
</li>



<li>gsched &#8211; control utility for disk scheduler GEOM class
<ul class="wp-block-list">
<li>ディスクスケジューラーの機能を提供する</li>
</ul>
</li>



<li>gshsec &#8211; control utility for shared secret devices
<ul class="wp-block-list">
<li>複数のディスクを鍵とした暗号ボリュームを提供する</li>
</ul>
</li>



<li>gstripe &#8211; control utility for striped devices
<ul class="wp-block-list">
<li>RAID0 機能を提供する</li>
</ul>
</li>



<li>gvinum &#8211; Logical Volume Manager control program
<ul class="wp-block-list">
<li>VINUM RAID 機能を提供する．RAID 1,5 が利用可能</li>
</ul>
</li>



<li>gvirstor &#8211; control utility for virtual data storage devices


<ul class="wp-block-list">
<li>シンプロビジョニング機能を提供する</li>
</ul>
</li>
</ul>



<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>
]]></content:encoded>
					
					<wfw:commentRss>https://www.seichan.org/2023/11/freebsd-geom-%e5%86%8d%e3%80%85%e5%ad%a6%e7%bf%92.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
