Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Hardware and Performance
»
Enable ZFS self healing by mirroring across 2 partitions of same SSD?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Enable ZFS self healing by mirroring across 2 partitions of same SSD? (Read 1343 times)
ozpac
Newbie
Posts: 8
Karma: 1
Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
on:
April 18, 2024, 07:13:44 pm »
My ZFS root accumulated some file damage and then refused to mount.
I will rebuild the filesystem from scratch but want to increase resiliency by making use of ZFS’s self healing abilities which requires mirrored data.
I’m using a Protectli device which only has one drive bay (a mini pcie port for mSATA cards).
My idea is to split that 128gb drive into two 64GB partitions then make the OPNSense system root a mirrored zpool across the two.
I will also run daily snapshots to external drives and so on, but I want better prevention rather than just better cures.
Is this a good plan?
«
Last Edit: April 18, 2024, 07:15:21 pm by ozpac
»
Logged
Patrick M. Hausen
Hero Member
Posts: 6807
Karma: 572
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #1 on:
April 18, 2024, 07:21:37 pm »
How do you replace the broken partition while keeping the other one? Because that is what "self healing" means. You replace the broken disk. ZFS "resilvers" the data until redundancy is restored.
Does not make much sense to me.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
ozpac
Newbie
Posts: 8
Karma: 1
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #2 on:
April 18, 2024, 07:33:46 pm »
As I understand it, ZFS computes and stores checksums for everything (blocks?). It uses these to determine whether the block is in tact or damaged. If damaged then it will refer to the mirror to see if that block is in tact. It will then automatically write the undamaged block over the damaged one - thus self healing. With only one copy of the data then self healing isn’t possible.
Isn’t that accurate?
In other words, this is the only way I can defend against bitrot, on this hardware. If I can do more I would love to do so.
«
Last Edit: April 18, 2024, 07:38:51 pm by ozpac
»
Logged
Patrick M. Hausen
Hero Member
Posts: 6807
Karma: 572
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #3 on:
April 18, 2024, 07:36:12 pm »
A broken block stays broken until you perform a resilver operation. Usually after you swapped the broken device.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
ozpac
Newbie
Posts: 8
Karma: 1
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #4 on:
April 18, 2024, 07:40:36 pm »
Ah I see, that makes sense.
How about bitflips (eg cosmic ray)? This would mitigate them wouldn’t it?
I gather they are very rare but nevertheless, would my scheme work?
Logged
Patrick M. Hausen
Hero Member
Posts: 6807
Karma: 572
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #5 on:
April 18, 2024, 07:44:09 pm »
Most certainly yes. You could also create the zpool with copies=2 or copies=3
https://jrs-s.net/2016/05/02/zfs-copies-equals-n/
Mark the second paragraph with the laptop example.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
ozpac
Newbie
Posts: 8
Karma: 1
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #6 on:
April 18, 2024, 07:53:43 pm »
Incredibly helpful info, thank kindly! I appreciate your efforts.
Logged
hushcoden
Hero Member
Posts: 544
Karma: 23
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #7 on:
April 21, 2024, 05:28:53 pm »
Question from a newbie: is the ZFS’s self healing enabled by defauld having installed OPNsense with two drives (mirror) ?
Tia.
Logged
Patrick M. Hausen
Hero Member
Posts: 6807
Karma: 572
Re: Enable ZFS self healing by mirroring across 2 partitions of same SSD?
«
Reply #8 on:
April 21, 2024, 05:33:23 pm »
There is no healing without operator intervention. You can enable regular scrubs via cron jobs, though.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Hardware and Performance
»
Enable ZFS self healing by mirroring across 2 partitions of same SSD?