⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vinum-examples.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>一些例子</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="Vinum 卷管理程序" href="vinum-vinum.html" /><link rel="PREVIOUS" title="Vinum 目标" href="vinum-objects.html" /><link rel="NEXT" title="Object Naming" href="vinum-object-naming.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="vinum-objects.html"accesskey="P">后退</a></td><td width="80%" align="center" valign="bottom">章 17. Vinum 卷管理程序</td><td width="10%" align="right" valign="bottom"><a href="vinum-object-naming.html"accesskey="N">前进</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="VINUM-EXAMPLES" name="VINUM-EXAMPLES">17.6. 一些例子</a></h1><p>Vinum 维护着一个描述以一个独立系统为目标 <span class="emphasis"><iclass="EMPHASIS">配置数据库</i></span>的。最初,用户通过<span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">vinum</span>(8)</span>工具的帮助从一个或多个配置文件创建配置数据库。Vinum 在它的控制 下在每个磁盘(Vinum 叫<span class="emphasis"><i class="EMPHASIS">device</i></span>) 上存储一个它的配置数据库的拷贝。这个数据库在每个状态变化的时候被升级, 以便能精确地回复每个Vinum目标的状态。</p><div class="SECT2"><h2 class="SECT2"><a id="AEN25682" name="AEN25682">17.6.1. 配置文件</a></h2><p>配置文件描述了独立的 Vinum.一个简单卷的定义可能是这样的:</p><pre class="PROGRAMLISTING">    drive a device /dev/da3h    volume myvol      plex org concat        sd length 512m drive a</pre><p>这个文件描述了四个Vinum 目标:</p><ul><li><p><span class="emphasis"><i class="EMPHASIS">drive</i></span>行描述了一个磁盘分区(驱动器) 和与下面的硬件相关的它的位置。它给出了一个符号名 <spanclass="emphasis"><i class="EMPHASIS">a</i></span>. 这个与设备名称分开的符号名允许磁盘从一个位置移动到另一个位置而不会搞混。</p></li><li><p><span class="emphasis"><i class="EMPHASIS">volume</i></span> 行描述了一个卷。唯一的必须属性是名称,在这个例子中是 <span class="emphasis"><iclass="EMPHASIS">myvol</i></span>.</p></li><li><p><span class="emphasis"><i class="EMPHASIS">plex</i></span> 行定义了一个plex。唯一需要的参数是组织,在这个例子中是 <span class="emphasis"><iclass="EMPHASIS">concat</i></span>. 没有名称是必然的: 系统自动通过添加suffix <spanclass="emphasis"><i class="EMPHASIS">.p</i></span><span class="emphasis"><iclass="EMPHASIS">x</i></span>px 来从卷名称产生一个名字,这里的<span class="emphasis"><iclass="EMPHASIS">x</i></span> 是在卷中的plex 的编号。而这个plex 将被 叫做<spanclass="emphasis"><i class="EMPHASIS">myvol.p0</i></span>。</p></li><li><p><span class="emphasis"><i class="EMPHASIS">sd</i></span> 行描述了一个subdisk。最小的说明是存储subdisk 的驱动器名称,和subdisk 的长度。对于plex,没有名称也是必然的:系统自动通过添加 suffix <span class="emphasis"><iclass="EMPHASIS">.s</i></span><span class="emphasis"><i class="EMPHASIS">x</i></span>来分配源自plex 的名称,这里 <span class="emphasis"><i class="EMPHASIS">x</i></span>是plex中subdisk 的编号。 Vinum 给这个subdisk 命名为<span class="emphasis"><iclass="EMPHASIS">myvol.p0.s0</i></span>。</p></li></ul><p>处理完这个文件后, <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">vinum</span>(8)</span>会产生下面的输出:</p><pre class="PROGRAMLISTING">      <samp class="PROMPT">#</samp> vinum -&gt; <kbdclass="USERINPUT">create config1</kbd>      Configuration summary      Drives:         1 (4 configured)      Volumes:        1 (4 configured)      Plexes:         1 (8 configured)      Subdisks:       1 (16 configured)         D a                     State: up       Device /dev/da3h        Avail: 2061/2573 MB (80%)        V myvol                 State: up       Plexes:       1 Size:        512 MB        P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB        S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB</pre><p>这个输出显示了<span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">vinum</span>(8)</span>简要的列表格式。 图<ahref="vinum-examples.html#VINUM-SIMPLE-VOL">图形 17-4</a>中它用图形来表示这一点。</p><p></p><div class="FIGURE"><a id="VINUM-SIMPLE-VOL" name="VINUM-SIMPLE-VOL"></a><p><b>图形 17-4. 一个简单的Vinum 卷</b></p><p><img src="vinum/vinum-simple-vol.png" /></p></div><br /><br /><p>下面这个图显示了一个由按顺序排列的subdisk 组成的plex。在这个小小的例子中,卷包含一个plex,plex 包含一个subdisk。</p><p>这个特殊的卷与一个传统的磁盘分区没有什么特别的优势。下面的章节会描述到几个非常有趣的配置方法。 This particular volume has no specificadvantage over a conventional disk partition. It contains a single plex, so it is notredundant. The plex contains a single subdisk, so there is no difference in storageallocation from a conventional disk partition. The following sections illustrate variousmore interesting configuration methods.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN25729" name="AEN25729">17.6.2. 增强的可靠性:镜象</a></h2><p>The resilience of a volume can be increased by mirroring. When laying out a mirroredvolume, it is important to ensure that the subdisks of each plex are on different drives,so that a drive failure will not take down both plexes. The following configurationmirrors a volume:</p><pre class="PROGRAMLISTING">   drive b device /dev/da4h    volume mirror      plex org concat        sd length 512m drive a      plex org concat        sd length 512m drive b</pre><p>In this example, it was not necessary to specify a definition of drive <spanclass="emphasis"><i class="EMPHASIS">a</i></span> again, since Vinum keeps track of allobjects in its configuration database. After processing this definition, theconfiguration looks like:</p><pre class="PROGRAMLISTING">   Drives:         2 (4 configured)    Volumes:        2 (4 configured)    Plexes:         3 (8 configured)    Subdisks:       3 (16 configured)        D a                     State: up       Device /dev/da3h        Avail: 1549/2573 MB (60%)    D b                     State: up       Device /dev/da4h        Avail: 2061/2573 MB (80%)    V myvol                 State: up       Plexes:       1 Size:        512 MB    V mirror                State: up       Plexes:       2 Size:        512 MB      P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB    P mirror.p0           C State: up       Subdisks:     1 Size:        512 MB    P mirror.p1           C State: initializing     Subdisks:     1 Size:        512 MB      S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB    S mirror.p0.s0          State: up       PO:        0  B Size:        512 MB    S mirror.p1.s0          State: empty    PO:        0  B Size:        512 MB</pre><p><a href="vinum-examples.html#VINUM-MIRRORED-VOL">图形 17-5</a> shows the structuregraphically.</p><p></p><div class="FIGURE"><a id="VINUM-MIRRORED-VOL" name="VINUM-MIRRORED-VOL"></a><p><b>图形 17-5. A Mirrored Vinum Volume</b></p><p><img src="vinum/vinum-mirrored-vol.png" /></p></div><br /><br /><p>In this example, each plex contains the full 512&nbsp;MB of address space. As in theprevious example, each plex contains only a single subdisk.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN25743" name="AEN25743">17.6.3. OptimizingPerformance</a></h2><p>The mirrored volume in the previous example is more resistant to failure than anunmirrored volume, but its performance is less: each write to the volume requires a writeto both drives, using up a greater proportion of the total disk bandwidth. Performanceconsiderations demand a different approach: instead of mirroring, the data is stripedacross as many disk drives as possible. The following configuration shows a volume with aplex striped across four disk drives:</p><pre class="PROGRAMLISTING">   drive c device /dev/da5h    drive d device /dev/da6h    volume stripe    plex org striped 512k      sd length 128m drive a      sd length 128m drive b      sd length 128m drive c      sd length 128m drive d</pre><p>As before, it is not necessary to define the drives which are already known to Vinum.After processing this definition, the configuration looks like:</p><pre class="PROGRAMLISTING">   Drives:         4 (4 configured)    Volumes:        3 (4 configured)    Plexes:         4 (8 configured)    Subdisks:       7 (16 configured)      D a                     State: up       Device /dev/da3h        Avail: 1421/2573 MB (55%)    D b                     State: up       Device /dev/da4h        Avail: 1933/2573 MB (75%)    D c                     State: up       Device /dev/da5h        Avail: 2445/2573 MB (95%)    D d                     State: up       Device /dev/da6h        Avail: 2445/2573 MB (95%)      V myvol                 State: up       Plexes:       1 Size:        512 MB    V mirror                State: up       Plexes:       2 Size:        512 MB    V striped               State: up       Plexes:       1 Size:        512 MB      P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB    P mirror.p0           C State: up       Subdisks:     1 Size:        512 MB    P mirror.p1           C State: initializing     Subdisks:     1 Size:        512 MB    P striped.p1            State: up       Subdisks:     1 Size:        512 MB      S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB    S mirror.p0.s0          State: up       PO:        0  B Size:        512 MB    S mirror.p1.s0          State: empty    PO:        0  B Size:        512 MB    S striped.p0.s0         State: up       PO:        0  B Size:        128 MB    S striped.p0.s1         State: up       PO:      512 kB Size:        128 MB    S striped.p0.s2         State: up       PO:     1024 kB Size:        128 MB    S striped.p0.s3         State: up       PO:     1536 kB Size:        128 MB</pre><p></p><div class="FIGURE"><a id="VINUM-STRIPED-VOL" name="VINUM-STRIPED-VOL"></a><p><b>图形 17-6. A Striped Vinum Volume</b></p><p><img src="vinum/vinum-striped-vol.png" /></p></div><br /><br /><p>This volume is represented in <a href="vinum-examples.html#VINUM-STRIPED-VOL">图形17-6</a>. The darkness of the stripes indicates the position within the plex addressspace: the lightest stripes come first, the darkest last.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN25755" name="AEN25755">17.6.4. Resilience andPerformance</a></h2><p><a id="VINUM-RESILIENCE" name="VINUM-RESILIENCE"></a>With sufficient hardware, it ispossible to build volumes which show both increased resilience and increased performancecompared to standard <span class="TRADEMARK">UNIX</span>&reg; partitions. A typicalconfiguration file might be:</p><pre class="PROGRAMLISTING">   volume raid10      plex org striped 512k        sd length 102480k drive a        sd length 102480k drive b        sd length 102480k drive c        sd length 102480k drive d        sd length 102480k drive e      plex org striped 512k        sd length 102480k drive c        sd length 102480k drive d        sd length 102480k drive e        sd length 102480k drive a        sd length 102480k drive b</pre><p>The subdisks of the second plex are offset by two drives from those of the first plex:this helps ensure that writes do not go to the same subdisks even if a transfer goes overtwo drives.</p><p><a href="vinum-examples.html#VINUM-RAID10-VOL">图形 17-7</a> represents the structureof this volume.</p><p></p><div class="FIGURE"><a id="VINUM-RAID10-VOL" name="VINUM-RAID10-VOL"></a><p><b>图形 17-7. A Mirrored, Striped Vinum Volume</b></p><p><img src="vinum/vinum-raid10-vol.png" /></p></div><br /><br /></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="vinum-objects.html"accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">起点</a></td><td width="33%" align="right" valign="top"><a href="vinum-object-naming.html"accesskey="N">前进</a></td></tr><tr><td width="33%" align="left" valign="top">Vinum 目标</td><td width="34%" align="center" valign="top"><a href="vinum-vinum.html"accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">Object Naming</td></tr></table></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -