The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: step/para
Context English State
Making a <filename>vinum</filename>-based Root Volume Accessible to the Bootstrap
The current FreeBSD bootstrap is only 7.5 KB of code and does not understand the internal <filename>vinum</filename> structures. This means that it cannot parse the <filename>vinum</filename> configuration data or figure out the elements of a boot volume. Thus, some workarounds are necessary to provide the bootstrap code with the illusion of a standard <literal>a</literal> partition that contains the root file system.
For this to be possible, the following requirements must be met for the root volume:
The root volume must not be a stripe or <acronym>RAID</acronym>-5.
The root volume must not contain more than one concatenated subdisk per plex.
Note that it is desirable and possible to use multiple plexes, each containing one replica of the root file system. The bootstrap process will only use one replica for finding the bootstrap and all boot files, until the kernel mounts the root file system. Each single subdisk within these plexes needs its own <literal>a</literal> partition illusion, for the respective device to be bootable. It is not strictly needed that each of these faked <literal>a</literal> partitions is located at the same offset within its device, compared with other devices containing plexes of the root volume. However, it is probably a good idea to create the <filename>vinum</filename> volumes that way so the resulting mirrored devices are symmetric, to avoid confusion.
In order to set up these <literal>a</literal> partitions for each device containing part of the root volume, the following is required:
The location, offset from the beginning of the device, and size of this device's subdisk that is part of the root volume needs to be examined, using the command:
<prompt>#</prompt> <userinput>gvinum l -rv root</userinput>
<filename>vinum</filename> offsets and sizes are measured in bytes. They must be divided by 512 in order to obtain the block numbers that are to be used by <command>bsdlabel</command>.
Run this command for each device that participates in the root volume:
<prompt>#</prompt> <userinput>bsdlabel -e <replaceable>devname</replaceable></userinput>
<replaceable>devname</replaceable> must be either the name of the disk, like <filename>da0</filename> for disks without a slice table, or the name of the slice, like <filename>ad0s1</filename>.
If there is already an <literal>a</literal> partition on the device from a pre-<filename>vinum</filename> root file system, it should be renamed to something else so that it remains accessible (just in case), but will no longer be used by default to bootstrap the system. A currently mounted root file system cannot be renamed, so this must be executed either when being booted from a <quote>Fixit</quote> media, or in a two-step process where, in a mirror, the disk that is not been currently booted is manipulated first.
The offset of the <filename>vinum</filename> partition on this device (if any) must be added to the offset of the respective root volume subdisk on this device. The resulting value will become the <literal>offset</literal> value for the new <literal>a</literal> partition. The <literal>size</literal> value for this partition can be taken verbatim from the calculation above. The <literal>fstype</literal> should be <literal>4.2BSD</literal>. The <literal>fsize</literal>, <literal>bsize</literal>, and <literal>cpg</literal> values should be chosen to match the actual file system, though they are fairly unimportant within this context.
That way, a new <literal>a</literal> partition will be established that overlaps the <filename>vinum</filename> partition on this device. <command>bsdlabel</command> will only allow for this overlap if the <filename>vinum</filename> partition has properly been marked using the <literal>vinum</literal> fstype.
A faked <literal>a</literal> partition now exists on each device that has one replica of the root volume. It is highly recommendable to verify the result using a command like:
<prompt>#</prompt> <userinput>fsck -n /dev/<replaceable>devname</replaceable>a</userinput>
It should be remembered that all files containing control information must be relative to the root file system in the <filename>vinum</filename> volume which, when setting up a new <filename>vinum</filename> root volume, might not match the root file system that is currently active. So in particular, <filename>/etc/fstab</filename> and <filename>/boot/loader.conf</filename> need to be taken care of.
At next reboot, the bootstrap should figure out the appropriate control information from the new <filename>vinum</filename>-based root file system, and act accordingly. At the end of the kernel initialization process, after all devices have been announced, the prominent notice that shows the success of this setup is a message like:
Mounting root from ufs:/dev/gvinum/root
Example of a <filename>vinum</filename>-based Root Setup
After the <filename>vinum</filename> root volume has been set up, the output of <command>gvinum l -rv root</command> could look like:
...
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)
The values to note are <literal>135680</literal> for the offset, relative to partition <filename class="devicefile">/dev/da0h</filename>. This translates to 265 512-byte disk blocks in <command>bsdlabel</command>'s terms. Likewise, the size of this root volume is 245760 512-byte blocks. <filename class="devicefile">/dev/da1h</filename>, containing the second replica of this root volume, has a symmetric setup.
The bsdlabel for these devices might look like:
...
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*)
It can be observed that the <literal>size</literal> parameter for the faked <literal>a</literal> partition matches the value outlined above, while the <literal>offset</literal> parameter is the sum of the offset within the <filename>vinum</filename> partition <literal>h</literal>, and the offset of this partition within the device or slice. This is a typical setup that is necessary to avoid the problem described in <xref linkend="vinum-root-panic"/>. The entire <literal>a</literal> partition is completely within the <literal>h</literal> partition containing all the <filename>vinum</filename> data for this device.
In the above example, the entire device is dedicated to <filename>vinum</filename> and there is no leftover pre-<filename>vinum</filename> root partition.
Troubleshooting
The following list contains a few known pitfalls and solutions.

Loading…

No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: step/para
Flags
read-only
Source string location
article.translate.xml:1076
String age
a year ago
Source string age
a year ago
Translation file
articles/vinum.pot, string 162