file4life

A file backup program

Contents

Conventions

In command examples, words in angular brackets, like <storage id>, are placeholders for some specific value.

Concepts

Environment

An environment is a computer where file4life is run.

An environment is identified by a unique ID and can be assigned one or more labels.

The ID is saved in the file ~/.f4l/env-id.

Storage

A storage is a directory identified by a unique ID saved in a .f4l-id file.

A storage can be moved across environments, for example in the case of removable drives or drives shared across a network.

file4life takes note of where the storage was seen and what files it contained.

If you want to keep track of files in /home/user/media/pictures/holidays-2014 you can choose at which directory level the storage should start. We recommend to start at the most specific level containing related files to backup. In this case, this would probably be /home/user/media or /home/user/media/pictures.

Session

A session is a set of operations added (almost) atomically to the metadata file.

Running file4life

Running file4life without arguments prints out a list of options.

Interactive usage

You can start an interactive file4life shell with

file4life -i

Within the file4life shell, tab completion shows most possible commands.

Contexts

At any given time, you can be in one of two contexts:

  • The local filesystem
  • A storage

The prompt shows the current context and the current directory within that context.

Some commands only work in some contexts.

You can see the list of storages with:

show storages

You can change context to a storage with:

cs <storage_id>

You can change to the local filesystem context with:

cs

You can move to the previous context with:

cs -

Scan a directory

To take note of files in a directory:

scan /some/directory

To also assign a priority to the directory:

scan --priority <priority> /some/directory

Use tab completion to see the list of available priorities.

Backup

To backup 10M of files to some directory:

backup -s 10M /some/backup/directory

To backup files contained in a specific storage:

cs <storage_id>
backup <path within storage> /some/backup/directory

Restore

To restore the contents of a storage:

cs <storage_id>
restore --notrack / /some/destination

or:

cs <storage_id>
restore --track / /some/destination

The --track and --notrack options determine whether file4life will keep track of the copies.

How To

Check consistency of backup directory

A backup operation can go wrong (full disk, power failure, disk disconnect etc.).

To check the health of a backup directory, run:

file4life --check-backup <backup_dir>

or to also recompute and check SHA1 checksums:

file4life --check-backup --rescan <backup_dir>

Internals

file4life uses a single file to keep track of the metadata.

The file's location is ~/.f4l/db.f4l.

During normal operations, new data is only appended to this file.

The metadata file consists of a sequence of ops (elementary instructions). The sequence of ops determines a sequence of facts (ex: a certain file was seen in a given position at a given time).

A file is identified by its SHA1 checksum and its length.

Dumping the contents of the metadata file

You can print out a dump of the ops with:

file4life -d

You can print out a dump of the facts with:

file4life -f