Add mirrored drive to existing ZFS install

Started by Moonshine, January 18, 2022, 05:50:10 AM

Previous topic - Next topic
Quote from: pmhausen on July 12, 2022, 09:48:06 AM
, your OmniOS example seems to be Sparc? At least the device names hint at that.
Nope - OmniOS is pure x64. I think SPARC is only catered for by Triblix.

Great thread, exactly what I was looking for.

One more question: Can I run the commands directly from OPNSense shell while booted or do I have to boot from an external drive?

All from the live system. For another complete walkthrough see

https://forum.opnsense.org/index.php?topic=32650.msg157910#msg157910
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Thanks, worked nicely.

The only weird thing was, that gmirror load gave the following error message "gmirror: Command 'load' not available; try 'load' first.".
Don't know if it was because its is already loaded. (however gmirror unload gives a similar error).
In any case, I was able to complete the steps afterwards and gmirror status now shows me the swap mirror.

So I'm adding a second NVME drive to my DEC850v2 and I wanted to check the commands since all the examples above seem to be for SATA drives.

output of gpart show on original drive:
gpart show nda0
=>        3  500118181  nda0  GPT  (238G)
          3     532480     1  efi  (260M)
     532483        305     2  freebsd-boot  (153K)
     532788  482344960     3  freebsd-zfs  (230G)
  482877748   17240436     4  freebsd-swap  (8.2G)

Output of zpool status:
zpool status
  pool: zroot
 state: ONLINE
status: Some supported and requested features are not enabled on the pool.
        The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          nda0p3    ONLINE       0     0     0

What I think I should do:
#copy partition table
gpart backup nda0 | gpart restore -F nda1
#copy EFI
dd if=/dev/nda0p1 of=/dev/nda1p1
#copy bootloader
dd if=/dev/nda0p2 of=/dev/nda1p2
#mirror zfs
zpool attach zroot nda0p3 nda1p3
# turn swap partition into mirrored device
gmirror load
swapoff -a
gmirror label -b round-robin swap nda1p4
gmirror configure -a swap
gmirror insert swap nda0p4

Does this seem sound for how the NVME drive is configured on the DEC850 v2?

Looks good.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)