Table of contents of the article:
A disaster recovery plan is an essential component in any company's portfolio of management tools. Its fundamental role is to ensure the continuity of business and operations, safeguarding organizations from unforeseen and potentially catastrophic events that could interrupt or damage their operations. These events can range from power outages, fires, and floods, to cyberattacks and other disasters, both natural and man-made.
The importance of a disaster recovery plan is rooted in the ability to prevent the loss of critical data, the failure of operations and the consequent interruption of service, all elements that can have a significant impact on the reputation and financial stability of the company. In this context, the use of reliable tools for data management and security becomes a priority.
Borg is an ideal option in this panorama, representing an Open Source, completely free and highly performing solution for data backup. This tool allows you to create backup copies of company data efficiently, offering a simple but powerful and reliable backup mechanism.
One of the distinguishing features of Borg is its high data compression and deduplication function. These features allow you to make the best use of available storage space, significantly reducing storage costs. In an age where efficient data management is increasingly critical, Borg's ability to optimize storage space is a huge competitive advantage.
Furthermore, Borg stands out for its ease of integration with other systems and tools. This flexibility makes it a great choice for businesses of any size, allowing for seamless cohesion with existing technology infrastructures.
What is Borg
BorgBackup (abbreviation: Borg) is a backup program for deduplication. Optionally, it supports compression and authenticated encryption.
Borg's primary goal is to provide an efficient and secure way to back up your data. The data deduplication technique used makes Borg suitable for daily backups as only changes are archived. The authenticated encryption technique makes it suitable for backups to not fully trusted destinations.
visit our installation manual or, if you've already downloaded Borg, docs/installation.rst
to start with Borg. One is also available offline documentation , in multiple formats.
On Linux systems, you have many options for creating and maintaining backups of your files. Today, let's talk about another tool you might find useful: BorgBackup.
BorgBackup, or “Borg” for short, is a backup program that supports deduplication, compression and encryption. Borg provides an efficient and safe way to back up your data.
Main features of Borg Backup
- Space-efficient storage
- Borg Backup comes with an effective archiving feature that makes the data backup process extremely space-efficient. One of the main factors contributing to this efficiency is deduplication based on content-defined chunking, a technique that helps significantly reduce the amount of data stored.
In practical terms, this means that each file, instead of being archived in its entirety, is divided into a series of blocks of variable length. Only those blocks that have never been registered in the repository before are added, thus helping to minimize the use of storage space.
The deduplication process works by identifying each block with a unique value, known as the id_hash. If a block with the same id_hash has already been registered, Borg doesn't add it back to the repository. The id_hash is generated using a cryptographically strong hash or MAC function, such as (hmac-)sha256, thus ensuring the uniqueness and identifiability of each block.
A particularly distinctive feature of Borg deduplication is its universal reach within a single repository. Borg treats all blocks in the same repository for deduplication, regardless of their origin – whether they're from different machines, previous backups, the same backup, or even the same single file.
This deduplication technology is independent of factors such as the persistence of filenames or directories, or the consistency of complete files or timestamps. As a result, you can move or rename your files without affecting deduplication, and if a large file undergoes only minor changes, Borg will only need to archive the new blocks, providing a huge advantage for virtual machines or raw disks.
Furthermore, Borg is not limited by the absolute position of a block of data within a file. This means that if data is moved within a file, Borg's deduplication algorithm will still be able to identify it. This capability ensures superior deduplication efficiency, no matter how dynamic your data is.
Compared to other deduplication approaches, this method does NOT depend on:
- file / directory names remain the same: so you can move your stuff without breaking deduplication, even between machines sharing a repository.
- Complete files or timestamps remain the same - if a large file changes slightly, only a few new blocks need to be archived - this is great for virtual machines or raw disks.
- The absolute position of a block of data within a file - things may be moved and will still be found by the deduplication algorithm.
- Racing
-
- the performance-critical code (chunking, compression, encryption) is implemented in C / Cython
- local caching of index data files / blocks
- fast detection of unmodified files
- Data encryption
- All data can be protected using AES 256-bit encryption, data integrity and authenticity are verified using HMAC-SHA256. The data is encrypted on the client side.
- Obfuscation
- Optionally, borg can actively obfuscate, for example, the file / block size to make fingerprinting attacks more difficult.
- Compression
-
All data can optionally be compressed:
- lz4 (super fast, low compression)
- zstd (wide range from high speed and low compression to high compression and low speed)
- zlib (average speed and compression)
- lzma (low speed, high compression)
- Offsite backup
- Borg can store data on any remote host accessible via SSH. If Borg is installed on the remote host, it is possible to achieve large performance gains compared to using a network filesystem (sshfs, nfs,…).
- Backups mountable as filesystems
- Backup archives can be mounted as user space filesystems for easy interactive review of backups and restores (for example using a regular file manager).
- Easy installation on multiple platforms
-
We offer single file binaries that don't require installation of anything - you can just run them on these platforms:
- Linux
- Mac OS X
- FreeBSD
- OpenBSD and NetBSD (no support for xattr / ACL or binaries yet)
- Cygwin (experimental, not yet binary)
- Windows 10 Linux subsystem (experimental)
- Free and open source software
-
- safety and functionality can be independently verified
- licensed under the BSD license (3 clauses), see License for full license
Why use Borg?
One crucial aspect that makes Borg an excellent choice for data backup is its deduplication feature. This unique feature allows Borg to identify and store only changes made to directories, rather than saving the entirety of every changed file or directory. As a result, Borg can significantly reduce the amount of data stored, making the backup process much faster than other backup solutions.
To explain further, imagine that you have two versions of a file or directory, with only a small portion of them having changed. Instead of making a complete copy of the file or directory, Borg identifies the changed part and saves only that. This significantly saves storage space and speeds up the backup process.
In addition to deduplication, Borg also offers an option to compress files and directories. This means that Borg can further reduce the data size before storing it. Again, this helps make backups with Borg extremely space-efficient, which is essential for a company's economic and strategic data management.
Finally, Borg goes beyond simple backup management, also offering robust security measures to protect your data. In particular, Borg supports client-side file encryption. This means that before your data is transferred for backup, Borg encrypts it, making it inaccessible without the proper encryption key. This feature is especially useful if you plan to back up to cloud storage or servers you don't fully trust. With Borg's client-side encryption, you can be confident that your data will be safe, regardless of potential vulnerabilities from your storage provider.
Install BorgBackup
BorgBackup is not installed on Linux systems by default. So, to start using Borg, you'll need to install it first. You can install Borg with just one command.
sudo apt-get install borgbackup
Create a backup archive
Now that you have Borg installed, let's start backing up your files! Before the backups can be archived, you will need to start a Borg backup repository. To create an encrypted backup repository, you need to use the --encryption
flag.
borg init --encryption = repokey / path / to / backup_repo
Borg will ask you to enter the passphrase that should be used to encrypt the repository.
Create a backup
And now it's time to create our first backup! You can create a backup of the source_dir in a backup archive called "archive1" in backup_repo:
borg create / path / to / backup_repo :: archive1 / path / to / source_directory
You can also use the --compression
flag to create a compressed backup archive.
borg create --compression COMPRESSION_ALGORITHM.COMPRESSION_LEVEL / path / to / backup_repo :: archive1 / path / to / source_directory
Borg offers you four COMPRESSION_ALGORITHM to choose from lz4
, zstd
, zlib
e lzma
. Compression is lz4
by default. COMPRESSION_LEVEL
may vary from 0
a 9
, 9
being the tallest. For example, to use zlib
with the highest compression level, you can do:
borg create --compression zlib, 9 / path / to / backup_repo :: archive1 / path / to / source_directory
Retrieve a backup
You will probably want to restore a backup at some point. Thankfully, recovering a backup with Borg is just as simple!
First, you can list all the backup archives in your backup repository.
borg list / path / to / backup_repo
Borg will list all backup archives stored in the repository:
archive1 Thu, 23-04-2020 01:20:30 archive2 Fri, 24-04-2020 01:20:30
You can also list the contents within an archive.
borg list / path / to / backup_repo :: archive1
To extract a backup and download its files to the current directory, you can use:
borg extract / path / to / backup_repo :: archive1
Before extracting a particular archive file, you may want to compare different archives to find the right version you want to use. You can compare archives without extracting them using:
borg diff / path / to / backup_repo :: archive1 archive2
You can also use Borg to operate on a remote backup directory. All the syntax would be the same, but you will need to specify the username and server in the backup repository path.
borg extract username @ server: / path / to / backup_repo :: archive1
Mount a backup repository
Finally, if you don't know which files you want to restore and need to examine the files, you can mount an archive or the entire backup directory. This will allow you to browse the archive and restore individual files.
To mount a remote directory, you must first create a writable local directory. Then, you can go ahead and mount the repository.
mkdir / tmp / mountborg mount username @ server: / path / to / backup_repo / tmp / mount
After you're done working on the backup repository, you can unmount it:
borg unmount / tmp / mount
Conclusion
In conclusion, Borg Backup represents an advanced and highly efficient solution for data backup. With its unique features, including content-defined chunking-based deduplication, data compression, and client-side encryption, Borg can provide fast, secure, and space-saving backup.
Throughout this post, we've explored many of the Borg's core features in depth, offering a detailed look at how it works and what it's worth. However, this does not exhaust all that Borg has to offer. With a host of other features and customizable options, Borg can be tailored to meet a wide variety of backup needs.
If you ever need assistance with Borg, there are many resources available to help you. You can get help directly from the terminal using the 'borg help' command, which will provide help on the available functions and commands. Alternatively, you can visit the Borg documentation page to get more detailed and in-depth information.
Ultimately, Borg is an effective, flexible and secure way to back up your data. Whether you're looking to protect your business' critical data or keep your personal files safe, Borg offers a solution worth considering.