DRSProjects

DocsParbit

Parbit documentation

User guide

From first run to schedules

This guide takes you from download to a protected, regularly checked folder. Commands are shown for Linux (./parbit.sh); on Windows use parbit.bat with the same commands, or double-click it for the menu.

Install

  1. Download the package for your system from the releases page:

    • Linux: Parbit-<version>-linux.tar.gz (the latest release);
    • Windows: Parbit-<version>-windows.zip (the release named for Windows).
  2. Unpack it where the protected files should live. Everything Parbit needs stays in that folder: the scripts, the files you protect (in parbit/), their recovery data (in the hidden .parbit/) and the settings.

  3. Linux only: install par2.

    Distribution Command
    Arch, Manjaro sudo pacman -S par2cmdline
    Debian, Ubuntu, Mint sudo apt install par2
    Fedora sudo dnf install par2cmdline
    openSUSE sudo zypper install par2cmdline

    Parbit uses GNU tools (bash 4.4+, coreutils, findutils, util-linux), which every mainstream distribution has. macOS is not supported.

    Windows: nothing to install, bin\par2.exe is included.

On Linux you can also get just the script: parbit.sh works on its own, as long as a folder called parbit sits next to it. Using the same drive on both systems? Unpack both packages in the same folder (see Windows).

First run

Move or copy the files you want to protect into parbit/ (any number of sub-folders), then open a terminal in the Parbit folder and run:

./parbit.sh

The menu opens. Press 1 (Update parity): Parbit lists the files it's about to protect and asks for confirmation. Creating parity reads every file once, so the first run on a large collection takes a while, about as long as copying the data. Later runs only process what changed.

When it's done, press 4 (Status) to see how much is protected and how much space the parity takes.

Prefer commands to menus? The same thing is:

./parbit.sh update
./parbit.sh status

Daily use

There are only two habits to keep:

After adding, editing, moving or deleting files, run Update. Parbit finds out what changed by itself:

  • new files get parity;
  • edited files get fresh parity;
  • moved or renamed files keep their parity (it just follows them, instantly);
  • deleted files lose theirs.

Use ./parbit.sh -n update (dry run) to see what would happen without changing anything.

Every few months, run Verify. This reads every file and compares it with its parity. It's the only way to catch silent damage, so don't skip it: Parbit reminds you in the menu and after each update once the last full verify is more than 180 days old (the VERIFY_REMIND setting).

./parbit.sh verify                    # everything
./parbit.sh verify parbit/photos      # just one folder (or file)

A verify of the whole folder takes about as long as reading all your data once.

When damage is found

A verify ends with a summary like:

Checked 1520 files (212.4GB) in 3412s: 1517 intact, 0 repaired, 3 damaged, 0 unrecoverable
  • Damaged (repairable): in a terminal, Parbit immediately offers to repair. Say yes, or run ./parbit.sh repair later. The file is fixed in place, keeping its name, permissions and timestamp.
  • Unrecoverable: the damage is bigger than the recovery data can cover. Restore that file from a backup. Then run update, which notices the restored file and protects it again.

Want to look at what was wrong? Set KEEP_DAMAGED to yes: after each repair the damaged copy is kept in .parbit-quarantine/ (delete it when you're done).

./parbit.sh config KEEP_DAMAGED yes

Lines starting with ~ modified since protected or ? deleted or moved aren't damage: they mean you changed files since the last update. Run update.

Choosing the redundancy

REDUNDANCY (default 20%) is how much recovery data each file gets, as a share of its size. A file can be repaired as long as no more than roughly that share of it is damaged.

Redundancy Parity space Good for
5–10% small large, replaceable media; drives that are already reliable
20% moderate most collections (default)
30–50% large very old drives, cheap USB sticks, irreplaceable files

Bit rot usually hits a few bytes or one sector at a time, so even 5–10% repairs typical damage. Very small files get a bit more than the nominal share, because a file always has at least one recovery block.

To change it:

./parbit.sh config REDUNDANCY 10

New and edited files use the new value right away. Parbit offers to redo the existing parity too (or run ./parbit.sh update --rebuild later). Before rebuilding, it checks each file, so damage is never turned into "correct" parity.

External drives

Parbit is well suited to external drives and USB sticks: unpack it at the root of the drive, and everything (scripts, data, parity, settings) travels with it.

  • Used on both Linux and Windows? That works: both versions read and write the same files. See Windows.
  • exFAT and FAT drives store times in local time. After you change time zone, or plug the drive into a computer with a different clock, every timestamp can move by whole hours. Parbit spots this: it checks the content, records the new time if the file is intact, and reports damage (keeping the parity to repair it) if not.
  • Unplugged drive? If many protected files suddenly vanish, update doesn't delete their parity. It warns you and asks first (DELETE_GUARD, default 50%). If you really deleted them, confirm with ./parbit.sh update -y.

Automatic checks

./parbit.sh schedule weekly      # or daily, monthly
./parbit.sh schedule             # show the current schedule (and change it, in a terminal)
./parbit.sh schedule off

On Linux this creates a systemd user timer. On Windows it creates a Task Scheduler task. Each scheduled run does an update, then a full repair (or only a verify if you set AUTO_REPAIR to no), at low priority, and shows a desktop notification if something needs your attention. A run missed because the computer was off happens at the next start. While the drive isn't connected, nothing happens (on Linux the run is skipped; on Windows the task just records that it couldn't find the script).

For a drive that is rarely plugged in, a schedule is of little use: run Update after copying files, and Verify when the reminder shows up.

Notifications are controlled by NOTIFY: problems (default), all, or off.

Keeping some files out

List patterns in .parbitignore, one per line (./parbit.sh ignore opens it in your editor):

*.tmp          files with this name in any folder
cache          a file or folder called "cache" in any folder (and everything in it)
videos/*.mkv   a path, relative to parbit/

Patterns are case-sensitive. Files that already have parity lose it at the next update. Empty files and symbolic links are never protected.

Removing Parbit

Your files in parbit/ are ordinary files and never depend on Parbit. To stop using it:

  1. ./parbit.sh schedule off, if you set up a schedule;
  2. delete .parbit/ (the parity), the .parbit* files and the scripts.

./parbit.sh reset deletes just the parity, if you want to start over.

Edit this page on GitHub