Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Getting started

Darren Ldl edited this page Apr 12, 2019 · 8 revisions

Notes

Since blkar is designed to be very self-contained for user to carry around easily, there are a lot of built in facilities like help messages, calc mode, and encode mode with --info-only flag, which should satisfy your need most of the time.

You should be able to find most of the usage info mentioned in this document in the help messages as well.

If you need to do more than info lookup, and need to know the exact behaviour of blkar in different scenarios, consult the blkar specification.

The specification is reviewed and updated on a best effort basis as features and changes were added. This means the specs is normally very accurate as blkar's code base does not (and should not) change much. If you need to rely on the specs for critical purposes, however, feel free to open an issue or send me an email to request a specs review or ask more specific questions.

General behaviour

All behaviours of blkar are designed to be as reasonable as possible, and all modes support graceful handling of Ctrl-C.

Common features across all modes

All modes support JSON output mode. You can invoke this by supplying the --json flag.

Creating SBX container

First step is to encode your file. blkar encode foo will encode the file foo and produce foo.sbx. Since 4.0.0, blkar defaults to using SBX version 17, which uses block size of 512 bytes, has a data to parity block ratio of 10:2 (20% redundancy in other words), and burst error resistance level of 10.

The default SBX version is usually okay, allowing you to rescue and repair data in most scearios. However, the default may introduce significant overhead if your file is very small. If you want to encode a large quantity of small files, consider bundling them together first using things like tar, or specify custom options.

blkar encode --help gives you a table of the features provided by the different versions.

Decoding the SBX container

When you want to retrieve the original file from the container, just do blkar decode foo.sbx.

If hash is previously recorded during the encoding process, blkar will hash the output file automatically to verify the integrity of the file and display the check result.

Note that decode mode does not repair any data. To repair the container, repair mode will need to be invoked (see below).

Viewing the SBX container

blkar show foo.sbx will find the first metadata block and display all valid metadata fields recorded.

Alternatively use blkar show --show-all foo.sbx to find and show all metadata blocks.

Maintenance

The check and repair modes are the most useful modes for maintenance of the container.

blkar check foo.sbx only checks for validity of the individual SBX blocks in the containers, and does not take any forward error correction schemes into account.

blkar repair foo.sbx tries to repair the container if error correction is enabled for the version, and exits otherwise. You may need to sort the container first before repairing as repair mode assumes the container to be well ordered.

Data rescue

If you have any experience with data recovery using Linux, chances are you have used ddrescue before to image failing disks before. Rescue mode in blkar is similar in usage, but specialised to rescue SBX blocks only.

Note that you should still use ddrescue first for a failing drive instead of blkar, see General data rescue for important steps on how to rescue your SBX containers from failing devices.

The Rescue mode basics page contains more info on rescue mode.