~~ BORG ~~
** BACKUPS ARE IMPORTANT. HERE COMES BORG **
I think everyone knows “No backup - no pity”.
If you don’t want to hear that anymore, you should make backups.
There is an exorbitant amount of GUI backup tools for Linux. The command-line is more useful and for the command-line there is BORG (you should use BORG just because of the name).
What is BORG?
BORG is a “deduplicate backup tool”. BORG checks the data to be backed up for redundancy and only backs up the data that has changed.
So it does exactly what you want to create space-saving backups.
BORG itself also encrypts the backups created and can also compress them if necessary.
The compression methods are the following:
- lz4 (very fast “No backup - no pity” I think everyone knows.
If you don’t want to hear that anymore, you should make backups.
There is an exorbitant amount of GUI backup tools for Linux. But you don’t want to have a GUI under certain circumstances.
The command-line is more useful and for the command-line there is BORG (you should use BORG just because of the name).
What is BORG?
BORG is a “deduplicate backup tool”. BORG checks the data to be backed up for redundancy and only backs up the data that has changed.
So exactly what you want to have to create space-saving backups.
BORG itself also encrypts the backups created and can also compress them if necessary. , low compression)
- zstd (from fast and without compression to high compression and slow)
- zlib (medium speed and compression)
- lzma (slow but high compression)
BORG can also perform off-site backups. This means that as soon as an SSH connection exists, it can be used to write backups there with BORG.
The backups created can even be mounted as a separate file system.
So the perfect backup system.
Installation (NixOS)
The BORG packages are available in the NixOS packages and can either be written to configarations.nix and then rebuilt with the following command:
1nixos-rebuild switch
Installed and ready to use.
Usage
BORG create repositories for Backups.
1borg init -e repokey /path/to/repo
Instead of “repo”, the name of the repository is of course assigned here.
The password is assigned directly when the backup is created, which you should of course remember, otherwise the backup would no longer be usable.
To create a backup and write it to the repository, use the following command:
1borg create /path/to/repo::DATE ~/Documents ~/Mail
Here, the name of the individual backup is entered in “::DATE” (the date is of course recommended in some way) and then all folders that are to be backed up are listed one after the other. In this case “Documents” and “Mail”.
This creates the first local backup.
Off-site backups
However, backups should not be saved on the machine from which the backup originates. The reasons should be clear.
On the one hand, there is the option of saving the backups to external storage media, on the other hand via SSH to servers.
The latter is done as follows. First, of course, the remote repo must be created:
1borg init user@hostname:/path/to/repo
You have now created your target repository.
To write out backups remotely, use:
1borg create user@hostname:/path/to/repo::Monday ~/src ~/Documents
DONE.
Restore Backup
Now and then there is a need to restore a backup.
With BORG there are two options “mount” and “extract”.
“Mount”, as the name suggests, mounts the backup as a file system to restore individual files.
“Extract” extracts the entire backup, e.g. to restore a complete system.
For local backups:
1borg list /mnt/backup/borg_repo
2borg mount /mnt/backup/borg_repo::myserver-system-2021-06-09 /mnt/borg
3borg mount /mnt/backup/borg_repo /mnt/borg
1mkdir borg_restore
2cd borg_restore
3borg list /mnt/backup/borg_repo
4borg list /mnt/backup/borg_repo::myserver-system-2021-06-09
5borg extract /mnt/backup/borg_repo::myserver-system-2021-06-09 path/to/extract
6borg extract /mnt/backup/borg_repo::myserver-system-2021-06-09
For Remote (SSH) Backups:
1borg mount ssh://borg@backup.example.org:2222/path/to/repo /mnt/borg
1borg extract ssh://borg@backup.example.org:2222/path/to/repo
BORG naturally comes with many more customization options. These can be found in the documentation LINK.
The above commands should be sufficient for a simple backup.
Have fun and backup your data!
[~] BACK