This OMV plugin uses BorgBackup, which was created by a third party. See the project web page → BorgBackup for more detailed information and support.
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.”
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. |
In OMV7's GUI:
Under SYSTEM > PLUGINS, find and highlight openmediavault-borgbackup 7.X, and click the INSTALL button.
In this tab we can both create and manage Borg REPOSITORIES and mount or dismount ARCHIVES for inspection or restoration of backups.
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:
+
CREATE button on the right to create a new shared folder.Link to official documentation → borg create
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. |
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. |
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
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
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:
borg check path_to_repo
It will check the consistency of REPOSITORIES and ARCHIVES.borg check --repository-only path_to_repo
It will check the consistency of REPOSITORIES only.borg check --archives-only path_to_repo
It will check the consistency of ARCHIVES only.borg check --verify-data path_to_repo
The same verification will be done as with the ALL option, it will verify the consistency of REPOSITORIES and ARCHIVES. But it is also applied with the --verify-data
parameter which causes a verification of the integrity of the cryptographic file data to be carried out at the same time.
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
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
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
Allows you to list existing ARCHIVES in a REPOSITORY. Select a REPOSITORY and press the LIST button:
Link to official documentation → borg list
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
Allows you to view detailed information about a REPOSITORY. Select a REPOSITORY and press the INFO button:
Link to official documentation → borg info
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
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
Allows you to unmount a previously mounted REPOSITORY. Select the mounted REPOSITORY and press the UMOUNT button.
Link to official documentation → borg umount
Shows a link to the official Borgbackup documentation and another link to this document on the omv-extras wiki.
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.
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
Allows you to edit a ARCHIVE. Select a ARCHIVE in the form and press the EDIT button:
Allows you to delete a ARCHIVE. Select a ARCHIVE in the form and press the DELETE button:
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
Allows you to manually run a backup from the existing schedule to a ARCHIVE. Select a ARCHIVE and press the RUN button:
Shows a link to the official Borgbackup documentation and another link to this document on the omv-extras wiki.
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.
Allows you to add a Borg environment variable. Press the CREATE button, a dialog box will open with the following fields:
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.
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.
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:
/srv/dev-disk-by-uuid-eb24d436-abba-4190-a343-4741b86fd2a7/data/documents/mary
/srv/dev-disk-by-uuid-eb24d436-abba-4190-a343-4741b86fd2a7/data/documents/peter
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:
borg_local_repo
borg_local_repo
. To do this we can press the +CREATE button to the right of this field. We must choose the hard drive dedicated to our server backups for this shared folder.borg_local_repo
that we just created.z6n7WdqxFhtKSRoi29zdgHs9eSUycdvKbrqUEYuV
(we write a strong password without spaces or special characters)
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)
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:
mary
borg_local_repo
lz4
(to compress the backup content)9
(highest compression value)/srv/dev-disk-by-uuid-eb24d436-abba-4190-a343-4741b86fd2a7/data/documents/mary
8
(the value 8, non-zero, determines that backups are made every hour since it is the first non-zero value and the backups of the last 8 hours will also be kept)7
(the value 7 determines that the last 7 daily backups will be retained)4
(the value 4 determines that the last 4 weekly backups will be retained)12
(the value 12 determines that the last 12 monthly backups will be retained)0
0
(unlimited rate since this is a local REPOSITORY)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:
/srv/dev-disk-by-uuid-eb24d436-abba-4190-a343-4741b86fd2a7/data/documents/peter
and we also change the programming:
0
(value 0 will prevent copies from being made every hour)7
(the value 7, non-zero, determines that backups are made every day since it is the first non-zero value and the backups of the last 7 days will also be kept)4
(the value 4 determines that the last 4 weekly backups will be retained)12
(the value 12 determines that the last 12 monthly backups will be retained)0
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.
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:
–> borg serve
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