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

📄 vinum-root.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<pre class="SCREEN">Mounting root from ufs:/dev/vinum/root</pre></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26448" name="AEN26448">17.9.3 Example of a Vinum-based RootSetup</a></h2><p>After the Vinum root volume has been set up, the output of <tt class="COMMAND">vinum l-rv root</tt> could look like:</p><pre class="SCREEN">...Subdisk root.p0.s0:        Size:        125829120 bytes (120 MB)        State: up        Plex root.p0 at offset 0 (0  B)        Drive disk0 (/dev/da0h) at offset 135680 (132 kB)Subdisk root.p1.s0:        Size:        125829120 bytes (120 MB)        State: up        Plex root.p1 at offset 0 (0  B)        Drive disk1 (/dev/da1h) at offset 135680 (132 kB)   </pre><p>The values to note are <var class="LITERAL">135680</var> for the offset (relative topartition <tt class="FILENAME">/dev/da0h</tt>). This translates to 265 512-byte diskblocks in <tt class="COMMAND">disklabel</tt>'s terms. Likewise, the size of this rootvolume is 245760 512-byte blocks. <tt class="FILENAME">/dev/da1h</tt>, containing thesecond replica of this root volume, has a symmetric setup.</p><p>The disklabel for these devices might look like:</p><pre class="SCREEN">...8 partitions:#        size   offset    fstype   [fsize bsize bps/cpg]  a:   245760      281    4.2BSD     2048 16384     0   # (Cyl.    0*- 15*)  c: 71771688        0    unused        0     0         # (Cyl.    0 - 4467*)  h: 71771672       16     vinum                        # (Cyl.    0*- 4467*)   </pre><p>It can be observed that the <var class="LITERAL">"size"</var> parameter for the faked<var class="LITERAL">"a"</var> partition matches the value outlined above, while the <varclass="LITERAL">"offset"</var> parameter is the sum of the offset within the Vinumpartition <var class="LITERAL">"h"</var>, and the offset of this partition within thedevice (or slice). This is a typical setup that is necessary to avoid the problemdescribed in <a href="vinum-root.html#VINUM-ROOT-PANIC">Section 17.9.4.3</a>. It can alsobe seen that the entire <var class="LITERAL">"a"</var> partition is completely within the<var class="LITERAL">"h"</var> partition containing all the Vinum data for thisdevice.</p><p>Note that in the above example, the entire device is dedicated to Vinum, and there isno leftover pre-Vinum root partition, since this has been a newly set-up disk that wasonly meant to be part of a Vinum configuration, ever.</p></div><div class="SECT2"><h2 class="SECT2"><a id="AEN26469" name="AEN26469">17.9.4 Troubleshooting</a></h2><p>If something goes wrong, a way is needed to recover from the situation. The followinglist contains few known pitfalls and solutions.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN26472" name="AEN26472">17.9.4.1 System Bootstrap Loads, butSystem Does Not Boot</a></h3><p>If for any reason the system does not continue to boot, the bootstrap can beinterrupted with by pressing the <b class="KEYCAP">space</b> key at the 10-secondswarning. The loader variables (like <var class="LITERAL">vinum.autostart</var>) can beexamined using the <tt class="COMMAND">show</tt>, and manipulated using <ttclass="COMMAND">set</tt> or <tt class="COMMAND">unset</tt> commands.</p><p>If the only problem was that the Vinum kernel module was not yet in the list ofmodules to load automatically, a simple <tt class="COMMAND">load vinum</tt> willhelp.</p><p>When ready, the boot process can be continued with a <tt class="COMMAND">boot-as</tt>. The options <var class="OPTION">-as</var> will request the kernel to ask forthe root filesystem to mount (<var class="OPTION">-a</var>), and make the boot processstop in single-user mode (<var class="OPTION">-s</var>), where the root filesystem ismounted read-only. That way, even if only one plex of a multi-plex volume has beenmounted, no data inconsistency between plexes is being risked.</p><p>At the prompt asking for a root filesystem to mount, any device that contains a validroot filesystem can be entered. If <tt class="FILENAME">/etc/fstab</tt> had been set upcorrectly, the default should be something like <varclass="LITERAL">ufs:/dev/vinum/root</var>. A typical alternate choice would be somethinglike <var class="LITERAL">ufs:da0d</var> which could be a hypothetical partition thatcontains the pre-Vinum root filesystem. Care should be taken if one of the alias <varclass="LITERAL">"a"</var> partitions are entered here that are actually reference to thesubdisks of the Vinum root device, because in a mirrored setup, this would only mount onepiece of a mirrored root device. If this filesystem is to be mounted read-write later on,it is necessary to remove the other plex(es) of the Vinum root volume since these plexeswould otherwise carry inconsistent data.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN26492" name="AEN26492">17.9.4.2 Only Primary BootstrapLoads</a></h3><p>If <tt class="FILENAME">/boot/loader</tt> fails to load, but the primary bootstrapstill loads (visible by a single dash in the left column of the screen right after theboot process starts), an attempt can be made to interrupt the primary bootstrap at thispoint, using the <b class="KEYCAP">space</b> key. This will make the bootstrap stop instage two, see <a href="boot-blocks.html#BOOT-BOOT1">Section 12.3.2</a>. An attempt canbe made here to boot off an alternate partition, like the partition containing theprevious root filesystem that has been moved away from <var class="LITERAL">"a"</var>above.</p></div><div class="SECT3"><h3 class="SECT3"><a id="VINUM-ROOT-PANIC" name="VINUM-ROOT-PANIC">17.9.4.3 NothingBoots, the Bootstrap Panics</a></h3><p>This situation will happen if the bootstrap had been destroyed by the Vinuminstallation. Unfortunately, Vinum accidentally currently leaves only 4 KB at thebeginning of its partition free before starting to write its Vinum header information.However, the stage one and two bootstraps plus the disklabel embedded between themcurrently require 8 KB. So if a Vinum partition was started at offset 0 within a slice ordisk that was meant to be bootable, the Vinum setup will trash the bootstrap.</p><p>Similarly, if the above situation has been recovered, for example by booting from a``Fixit'' medium, and the bootstrap has been re-installed using <ttclass="COMMAND">disklabel -B</tt> as described in <ahref="boot-blocks.html#BOOT-BOOT1">Section 12.3.2</a>, the bootstrap will trash the Vinumheader, and Vinum will no longer find its disk(s). Though no actual Vinum configurationdata or data in Vinum volumes will be trashed by this, and it would be possible torecover all the data by entering exact the same Vinum configuration data again, thesituation is hard to fix at all. It would be necessary to move the entire Vinum partitionby at least 4 KB off, in order to have the Vinum header and the system bootstrap nolonger collide.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="VINUM-ROOT-4X" name="VINUM-ROOT-4X">17.9.5 Differences forFreeBSD 4.X</a></h2><p>Under FreeBSD 4.X, some internal functions required to make Vinum automatically scanall disks are missing, and the code that figures out the internal ID of the root deviceis not smart enough to handle a name like <tt class="FILENAME">/dev/vinum/root</tt>automatically. Therefore, things are a little different here.</p><p>Vinum must explicitly be told which disks to scan, using a line like the following onein <tt class="FILENAME">/boot/loader.conf</tt>:</p><pre class="PROGRAMLISTING">vinum.drives="/dev/<var class="REPLACEABLE">da0</var> /dev/<varclass="REPLACEABLE">da1</var>"</pre><p>It is important that all drives are mentioned that could possibly contain Vinum data.It does not harm if <span class="emphasis"><i class="EMPHASIS">more</i></span> drives arelisted, nor is it necessary to add each slice and/or partition explicitly, since Vinumwill scan all slices and partitions of the named drives for valid Vinum headers.</p><p>Since the routines used to parse the name of the root filesystem, and derive thedevice ID (major/minor number) are only prepared to handle ``classical'' device nameslike <tt class="FILENAME">/dev/ad0s1a</tt>, they cannot make any sense out of a rootvolume name like <tt class="FILENAME">/dev/vinum/root</tt>. For that reason, Vinum itselfneeds to pre-setup the internal kernel parameter that holds the ID of the root deviceduring its own initialization. This is requested by passing the name of the root volumein the loader variable <var class="LITERAL">vinum.root</var>. The entry in <ttclass="FILENAME">/boot/loader.conf</tt> to accomplish this looks like:</p><pre class="PROGRAMLISTING">vinum.root="root"</pre><p>Now, when the kernel initialization tries to find out the root device to mount, itsees whether some kernel module has already pre-initialized the kernel parameter for it.If that is the case, <span class="emphasis"><i class="EMPHASIS">and</i></span> the deviceclaiming the root device matches the major number of the driver as figured out from thename of the root device string being passed (that is, <var class="LITERAL">"vinum"</var>in our case), it will use the pre-allocated device ID, instead of trying to figure outone itself. That way, during the usual automatic startup, it can continue to mount theVinum root volume for the root filesystem.</p><p>However, when <tt class="COMMAND">boot -a</tt> has been requesting to ask for enteringthe name of the root device manually, it must be noted that this routine still cannotactually parse a name entered there that refers to a Vinum volume. If any device name isentered that does not refer to a Vinum device, the mismatch between the major numbers ofthe pre-allocated root parameter and the driver as figured out from the given name willmake this routine enter its normal parser, so entering a string like <varclass="LITERAL">ufs:da0d</var> will work as expected. Note that if this fails, it ishowever no longer possible to re-enter a string like <varclass="LITERAL">ufs:vinum/root</var> again, since it cannot be parsed. The only way outis to reboot again, and start over then. (At the ``askroot'' prompt, the initial <ttclass="FILENAME">/dev/</tt> can always be omitted.)</p></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-config.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="l10n.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Configuring Vinum</td><td width="34%" align="center" valign="top"><a href="vinum-vinum.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Localization - I18N/L10N Usage and Setup</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

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