# Gmirror replace hard disk not booting.



## klabacita (Jun 23, 2016)

Hi I have a server with 2 hard disk in mirror setup.

My slices are:


```
root@spam:/boot # gpart show ada1
=>       34  976773101  ada1  GPT  (466G)
         34          6        - free -  (3.0K)
         40        128     1  freebsd-boot  (64K)
        168    2097152     2  freebsd-ufs  (1.0G)
    2097320   16777216     3  freebsd-ufs  (8.0G)
   18874536   16777216     4  freebsd-ufs  (8.0G)
   35651752    1048576     5  freebsd-ufs  (512M)
   36700328    1048576     6  freebsd-swap  (512M)
   37748904  939024231        - free -  (448G)
```

My mirror has ada0 ada1, ada0 var slice fails, them I decide to replace the whole disk and follow the instructions for that using gpart and backup my current good disk layout into my new disk.

`gpart backup ada1 | gpart restore -F /dev/ada0`

This create my slices, I forget each mirror slice and add each slice into the mirror again.

Everything working, but looks like I forget to add the bootcode to my new disk because it won't boot.

Now is booting from 2nd disk but need to boot from all hard disk, if ada1 fails I will have issues.

If some one could explain me the steps will be appreciated, thanks.

10.0-RELEASE-pX


----------



## SirDice (Jun 23, 2016)

klabacita said:


> 10.0-RELEASE-pX


FreeBSD 10.0 has been End-of-Life since February 2015 and is not supported anymore. Please upgrade to a supported version as soon as possible.

https://www.freebsd.org/security/unsupported.html

Simplest solution, swap both drives so it boots from the disk that still has the bootcode. Once it's booted write the bootcode to the missing one.


----------



## wblock@ (Jun 23, 2016)

A full-disk mirror will duplicate bootcode.  Multiple mirrors of GPT partitions is not a good idea.  I've done it, undid it, and recommend against it.


----------



## kpa (Jun 23, 2016)

You can still write the bootcode since the boot blocks/partitions are not part of any of the mirrors. This is the standard way on a GPT disk that boots via the old style BIOS:

`# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 adaX`

Replace adaX with the real drive e.g. ada1.


----------



## klabacita (Jun 24, 2016)

Them, I need to do before I add my disk to the mirror?
Because I got this error:


```
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
gpart: /dev/ada0p1: Operation not permitted
```


----------

