How to add a hot spare to a GEOM Raid 1

Started by justmehereinBrisbane, September 15, 2025, 07:29:15 AM

Previous topic - Next topic
Hi

I have an up and running OPNSENSE system with the latest updates  with 2 x 240GB SSDS running in software GEOM raid 1

Is it possible to add a 3rd 240GB SSD to add as a hot spare that would kick in if one of the disks in the raid 1 was to fail?

Or do i have to do this at installation?

Thanking you

J


A GEOM mirror? Really? Quite unusual. You are sure it's not ZFS? Please post the output of
gpart show
gmirror status
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hi Patrick

Thank you for your response.


I can confirm it is ZFS as I am able to take snapshots.

gpart show
=>       40  500118112  ada0  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  482805760     4  freebsd-zfs  (230G)
  500117504        648        - free -  (324K)

=>       40  500118112  ada1  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  482805760     4  freebsd-zfs  (230G)
  500117504        648        - free -  (324K)

gmirror status produces no output

I have created a os-monit service called raid_check  path is /sbin/gmirror status tests is NonZeroStatus

This shows up in Monit status as

Program 'Raid_Check'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  last exit value              0
  last output                  -
  data collected               Mon, 15 Sep 2025 16:31:01



Hope all of this makes sense.

Cheers

J






Now the output of this command please - you are running a ZFS mirror, not a GEOM one:

zpool status
And yes, you can add a hot spare with ZFS.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

With a mirror, a three-way mirror almost makes more sense than a hot spare. Hot spares are more useful for RAIDZ/RAIDZ2.

Hi Patrick

output of the command zpool status

 zpool status
  pool: zroot
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0

errors: No known data errors

OK, so what's it going to be - 3-way mirror or hotspare?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hi Patrick

Hotspare.  Can you tell me how to do this?

Thanking you

J

Sorry for the delay, I was traveling.

So last thing I need: "gpart show" output, please. With the new disk in place.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

 gpart show
=>       40  500118112  ada0  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  482805760     4  freebsd-zfs  (230G)
  500117504        648        - free -  (324K)

=>       40  500118112  ada1  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  482805760     4  freebsd-zfs  (230G)
  500117504        648        - free -  (324K)



new disk ada2 had a windows partition on it - so i removed it with the command gpart destroy -F ada2

ls /dev/ shows device ada2 present

thanking you
/

gpart backup ada0 | gpart restore ada2
zpool add zroot spare ada2p4
dd if=/dev/ada0p1 of=/dev/ada2p1 bs=1m
dd if=/dev/ada0p2 of=/dev/ada2p2 bs=1m

Do you want to mirror your swap space? Output of "swapinfo" will tell, but from our first tests with "gmirror" I guess it is not mirrored currently.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

September 29, 2025, 10:29:45 PM #11 Last Edit: October 01, 2025, 10:53:53 AM by Jose
Quote from: jade_nekotenshi on September 17, 2025, 04:49:10 PMWith a mirror, a three-way mirror almost makes more sense than a hot spare. Hot spares are more useful for RAIDZ/RAIDZ2.

+1 on this.

Also with a single ZFS disk, one can export the latest Boot Environment to a safe place, and can be later imported in case of disk failure and your back to a working order in minutes, and now with the Dashboard Snapshots one can easily update/upgrade with peace of mind ;)

You cannot view this attachment.

👉 Been using OPNsense since v 16.x with Root On ZFS way before the initial ZFS installer script was made and I can tell its pretty solid stable.

Regards
OPNSense on Bhyve VM set with 2CPU, 4GB-RAM, 120GB-ZFS, Transparent Filtering Bridge(TFB).
Intel i5-2390T with 32GB-RAM and Intel I350-T4(2-Ports Passthrough for OPNsense + VirtIO).
System running Jails, MEDIA/SMB/NFS/SSH servers etc.., ZFS-Mirrors for boot and storage.

Quote from: Patrick M. Hausen on September 29, 2025, 03:43:23 PMHi Patrick - thank you so much for that - output of zpool status is now as below

zpool status
  pool: zroot
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0
        spares
          ada2p4    AVAIL

errors: No known data errors

a swapinfo results in below

swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ada0p3       8388608        0  8388608     0%
/dev/ada1p3       8388608        0  8388608     0%
/dev/md98         2097152        0  2097152     0%
Total            18874368        0 18874368     0%


does this look like it is mirrored correctly?

Thanking you

J








No, it's not mirrored. Do you want that?
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hi Patrick

What is the benefits of having it mirrored?

Cheers


J