# FreeBSD Install with GPT and GMIRROR



## vasyl.herman (Nov 11, 2022)

[_Mod: Split off from a 6 year old thread; Thread freebsd-10-2-install-with-gpt-and-gmirror.55400_]




wblock@ said:


> Please provide more information on who provided these instructions.  They use the shaky method of mirroring multiple GPT partitions, which works fine, except maybe when recreating the mirror.  bsdinstall(8) changes from time to time, and that could be a problem also.  Maintaining the process will be up to whoever defined it.


Hello, is there a handbook page that would explain how to deal with GPT mirroring? All my servers happened to be GPT with mirroring like described in the ateamsystems article.
wblock@.
I got a machine with degraded disk for healing, so my algorithm is:

```
$ geom disk list # identify the serial number of the broken disk
# shotdown the machine, remove old disk and insert a new one say /dev/da1
# boot in single-user mode
$ gpart backup da0 | grart restore /dev/da1 # restore
$ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da1

$ gmirror forget root
$ gmirror forget boot
$ gmirror forget swap

$ gmirror insert boot /dev/da1p1
$ gmirror insert root /dev/da1p2
$ gmirror insert swap /dev/da1p3

$ gmirror status # check the status of the rebuild and reboot
```
Please provide your thoughts on what might be the issue with recreating the mirror.


----------



## vasyl.herman (Nov 11, 2022)

The reference about how the mirror was created before I got a machine to experiment with (i.e. a DEGRADED disk)

```
Given: a FreeBSD 9.3 instlled with all default options i.e. GPT

### steps how to create the mirror on GPT

# load freebsd 9.3 in single-user mode (2) after installing FreeBSD with all default options i.e. GPT
$ gmirror label -vb round-robin boot /dev/da0p1
$ gmirror label -vb round-robin root /dev/da0p2
$ gmirror label -vb round-robin swap /dev/da0p3
$ gmirror load

$ mount /dev/mirror/root /mnt
$ echo 'geom_mirror_load="YES"' >> /mnt/boot/loader.conf
$ ee /mnt/etc/fstab
++++++++
# Device    Mountpoint    FStype    Options    Dump    Pass#
/dev/mirror/root    /        ufs    rw    1    1
/dev/mirror/swap    none        swap    sw    0    0
++++++++
$ reboot

### steps how to add new da1
# load freebsd 9.3 in single-user mode (2)

$ gpart backup da0 | grart restore /dev/da1
$ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da1
$ gmirror insert boot /dev/da1p1
$ gmirror insert root /dev/da1p2
$ gmirror insert swap /dev/da1p3
$ gmirror status # check the status of the rebuild and reboot
```


----------



## SirDice (Nov 11, 2022)

Is this system still FreeBSD 9.3? If that's the case just nuke the whole thing and start over. FreeBSD 9.3 has been end-of-life since December 2016 and is not supported any more.


----------



## chrbr (Nov 11, 2022)

Dear vasyl.herman,
in my opinion the ultimate reference is http://www.wonkity.com/~wblock/docs/html/gmirror.html. I am not sure if you have found that aleady.
I hope it helps,
Christoph


----------

