Skip to main content

Introduction

KVM domains are a great way to setup and structure your home IT services, one service per KVM domain. For example, you may want to host your own collaboration and file sharing platform or RSS feed aggregator server. If the number of home services keeps increasing, you may also want to manage lower level services, such as DNS, authentication and monitoring.

In this situation, it is important to backup your domains with a sensible frequency (for example, weekly).

backvm is a command line utility to copy KVM domains to a remote location for backup purposes.

With a KVM domain name (or a list of domain names) in the local KVM hypervisor and a target server and location as input parameters, backvm creates a copy of all the virtual disks that are part of the domain and the domain XML definition at the chosen target location. With these files, you can restore your KVM domains in a new host, if a failure occurs in the live one.

Below, you can see a basic call to the utility that would backup domains dom1, dom2 and dom3 to the server myserver:

$ backvm --dom-names dom1,dom2,dom3 --dest-server-conf backup_dest_conf.json
$ cat backup_dest_conf.json
{
	"_comment" : "Backup server configuration",
	"dest_server" :
		{
			"dest_hostname": "myserver",
			"dest_username": "myusername",
			"dest_folder": "/tmp/"
		}
}

Features

  • The backup can be applied both on active (using snapshots) and inactive domains.
  • The backup process report can be sent by email.
  • The utility supports dry-runs to avoid long waiting times during setup and test.
  • The backup log location can be customized.

Limitations

  • The utility supports only SSH key-based authentication to the target server.
  • The utility must run in the same host of the KVM hypervisor.

Installation

The utility is built on libvirt-python that needs the header files and static libraries to develop applications with libvirt. These files are typically contained in a package. In Ubuntu 20.04, this is called libvirt-dev.

Once libvirt-dev (or equivalent) is available on the system, you can install with:

pip install backvm

It is recommended to install in a virtual environment.

Usage

Usage: backvm [OPTIONS]

  This program performs the backup of one or several KVM domains

Options:
  --email-conf TEXT            The path of a json file that contains the email
                               configuration. If specified, it must contain a
                               root element called "email". This element must
                               then contain the following values:

                                  - smtp_port
                                  - smtp_server
                                  - sender_email
                                  - from_email
                                  - sender_password
                                  - receiver_email
  --dest-server-conf TEXT      The path of a json file that contains the
                               server configuration. This is a required
                               parameter. The json file must contain a root
                               element called "dest_server". This element must
                               then contain the following values:

                                   - dest_hostname
                                   - dest_username
                                   - dest_folder  [required]
  --backend-copy-utility TEXT  The backend copy utility to do the remote copy.
                               Possible values are 'scp' and 'rsync'
                               [default: rsync]
  --dom-names TEXT             Comma-separated list of domain names
                               [required]
  --do-backup TEXT             Whether the backup operation is actually done.
                               Useful when you are testing and you want to
                               avoid long waiting times. Possible values
                               'True', 'False'.
  --do-archive TEXT            This option will group all the files related to
                               a domain in a single tar archive domname.tar.
                               Possible values 'True', 'False'.
  --temp-folder TEXT           Specify the folder where the process will write
                               its temporary files. In case you specify --do-
                               archive = True, take into account that the
                               filesystem of this folder must have a size at
                               least equal to the sum of the sizes of the
                               disks of the larger domain you are backing up.
                               There are no checks.
                               [required]
  --logfile TEXT               The location of the log file, by default
                               /tmp/kvm_domains_backup.log  [default:
                               /tmp/kvm_domains_backup.log]
  --help                       Show this message and exit.


Metadata

Release files for backvm 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for backvm 0.4.0
File Interpreter ABI Platform
backvm-0.4.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / backvm-0.4.0-py2.py3-none-any.whl

Download URL backvm-0.4.0-py2.py3-none-any.whl
Size 10.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1c084a29c95b03ceb9d559be6f0fa150b2b10a049154704c4a384c5c81b07ffb
BLAKE2b-256 checksum
How to use checksums
f6de428a9c22b427002d235058bca07b0ff911f845d0414d10efb3949013e71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for backvm 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page