Is there a file system that does error correction?
Solution 1:
I'm not sure about virtual filesystem but there are many "real" file systems that have built-in fault-tolerance
- Bcachefs - It's not yet upstream, full data and metadata checksumming, bcache is the bottom half of the filesystem
- Btrfs – A file system based on B-Trees, created by Oracle Corporation.
- HAMMER and HAMMER2 – Dragonfly BSD's primary filesystem, created by Matt Dillon.
- ReFS (Resilient File System) – A file system by Microsoft with built-in resiliency features.
- Reliance – A transactional file system with CRCs, created by Datalight.
- Reliance Nitro – A tree-based transactional file system with CRCs, developed for high performance and reliability in embedded systems, from Datalight.
- NOVA – The "non-volatile memory accelerated" file system for persistent main memory.
- ZFS – Created by Sun Microsystems for use on Solaris 10 and OpenSolaris, ported to FreeBSD 7.0, NetBSD (as of 08/2009), Linux and to FUSE (not to be confused with the two zFSes from IBM)
- WekaFS – a shared parallel filesystem that delivers extreme performance at any scale and is optimized for NVMe and the hybrid cloud.
File systems with built-in fault-tolerance
I don't know the detail features of those files systems so some of them may only provide data error detection instead of correction. You need to check their documents. But if they do have error correction then of course you can use them in a virtual hard drive and let them handle the error correction. There's no difference whether the file system driver reads from a physical or a virtual drive, since they only receive a stream of bytes.
For Btrfs you can also have data duplication for error correction although it'll cost twice the disk space. Just use --dup data
option
mkfs.btrfs --metadata dup --data dup /dev/<device>
In ZFS it can be done similarly with the set copies
command
zfs set copies=2 users/home
For more information read How to get error detection and correction on a single hard drive on linux (with btrfs or other methods)
Solution 2:
Yes; Ceph
is the only "file system" I'm aware of that optionaly uses Error Correction Code (ECC). Normaly ECC is implemented in hardware (RAM, HDD, SSD) so btrfs/zfs/stratis only use checksums, mirrors, parity to handle full drive falure, or corruption past the ECC threshhold. Unlike btrfs/zfs/stratis, Ceph and other distributed file systems have no inherent single point of falure so Ceph/etc can offer continuous availability.
Some archives (rar and par2) offer ECC. like .md5 files can accompany other files so can par2.
I recommend reading https://en.wikipedia.org/wiki/Error_correction_code