iczelia
an error/erasure code system guarding data integrity
| 2026-09-05 07:33 | misc. style | Kamila Szewczyk |
| 2026-09-04 21:20 | misc. style | Kamila Szewczyk |
| 2026-09-02 20:31 | new codec test | Kamila Szewczyk |
| 2026-09-02 20:31 | O(t^2)->O(t) in the inner code as a clever trick | Kamila Szewczyk |
| 2026-09-02 13:30 | fix a make race | Kamila Szewczyk |
| 2026-09-02 13:22 | update the release workflow | Kamila Szewczyk |
| 2026-09-02 12:58 | update the ChangeLog | Kamila Szewczyk |
| 2026-09-02 12:21 | w95 compatibility fix | Kamila Szewczyk |
| 2026-09-02 11:52 | additional tests | Kamila Szewczyk |
| 2026-09-02 11:09 | build.yml: typo | Kamila Szewczyk |
| main (2026-09-05 07:33) |
| 2.0 (2026-09-02 13:30) | 1.1 (2026-04-20 19:49) | 1.0 (2026-04-17 19:52) | 0.7 (2025-09-19 09:49) | 0.6 (2025-09-10 19:36) | 0.5 (2024-10-17 01:04) | 0.4 (2024-10-16 13:17) | 0.3 (2024-10-16 00:00) | 0.2 (2024-10-15 13:13) | 0.1 (2024-10-14 20:42) |
xpar protects files and directory trees with error and erasure correction. It can repair bad sectors, bit flips, truncation, media rot, and transfer damage.
xpar is licensed under GNU GPL version 3 only. See COPYING. Report issues to Kamila Szewczyk <k@iczelia.net>. The project is hosted at <https://github.com/iczelia/xpar>.
xpar create -r 10% -o backup movie.mkv
xpar verify backup.xpa
xpar repair --in-place backup.xpacreate writes recovery volumes. verify returns 0 for clean data, 1 for repairable damage, and 2 for damage beyond the available recovery. repair restores what the set covers.
See the format specification and xpar(1) for the format and full command reference. make docs builds the specification.
Use your package manager or download a binary from GitHub Releases. To build a release tarball, run
./configure
make
sudo make installThe project uses C99. A Git checkout needs ./bootstrap first. Useful options follow.
| Configure option | Effect |
|---|---|
--disable-simd | Build scalar kernels only |
--disable-threads | Build without threads |
--enable-sanitizers | Enable ASan and UBSan for tests |
xpar supports three parity file layouts.
| Layout | Storage |
|---|---|
sidecar | Keep the originals; store an index and recovery beside them |
split | Store consecutive raw stream ranges in base.dNN files |
armoured | Store manifest, data, and recovery in one base.xpa |
Protect a tree with 15 percent redundancy and file deduplication:
xpar create -r 15% --dedup=file -o photos -R 448CANONThe manifest records names, sizes, checksums, and selected filesystem metadata. --dedup=chunk also deduplicates repeated ranges. list prints the manifest; info prints geometry and redundancy. --json selects JSON Lines output and ends a fatal stream with a summary record.
-r accepts a slice count, percentage, byte size, or multiple such as 2x. recover rebuilds a missing set volume. explain prints a shell recipe for copying the armoured region without xpar or correction.
The outer Reed-Solomon code reconstructs missing data. xpar divides slices into checksum-protected cells and erases only damaged cells, which limits decoding and writes after local damage. Cells are at most 64 KiB by default; --cell sets the size.
The optional inner code corrects bit errors. --armour=metadata protects critical metadata in sidecar and split sets. --armour=all also protects slice tables and recovery slices; armoured archives protect the whole packet stream. The default GF(2^8) RS(255,223) code adds about 14 percent to recovery volumes. Use --armour-t=4 or more: at t=1, some two-symbol damage can resemble one bad symbol. The outer checksum rejects the wrong correction.
scrub checks the inner code and reports corrected symbols. --deep also recomputes recovery data.
xpar scrub --deep photos.xparepair --in-place keeps names, inodes, and hard links where possible. It can recreate missing empty files, directories, links, and set volumes. An undo journal precedes protected writes and is removed after success. Run xpar undo after an interruption. An unreadable journal is retained; replace it only with --replace-journal when losing it is intentional.
repair --dry-run --exit-on-change returns 1 when a repair would write and 0 when nothing needs changing. Resynchronisation can find data shifted by inserted or deleted bytes.
add appends a generation and inherits unchanged data. prune removes old generations; consolidate rewrites a chain as one. Verification normally walks oldest to newest. --generation=G selects one, and info --deps shows its dependencies. Maintenance rewrites use a journal and refuse unreadable chains.
--auth-key=FILE authenticates metadata and content with a keyed MAC; it does not encrypt. Every later operation needs the key and returns 6 when it is absent or wrong. --auth-only omits public CRCs and whole-file hashes.
Always require the key when checking an authenticated set. An attacker cannot forge its MAC, but can remove authentication and retag the set; a keyless check would then accept an unauthenticated set.
| Code | Meaning |
|---|---|
| 0 | Success, or clean data under verify |
| 1 | Repairable damage, or change under --exit-on-change |
| 2 | Damage beyond the available recovery |
| 3 | Set not found, invalid, or unsupported |
| 4 | Usage error |
| 5 | I/O error |
| 6 | Authentication error |
| 7 | No plan fits -m, or memory is exhausted |
| 8 | Internal error |
xpar reads output back after writing unless --no-verify-after is given. Runtime dispatch covers x86 SSSE3, SSE4.2, AVX2, GFNI, GFNI-512, and VBMI; ARM NEON, PMULL, and SVE; PowerPC VSX; and RISC-V vectors. The format is portable.
Windows NT builds use UTF-16 paths. Windows 95 and DJGPP/MS-DOS have separate scalar targets; see INSTALL for commands. xpar 2.0 cannot read 1.x archives. Decode those with xpar 1.x, then protect the result with xpar 2.0.
xpar adds bit-error correction, cell-sized erasures, in-place repair, burst interleaving, authentication, resync, generations, and deduplication beyond a basic PAR-style workflow. It is not PAR2-compatible and has no GPU backend.
