Backups

tori will create backup copies of files before overwriting them.

This includes tori’s own configuration directory, meaning that when you overwrite your own configuration files through tori’s dialogs or non-interactive options, it will also backup your configuration files before doing so.

There are two types of backups: canonical and ephemeral. Each lives inside a separate directory in the backup directory, which defaults to ~/.local/state/tori/backup.

Both directories, as well as the backup directory, may be deleted at will. They will be automatically recreated whenever an overwrite operation takes place.

Canonical backups

Canonical backups are created the first time tori is told to modify a given file.

These are meant to represent the state of the file system prior to tori’s intervention. If tori is running on a recently-installed system, the canonical backups should mirror the original state of the system as of its installation.

If there is already a canonical backup, it instead proceeds to the creation of an ephemeral one.

Ephemeral backups

Ephemeral backups are timestamped backups created every time tori has to modify a file. This is mainly meant as a safety net against undesired consequences when using non-interactive options.

If an ephemeral backup is being requested when there is already a matching timestamp, meaning they were requested within the same second, the older one will be overwritten.

Directory structure

tori creates a backup directory in ~/.local/state/tori/backup that contains two other directories:

  • canonical
  • ephemeral

Both of them will mirror the directory structure from the root of the file system, as shown in the example below.

~/.local/state/tori
└── backup
    ├── canonical
    │   ├── etc
    │   │   ├── pf.conf
    │   │   └── rc.conf
    │   └── home
    │       └── alice
    │           └── .shrc
    └── ephemeral
        ├── etc
        │   ├── pf.conf_2024-09-03T08-54-51
        │   └── pf.conf_2024-09-03T09-02-05
        └── home
            └── alice
                └── .shrc_2024-09-03T08-46-54

In this case, the rc.conf file was overwritten once, creating a canonical backup corresponding to the first time tori touched it. pf.conf, on the other hand, was overwritten three times and .shrc twice, which is why there is a canonical copy for the first change and other timestamped ephemeral copies for subsequent ones.