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
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.
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?
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.
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.
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 ;)
OPNsense-System-Snapshots.png
👉 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
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?
Hi Patrick
What is the benefits of having it mirrored?
Cheers
J
The system won't crash when one of the drives fails ;-)
Hi Patrick
Well in that case - lets mirror the swap drive.
Thanking you for all your help so far! :)
Quote from: justmehereinBrisbane on October 01, 2025, 09:39:45 AMswapinfo
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%
First remove that swap file. It hurts more than it helps since you have "real" swap partitions.
Go to System > Settings > Miscellaneous and remove that check mark from "Add a 2 GB swap file to the system".
Then on a root shell:
swapoff -aEdit the file /etc/fstab and remove these two lines:
/dev/ada0p3 none swap sw 0 0
/dev/ada1p3 none swap sw 0 0
Replace them with this one instead:
/dev/mirror/swap none swap sw 0 0Then these commands:
gmirror label -b round-robin swap ada0p3
gmirror configure -a swap
gmirror insert swap ada1p3
gmirror status
swapon -a
swapinfoThat should do it.