Table of Contents


BorgBackup Plugin For OMV7

BorgBackup Plugin For OMV7

BorgBackup Plugin For OMV7



Summary


Third Party Software Note

Go to -> BorgBackup Site This OMV plugin uses BorgBackup, which was created by a third party. See the project web page → BorgBackup for more detailed information and support.


What is BorgBackup?

Quote:

“BorgBackup (short: Borg) is a deduplicating backup program. Optionally, it supports compression and authenticated encryption.

The main goal of Borg is to provide an efficient and secure way to backup data. The data deduplication technique used makes Borg suitable for daily backups since only changes are stored. The authenticated encryption technique makes it suitable for backups to not fully trusted targets.”


What is the basic operation of BorgBackup?

Backup

The basic standard operation of Borg consists of:

The result of the above will be a folder that Borg calls REPOSITORY in which there will be what Borg calls one or more ARCHIVES. Each ARCHIVE contains a backup inside. When a backup is made, Borg is responsible for automatically deduplicating it. That is, if in ARCHIVE_1 there are three files that are also in ARCHIVE_2 those three files will be replaced in ARCHIVE_2 by links to those existing files in ARCHIVE_1, in this way the information is not duplicated (this is a simple explanation, it actually works at the block level, a little more complicated but the concept is the same).

Borg does not have automation tools to run backups, it is the openmediavault-borgbackup plugin that does the automation. To do this, in the plugin's GUI we create a ARCHIVE to which we give a name like ARCHIVE_NAME, that is equivalent to defining what folders/files we want to backup in that ARCHIVE and at the same time a retention schedule. If we activate this programming, the plugin will be in charge of making automatic backups. Each backup will be stored in the REPOSITORY within an ARCHIVE whose name will be ARCHIVE_NAME_TIME, with TIME being a label with the creation date of that backup. At the same time, every time a backup is made, the plugin is responsible for deleting the oldest backups that we no longer want according to the scheduled retention schedule. For example, if the daily retention period is 7, a daily backup of the last 7 days will be saved and the previous ones will be deleted.

You can consult a detailed procedure for configuring a backup using the openmediavault-borgbackup plugin at the end of this document.

Restore

There are two ways to restore a backup.

  Beginners Info
The key phrase that you should never forget is:
"Your backup is absolutely useless if you don't know how to restore the data."
Test how the data restoration process works.


Index


Prerequisites


Installation

In OMV7's GUI:
Under SYSTEM > PLUGINS, find and highlight openmediavault-borgbackup 7.X, and click the INSTALL button.


Repos tab

In this tab we can both create and manage Borg REPOSITORIES and mount or dismount ARCHIVES for inspection or restoration of backups.

Under SERVICES > BORGBACKUP > REPOS

Repos tab


Create

Create Repo Allows you to create and initialize a Borg REPOSITORY or import an existing one. Pressing the button will open a dialog box with the following fields:

Link to official documentation → borg create


Change location

Allows you to change the location of a REPOSITORY already configured in the plugin.

  Warning
Before changing the location of a //REPOSITORY// you must move the contents of that folder to the new location.


Remove

Allows you to delete a REPOSITORY defined in the plugin. Select a REPOSITORY and press the REMOVE button.

  Note
Deleting the repository will not delete the folder or its contents in the file system.
If there are ARCHIVES configured in this REPOSITORY the FILES will be removed from the plugin configuration but the files in the server file system will not be removed.


Delete+files

Allows you to delete a REPOSITORY defined in the plugin while deleting the folder in the file system and all its contents. Select a REPOSITORY and press the REMOVE button.

  Note
When you delete an entire repository, the security information and local cache for it (if any) are also deleted.

Link to official documentation → borg delete


Change passphrase

Allows you to change the password for accessing the REPOSITORY. Select a REPOSITORY in the form and press the CHANGE PASSPHRASE button:

Link to official documentation → borg key change-passphrase


Check

Allows you to check the consistency of a REPOSITORY and its files.

  Info
The check command verifies the consistency of a repository and its archives. It consists of two major steps:
1. Checking the consistency of the repository itself. This includes checking the segment magic headers, and both the metadata and data of all objects in the segments. The read data is checked by size and CRC. Bit rot and other types of accidental damage can be detected this way. When checking a remote repository, please note that the checks run on the server and do not cause significant network traffic.
2. Checking consistency and correctness of the archive metadata and optionally archive data (requires --verify-data). This includes ensuring that the repository manifest exists, the archive metadata chunk is present, and that all chunks referencing files (items) in the archive exist. This requires reading archive and file metadata, but not data. To cryptographically verify the file (content) data integrity pass --verify-data, but keep in mind that this requires reading all data and is hence very time consuming. When checking archives of a remote repository, archive checks run on the client machine because they require decrypting data and therefore the encryption key.

If it is a remote REPOSITORY the checks will be executed on the remote server without causing massive traffic. The plugin offers several levels of checking:

  Warning
Do not confuse data integrity of an ARCHIVE in a REPOSITORY with data integrity of the backup source (your file system on the server where the data from which the backup is made is stored).
Borgbakup does not in any way guarantee the integrity or bitrot of the backup source data. Only integrity checks are performed on the data backed up in the REPOSITORY. If the data is corrupted at the source, it will end up irreparably corrupted in the backup.
If you need to ensure the integrity of files on your file system, you should use other means, such as a COW file system such as ZFS or BTRFS or a parity checking system such as SnapRaid. Borgbackup is not a substitute for a COW file system for user data.

Link to official documentation → borg check


Export

Allows you to create a tar-compressed file that contains all the files in the ARCHIVE. The export file will be created in the chosen shared folder with the same name as the file and with the extension .tar.gz. Select a REPOSITORY and press the EXPORT button:

Link to official documentation → borg export-tar


Extract

Allows you to extract all files from an ARCHIVE to a shared folder. Select a REPOSITORY and press the EXTRACT button:

Link to official documentation → borg extract


List

Allows you to list existing ARCHIVES in a REPOSITORY. Select a REPOSITORY and press the LIST button:

Link to official documentation → borg list


Compact

Allows you to compact a REPOSITORY. Select a REPOSITORY and press the COMPACT button:

  Note
Borg does not automatically compact segments in the //REPOSITORY// at commit time (at the end of each write command to the repository). This causes the repository to behave similar to if it were in add-only mode most of the time. Repository space is not immediately freed when deleting or deleting files.
The user can choose when to run the compaction, it should be done periodically, but not necessarily after each backup.

Link to official documentation → borg compact


Info

Allows you to view detailed information about a REPOSITORY. Select a REPOSITORY and press the INFO button:

Link to official documentation → borg info


Download repo keyfile

Allows you to download the encryption key of a REPOSITORY to your PC if the REPOSITORY is encrypted. Select an REPOSITORY and press the DOWNLOAD REPO KEYFILE button:

  Note
Accessing an encrypted repository requires the repository's encryption key in addition to the passphrase. By default, the plugin stores the encryption key in the /root folder. If you are forced to reinstall OMV and lose this key, you will not be able to recover the data from the repository.
Download this key and keep it in a safe place along with your passphrase, for example a password app like KeePassXC installed on your PC.

Link to official documentation → borg key export


Mount

Allows you to mount all the ARCHIVES of a REPOSITORY in a shared folder, a subfolder will be created for each ARCHIVE labeled with the date and time of its creation. You can navigate through the folder tree to inspect all existing versions of the files contained in the REPOSITORY and copy the files you need to restore elsewhere using a terminal or any file explorer such as WinSCP. Select a REPOSITORY and press the MOUNT button:

  Note
The plugin does not apply any permissions arguments to this command, so all files and folders will have their original permissions.

Link to official documentation → borg mount


Umount

Allows you to unmount a previously mounted REPOSITORY. Select the mounted REPOSITORY and press the UMOUNT button.

Link to official documentation → borg umount


Docs

Shows a link to the official Borgbackup documentation and another link to this document on the omv-extras wiki.


Archives tab

In this tab we can manage ARCHIVES to define the backups that we want to generate.

By generating a ARCHIVE in the plugin we define what the backup sources are and at the same time we define a schedule to execute the backups as well as the retention policy for the backup versions. In each execution of a backup the plugin will generate a new ARCHIVE and add a suffix to it with the date and time of its creation.

Under SERVICES > BORGBACKUP > REPOS

Archives tab


Create

Create Archive Allows you to create a ARCHIVE. This tab is a custom feature of the plugin that allows automatic backup scheduling, please read the Summary at the beginning of this document for more details. You must previously have created a REPOSITORY in the REPOS tab. Press the CREATE button:

The OMV_BORGBACKUP_STARTING_HOUR environment variable determines the start time for annual and monthly cron tasks and start time +1 for weekly and daily cron tasks. Defaults to 2.00 a.m. Change OMV_BORGBACKUP_STARTING_HOUR in /etc/default/openmediavault to the start time you want. Then run:

sudo omv-salt stage run prepare

sudo omv-salt deploy run borgbackup


Edit

Allows you to edit a ARCHIVE. Select a ARCHIVE in the form and press the EDIT button:


Delete

Allows you to delete a ARCHIVE. Select a ARCHIVE in the form and press the DELETE button:


Info

Allows you to list information about all backups executed with the selected ARCHIVE. Select a ARCHIVE and press the INFO button:

Link to official documentation → borg info


Run

Allows you to manually run a backup from the existing schedule to a ARCHIVE. Select a ARCHIVE and press the RUN button:


Docs

Shows a link to the official Borgbackup documentation and another link to this document on the omv-extras wiki.


Environment Variables tab

Borg uses some environment variables for automation, check the official documentation to find out what they are: Environment Variables

This tab allows you to customize those Borg environment variables.


Under SERVICES > BORGBACKUP > ENVIRONMENT VARIABLES

Archives tab


Create

Allows you to add a Borg environment variable. Press the CREATE button, a dialog box will open with the following fields:


Edit

Allows you to edit a Borg environment variable already created in the plugin. Select an environment variable in the form and press the EDIT button, a dialog box will open allowing you to edit the values ​​of the selected environment variable.


Delete

Allows you to delete a Borg environment variable already created in the plugin. Select an environment variable in the form and press the DELETE button, confirm the deletion and apply the changes to delete it.


Local backup configuration procedure

Below is a simple example with the necessary steps to configure a backup and store it on the same server. The requirements for this backup are:

In our server environment we have:


Create a local REPOSITORY

Create Repo The first step is to create the REPOSITORY where we are going to store the backups. In the SERVICES > BORGBACKUP > REPOS tab, press the CREATE button:

The REPOSITORY has already been created and initialized by the plugin. If we go to the shared folder borg_local_repo we will see inside the necessary configuration files that Borg has created. The REPOSITORY is ready to receive backups.

To access this REPOSITORY in the future we will need the access password that we just wrote but also the encryption key that Borg has generated since we have decided to encrypt the REPOSITORY. This encryption key is stored in the /root folder on the server. To ensure that we can access the REPOSITORY if something were to happen to our operating system drive we download the encryption key.

Our browser should have received a file with the encryption key from the REPOSITORY. We save this file along with the access key to the REPOSITORY in a safe place (for example a password application like KeepassXC)


Create a ARCHIVE

Create Archive peter The second step is to create a ARCHIVE. Since we have different timing needs for Mary's and Peter's folders we will need to create two separate ARCHIVES that will be stored in the same REPOSITORY. Each of them defines where the content we want to back up is, how often and how many versions we want to maintain.

We start with the ARCHIVE in the mary folder. In the SERVICES > BORGBACKUP > REPOS tab, press the CREATE button and establish the following configuration:

At this moment, a line will appear in the form with the name mary corresponding to the ARCHIVE that we just created. If we press the RUN button we can check its execution when making the first backup.

The next step would be to create another ARCHIVE for the peter folder. We repeat the steps but in this case we change the location of the folder:

and we also change the programming:

List Archives The rest of the values ​​will be the same as those we established in the mary ARCHIVE. We already have our backup working.

At any time we can mount the REPOSITORY to inspect the backed up files in all their versions. Simply go to the SERVICES > BORGBACKUP > REPOS tab, select the REPOSITORY and press the MOUNT button. Choose a shared folder to create the mount and save your changes. Now you can browse the mounted folder structure and copy any file or folder to another place if you need to restore something. You can do it from the CLI or through a file explorer like WinSCP. Then unmount the REPOSITORY.

To see the versions of the backups generated so far, select the REPOSITORY and press the LIST button.



Remote backup configuration procedure

Go to -> [How-To] Make backups with Borg using borgbackup plugin In the guides section of the Openmediavault forum there is an excellent guide to performing remote backups masterfully written by forum member auanasgheps, whom we thank for taking the time to write and maintain it. You can consult that guide if you need this type of configuration. –> [How-To] Make backups with Borg using borgbackup plugin

Borg requires SSH connections to access remote repositories. These links may be useful to you:

–> sshd(8) man page

–> Borg Hosting repositories

–> borg serve


Source Code

openmediavault-borgbackup


A Closing Note

We, who support the openmediavault project, hope you've found this guide to be useful and that you'll find your openmediavault server to be efficient, easy to use, and enjoyable.

If you found this plugin guide to be helpful, please consider a modest donation to support the hosting costs of this server.

OMV-Extras.org



Venmo: ryecoaaron