Version Metadata¶
At this stage Benji has backed up all image data to a (hopefully) safe place. However, the blocks are of no use without the corresponding metadata. Benji will need this information to get the blocks back in the correct order and restore the image.
This information is stored in the database backend. Additionally Benji will backup the metadata itself to the storage
automatically. Should you lose your database backend, you can restore these metadata backups by using
benji metadata-restore
.
$ benji metadata-restore --help
usage: benji metadata-restore [-h] [-S STORAGE] VERSION_UID [VERSION_UID ...]
positional arguments:
VERSION_UID Version UID
optional arguments:
-h, --help show this help message and exit
-S STORAGE, --storage STORAGE
Source storage (if unspecified the default is used)
There is currently no mechanism to import the backup of all version’s metadata from the storage, but you could get a list of all versions manually from the storage.
Note
This metadata backup is compressed and encrypted like the blocks if you have these features enabled.
If you want to make your own copies of your metadata you can do so by using
benji metadata-export
.
$ benji metadata-export --help
usage: benji metadata-export [-h] [-f] [-o OUTPUT_FILE] [filter_expression]
positional arguments:
filter_expression Version filter expression
optional arguments:
-h, --help show this help message and exit
-f, --force Overwrite an existing output file
-o OUTPUT_FILE, --output-file OUTPUT_FILE
Output file (standard output if missing)
If you’re doing this programmatically and are exporting to STDOUT you should
probably add -m
to your export command to reduce the logging level of Benji.
$ benji -m metadata-export V1
{
"metadataVersion": "1.0.0",
"versions": [
{
"uid": 1,
"date": "2018-06-07T12:51:19",
"name": "test",
"snapshot_name": "",
"size": 41943040,
"block_size": 4194304,
"valid": true,
"protected": false,
"tags": [],
"blocks": [
{
"uid": {
"left": 1,
"right": 1
},
"date": "2018-06-07T14:51:20",
"id": 0,
"size": 4194304,
"valid": true,
"checksum": "aed3116b4e7fad9a3188f5ba7c8e73bf158dabec387ef1a7bca84c58fe72f319"
},
[...]
You can import such a dump of a version’s metadata with benji metadata-import
.
$ benji metadata-import --help
usage: benji metadata-import [-h] [-i INPUT_FILE]
optional arguments:
-h, --help show this help message and exit
-i INPUT_FILE, --input-file INPUT_FILE
Input file (standard input if missing)
You can’t import versions that already exist in the database backend.