Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 May 2022 13:22:36 +0300
From:      Christos Chatzaras <chris@cretaforce.gr>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   ZFS replace a mirrored disk
Message-ID:  <C46DD702-BED7-466F-986D-289A4A56DC4F@cretaforce.gr>

next in thread | raw e-mail | index | archive | help
When a disk fails and want to replace it with a NEW disk are these =
commands correct?

----
gpart backup nvd1 | gpart restore -F nvd0
gmirror forget swap
gmirror insert swap /dev/nvd0p2
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 nvd0
zpool replace zroot nvd0
----


I try to simulate a disk "failure". I tried the above commands with the =
SAME disk without success. I believe the "issue" is because the "new" =
disk is the SAME as before.

I did these steps:

1) Boot with mfsBSD and did "gpart destroy -F nvd0"
2) Reboot the server in the main OS.

If the "new" disk is the SAME as before do I have to change the commands =
to these?

----
gpart backup nvd1 | gpart restore -F nvd0
gmirror forget swap
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 nvd0
zpool offline zroot nvd0
zpool online zroot nvd0
----


Also I notice that with the SAME disk "gmirror forget swap" starts =
rebuilding swap immediately and "gmirror insert swap /dev/nvd0p2" is not =
needed. Is this the correct behaviour when the "new" disk is the SAME?=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C46DD702-BED7-466F-986D-289A4A56DC4F>