# gmirror re-insert disk into array



## oobayly (Apr 28, 2010)

I've a machine with two drives  mirrored using gmirror. When I moved it recently one of the SATA cables must have been dislodged as the array is now marked as DEGRADED, and only one drive is found.

```
# gmirror status
      Name    Status  Components
mirror/gm0  DEGRADED  ad4
```
Unfortunately, I didn't catch this immediately so the disconnected drive is several days out of sync.
My question is this: after I restart the machine (changing cables & connectors and making sure both drives are found), can I just issue the following:

```
gmirror insert gm0 /dev/ad3
```
Will gmirror know to rebuild ad3 from ad4 as ad4 is the only drive in the array?


----------



## User23 (Apr 28, 2010)

always take a look in the manual pages!



> man gmirror



there is a example section too

---

if ad3 is empty i would proceed like written in the manpage or

http://www.freebsd.org/doc/en/books/handbook/geom-mirror.html
19.4.3 Recovering From Disk Failure

---

But if it still contains data, i would disconnect ad3 and after boot up run


```
gmirror forget gm0
```

--

after shutdown and reconnecting ad3 boot again and run


```
gmirror insert gm0 /dev/ad3
```


----------



## oobayly (Apr 28, 2010)

Aha, I had spotted the *forget* command that in the man page but was a little wary of using it as the example specified "One disk failed.  Replace it with a brand new one", which in my case isn't true as the drive still has data on it. Of course, that irrelevant as *insert ad3* will rebuild from ad4.
My (unfounded) worry was that gmirror could use ad3 as the disk to sync from.


----------



## User23 (Apr 29, 2010)

well "forget" sounds a bit dramatic. first time i used it i was confused too.


```
forget      Forget about components which are not connected.  This com-
                 mand is useful when a disk has failed and cannot be recon-
                 nected, preventing the remove command from being used to
                 remove it.
```


----------

