Re: ZFS replace a mirrored disk
- Reply: Christos Chatzaras : "Re: ZFS replace a mirrored disk"
- In reply to: Christos Chatzaras : "ZFS replace a mirrored disk"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 May 2022 12:14:22 UTC
On Wed, May 11, 2022 at 01:22:36PM +0300, Christos Chatzaras wrote: Hello, > 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. First please define "without success", what doesn't work? please paste output of: $> gpart show nvd1 also, is it an UEFI system or classicla BIOS with GPT? What FreeBSD version? zpool replace zroot nvd0 is invalid, you should use: $> zpool replace zroot nvd1 nvd0 (but it uses the entire disk, which is probably incorrect too) > > 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? -- Julien Cigar PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced.