Source string Read only

(itstool) path: sect2/screen
Context English State
<prompt>#</prompt> <userinput>gpart destroy -F ada8</userinput>
A disk can be removed from an active mirror and the metadata erased in one step using <citerefentry><refentrytitle>gmirror</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Here, the example disk <filename>ada8</filename> is removed from the active mirror <filename>gm4</filename>:
<prompt>#</prompt> <userinput>gmirror remove gm4 ada8</userinput>
If the mirror is not running, but old mirror metadata is still on the disk, use <command>gmirror clear</command> to remove it:
<prompt>#</prompt> <userinput>gmirror clear ada8</userinput>
<citerefentry><refentrytitle>gmirror</refentrytitle><manvolnum>8</manvolnum></citerefentry> stores one block of metadata at the end of the disk. Because <acronym>GPT</acronym> partition schemes also store metadata at the end of the disk, mirroring entire <acronym>GPT</acronym> disks with <citerefentry><refentrytitle>gmirror</refentrytitle><manvolnum>8</manvolnum></citerefentry> is not recommended. <acronym>MBR</acronym> partitioning is used here because it only stores a partition table at the start of the disk and does not conflict with the mirror metadata.
Creating a Mirror with Two New Disks
In this example, FreeBSD has already been installed on a single disk, <filename>ada0</filename>. Two new disks, <filename>ada1</filename> and <filename>ada2</filename>, have been connected to the system. A new mirror will be created on these two disks and used to replace the old single disk.
The <filename>geom_mirror.ko</filename> kernel module must either be built into the kernel or loaded at boot- or run-time. Manually load the kernel module now:
<prompt>#</prompt> <userinput>gmirror load</userinput>
Create the mirror with the two new drives:
<prompt>#</prompt> <userinput>gmirror label -v gm0 /dev/ada1 /dev/ada2</userinput>
<filename>gm0</filename> is a user-chosen device name assigned to the new mirror. After the mirror has been started, this device name appears in <filename>/dev/mirror/</filename>.
<acronym>MBR</acronym> and <application>bsdlabel</application> partition tables can now be created on the mirror with <citerefentry><refentrytitle>gpart</refentrytitle><manvolnum>8</manvolnum></citerefentry>. This example uses a traditional file system layout, with partitions for <filename>/</filename>, swap, <filename>/var</filename>, <filename>/tmp</filename>, and <filename>/usr</filename>. A single <filename>/</filename> and a swap partition will also work.
Partitions on the mirror do not have to be the same size as those on the existing disk, but they must be large enough to hold all the data already present on <filename>ada0</filename>.
<prompt>#</prompt> <userinput>gpart create -s MBR mirror/gm0</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd -a 4k mirror/gm0</userinput>
<prompt>#</prompt> <userinput>gpart show mirror/gm0</userinput>
=&gt; 63 156301423 mirror/gm0 MBR (74G)
63 63 - free - (31k)
126 156301299 1 freebsd (74G)
156301425 61 - free - (30k)
<prompt>#</prompt> <userinput>gpart create -s BSD mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd-swap -a 4k -s 4g mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd-ufs -a 4k -s 1g mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart add -t freebsd-ufs -a 4k mirror/gm0s1</userinput>
<prompt>#</prompt> <userinput>gpart show mirror/gm0s1</userinput>
=&gt; 0 156301299 mirror/gm0s1 BSD (74G)
0 2 - free - (1.0k)
2 4194304 1 freebsd-ufs (2.0G)
4194306 8388608 2 freebsd-swap (4.0G)
12582914 4194304 4 freebsd-ufs (2.0G)
16777218 2097152 5 freebsd-ufs (1.0G)
18874370 137426928 6 freebsd-ufs (65G)
156301298 1 - free - (512B)
Make the mirror bootable by installing bootcode in the <acronym>MBR</acronym> and bsdlabel and setting the active slice:
<prompt>#</prompt> <userinput>gpart bootcode -b /boot/mbr mirror/gm0</userinput>
<prompt>#</prompt> <userinput>gpart set -a active -i 1 mirror/gm0</userinput>
<prompt>#</prompt> <userinput>gpart bootcode -b /boot/boot mirror/gm0s1</userinput>
Format the file systems on the new mirror, enabling soft-updates.
<prompt>#</prompt> <userinput>newfs -U /dev/mirror/gm0s1a</userinput>
<prompt>#</prompt> <userinput>newfs -U /dev/mirror/gm0s1d</userinput>
<prompt>#</prompt> <userinput>newfs -U /dev/mirror/gm0s1e</userinput>
<prompt>#</prompt> <userinput>newfs -U /dev/mirror/gm0s1f</userinput>
File systems from the original <filename>ada0</filename> disk can now be copied onto the mirror with <citerefentry><refentrytitle>dump</refentrytitle><manvolnum>8</manvolnum></citerefentry> and <citerefentry><refentrytitle>restore</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
<prompt>#</prompt> <userinput>mount /dev/mirror/gm0s1a /mnt</userinput>
<prompt>#</prompt> <userinput>dump -C16 -b64 -0aL -f - / | (cd /mnt &amp;&amp; restore -rf -)</userinput>
<prompt>#</prompt> <userinput>mount /dev/mirror/gm0s1d /mnt/var</userinput>
<prompt>#</prompt> <userinput>mount /dev/mirror/gm0s1e /mnt/tmp</userinput>
<prompt>#</prompt> <userinput>mount /dev/mirror/gm0s1f /mnt/usr</userinput>
<prompt>#</prompt> <userinput>dump -C16 -b64 -0aL -f - /var | (cd /mnt/var &amp;&amp; restore -rf -)</userinput>
<prompt>#</prompt> <userinput>dump -C16 -b64 -0aL -f - /tmp | (cd /mnt/tmp &amp;&amp; restore -rf -)</userinput>
<prompt>#</prompt> <userinput>dump -C16 -b64 -0aL -f - /usr | (cd /mnt/usr &amp;&amp; restore -rf -)</userinput>
Edit <filename>/mnt/etc/fstab</filename> to point to the new mirror file systems:
# Device Mountpoint FStype Options Dump Pass#
/dev/mirror/gm0s1a / ufs rw 1 1
/dev/mirror/gm0s1b none swap sw 0 0
/dev/mirror/gm0s1d /var ufs rw 2 2
/dev/mirror/gm0s1e /tmp ufs rw 2 2
/dev/mirror/gm0s1f /usr ufs rw 2 2
If the <filename>geom_mirror.ko</filename> kernel module has not been built into the kernel, <filename>/mnt/boot/loader.conf</filename> is edited to load the module at boot:
Reboot the system to test the new mirror and verify that all data has been copied. The <acronym>BIOS</acronym> will see the mirror as two individual drives rather than a mirror. Because the drives are identical, it does not matter which is selected to boot.
See <xref linkend="gmirror-troubleshooting"/> if there are problems booting. Powering down and disconnecting the original <filename>ada0</filename> disk will allow it to be kept as an offline backup.
In use, the mirror will behave just like the original single drive.
Creating a Mirror with an Existing Drive


No matching activity found.

Browse all component changes

Things to check

Multiple failing checks

The translations in several languages have failing checks



English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect2/screen
no-wrap, read-only
Source string location
String age
a year ago
Source string age
a year ago
Translation file
books/handbook.pot, string 6027