borgmatic

Tarballs

๐Ÿ”

If you backup tarballs as part of your source directories, Borg can't effectively deduplicate their contents because of the way that a tarball's files are packed together (and often compressed). This isn't a big deal for small tarballs, but it can really hurt for large ones like virtual machine exports.

New in version 2.1.11 Beta feature borgmatic supports configuring tarballs as data sources for backups, unpacking their contained files directly into a Borg archive so that deduplication works properly.

To take advantage of this feature, use the tarballs: hook. For example:

tarballs:
    - name: virtual-machine
      path: /var/lib/vz/dump/vzdump-vm.tar

And to restore such a tarball to its original path:

borgmatic restore --archive latest --data-source virtual-machine

During backup, borgmatic streams each tarball to Borg, unpacking its files directly into the created Borg archive. Under the hood, this doesn't use Borg's native import-tar, because that's limited to a single tarball per archiveโ€”and no additional source directories.

Upon restore, borgmatic exports the tarball from the archive, rewriting it on the fly to inject its original contained file permissions, ownership, symlinks, etc. The resulting tarball ends up at its original path (or restore_path).

Both create and restore operate without using any temporary files for tarball data.

Limitations

Full configuration

Here's an example configuration with all of the available options for this feature in the most recent version of borgmatic. If you're using an older version, some of these options may not work, and you should instead generate a sample configuration file specific to your borgmatic version.

# List of one or more tarballs to include in backups. borgmatic adds
# such a tarball to your source directories at runtime and streams it
# directly to Borg as the individual files it containsโ€”thereby
# allowing Borg to effectively deduplicate your file data across
# archives. In your configured source directories, you can omit or
# exclude any tarballs that you specify here.
tarballs:
    # This is used to tag the tarball with a name. It is not
    # the path to the tarball itself. The name "all" has no
    # special meaning for tarballs.
    - name: source_code

      # Path to the tarball file to backup. If relative, it is
      # relative to the current working directory.
      path: /var/lib/vz/dump/vzdump-vm.tar

      # Label to identify the tarball in the backup.
      label: my_backup_label

      # Path to the tarball file to restore to. Defaults to the
      # "path" option.
      restore_path: /var/lib/vz/dump/vzdump-vm.tar

Improve this documentation

Have an idea on how to make this documentation even better? Use our issue tracker to send your feedback!