r/Snapraid • u/BootToggle • Jun 08 '26
Blue-sky question about using mergerfs to help with failed drive recovery for Snapraid
[See the resolution to my issue at the end of this description.]
This may be a weird question, but it has come up a lot lately that it is a very bad time to buy a replacement for a large HDD that has failed in a Snapraid array.
So my question: Would it be possible to throw together a quick MergerFS pool built from two smaller drives (which I might already have in my retired drive collection) to create a virtual drive large enough to substitute for the failed drive (during file recovery) in my Snapraid array?
The idea would be to use this only long enough to recover all of the contents of the failed drive into a sufficiently large virtual drive, after which the recovered files could be redistributed so that a smaller actual drive could be substituted back in. This drive would have been too small to directly replace the failed drive if the failed drive contained too much data to fit on this smaller drive. (And it is assumed that I simply can't obtain a drive large enough to directly replace the original failed drive).
What do we think, could this possibly work?
I know that in general, one should apply Snapraid protection directly to the physical drives underpinning a mergerfs filesystem, but this would be a special case. And no concern if the solution might be inefficient. The only goal is to accomplish a full file recovery while avoiding an unaffordable purchase quandary. Or to get my Snapraid array back into service more quickly if there would be a long lead time for purchasing a proper replacement drive.
(reposted from r/mergerfs for wider Snapraid community input. Already some useful comments there.)
[Edited by the OP to update with some resolution]
It turns out that MergerFS works well to address the problem as stated, provided I use only the Snapraid commands 'fix' and 'check' during the temporary MergerFS setup for file recovery. Remember that the use of MergerFS in this case is only for file recovery, so don't run 'sync' until after the Snapraid array has been put back to a new normal configuration with only physical drives. There are some definite advantages to the MergerFS approach to this problem, in comparison to the needs of LVM or mdadm, actually requiring fewer spare drives for the complete procedure. See details of all this in the comment from u/amadvance, and my reply elsewhere in this post
3
u/lyothan Jun 08 '26
You probably can use a lvm to create a single large drive. I don’t know if mergerfs will work since snapraid read the drive uuid. It might work with mergerfs
3
u/amadvance Jun 10 '26
I just tried it, and it works.
Mount the mergerfs directory, change the snapraid.conf "data DISK_NAME" path to point to that directory, and run:
snapraid fix -d DISK_NAME
Obviously, this makes sense only for 'fix' and 'check' during an emergency recovery. It is not recommended for normal operations, like 'sync' and 'scrub', because mergerfs will hide the underlying devices.
2
u/Nillows Jun 08 '26
Snapraid does not gracefully handle mergerfs mountpoints - and I don't even think the developers want it to because it sounds like a great way for people to overcomplicate an already delicate recovery structure. You would also need a parity drive or parity pool equal to, or larger than, the size of the entire mergerfs pool capacity to contain the XOR parity bits.
In the snapraid.conf, you want to list each drive's mountpoint individually, similar to how you must list them in individually in fstab to create the mergerfs pools.
Lastly, the more parity layers you have, the more robust your array is from multiple drive failure scenarios. By using mergerfs to reduce the amount of parity drives to 1, you would effectively be making your array less recoverable in multi drive failure situations, when you could have instead setup snapraid.conf to have parity 2 instead of one giant parity 1.
2
u/Drooliog Jun 08 '26
Combining a couple drives with LVM as suggested elsewhere would probably be easiest.
Failing that - and I haven't tried this myself - I reckon it'd be feasible to recover about half the array by manually targeting with filtering - e.g.
snapraid fix -f DIR/So long as SnapRAID doesn't complain about disk size from the outset, you only need a disk big enough for each run that encapsulates just the filtered data. Basically... run a
fix -f DIR1/, move the data out, run it again:fix -f DIR2/etc..You might even be able to spread the recovered data back onto the other disks in your mergerfs pool, provided you have enough space there.
1
u/abubin2 Jun 08 '26
Use the smaller drives as data instead. No need to add another layer of virtual drive.