LinuxCommandLibrary

kopia

Backup and restore files and directories

TLDR

Create a repository in the local filesystem

$ kopia repository create filesystem --path [path/to/local_repository]
copy

Create a repository on Amazon S3
$ kopia repository create s3 --bucket [bucket_name] --access-key [AWS_access_key_id] --secret-access-key [AWS_secret_access_key]
copy

Connect to a repository
$ kopia repository connect [repository_type] --path [path/to/repository]
copy

Create a snapshot of a directory
$ kopia snapshot create [path/to/directory]
copy

List snapshots
$ kopia snapshot list
copy

Restore a snapshot to a specific directory
$ kopia snapshot restore [snapshot_id] [path/to/target_directory]
copy

Create a new policy
$ kopia policy set --global --keep-latest [number_of_snapshots_to_keep] --compression [compression_algorithm]
copy

Ignore a specific file or folder from backups
$ kopia policy set --global --add-ignore [path/to/file_or_folder]
copy

SYNOPSIS

kopia [GLOBAL_OPTIONS] <command> [COMMAND_OPTIONS] [ARGS]

PARAMETERS

--config=<path>
    Specifies the path to the Kopia configuration file. Defaults to ~/.config/kopia/repository.config.

--log-dir=<path>
    Sets the directory where log files will be written. Useful for debugging and monitoring.

--log-level=<level>
    Controls the verbosity of logging. Possible levels include debug, info, warning, error, and fatal.

--cpu-profile-file=<path>
    Writes CPU profile data to the specified file for performance analysis.

--mem-profile-file=<path>
    Writes memory profile data to the specified file for memory usage analysis.

--trace-dir=<path>
    Directory for writing execution traces, aiding in complex issue diagnosis.

--version
    Displays the Kopia client version information and exits.

DESCRIPTION

Kopia is an open-source, high-performance, and secure backup and restore tool for Linux, macOS, and Windows. It focuses on efficiency, security, and broad compatibility.

Key features include client-side encryption (AES256-GCM), deduplication, compression, and snapshotting, ensuring minimal storage usage and fast operations. Kopia supports a wide range of storage backends, including cloud providers like AWS S3, Azure Blob Storage, Google Cloud Storage, and Backblaze B2, as well as SFTP, WebDAV, and local disk.

It provides both a powerful command-line interface (CLI) and an optional graphical user interface (GUI) for ease of use. Users can create policy-based backups, browse snapshots at any point in time, and restore individual files or entire directories. Kopia is designed for reliability and data integrity, offering robust checksumming and verification mechanisms.

CAVEATS


Requires an active Kopia repository connection for all operations.
Performance can be heavily influenced by network bandwidth and latency to the chosen storage backend.
Loss of repository credentials (password/key) will render all backed-up data irrecoverable due to strong client-side encryption.
Initial backup of large datasets can consume significant time and resources.

SUBCOMMANDS

Kopia operates through a rich set of subcommands, each responsible for a specific task. To see a list of all available subcommands, run kopia help. Some of the most frequently used subcommands include:
• repository: Manages connections to storage repositories (connect, disconnect, status).
• snapshot: Creates, lists, and manages data snapshots.
• restore: Restores data from existing snapshots.
• policy: Configures backup policies (retention, ignored files, compression, encryption).
• server: Runs the Kopia API server or GUI.
• mount: Mounts a snapshot as a read-only filesystem.
• content: Low-level commands for managing data content.

KOPIA REPOSITORY

A Kopia repository is the central storage location for all your backup data. Before performing any backup or restore operations, you must connect Kopia to a repository using the kopia repository connect command. This command configures where your data will be stored (e.g., local disk, S3, Google Cloud Storage) and sets up the encryption key for your backups.

DATA INTEGRITY AND SECURITY

Kopia places a strong emphasis on data integrity and security. All data is client-side encrypted using AES256-GCM before being sent to the storage backend, meaning your data is encrypted before it leaves your machine. Additionally, Kopia uses strong cryptographic checksums to verify data integrity throughout the backup and restore process, protecting against data corruption.

HISTORY

Kopia was first released in 2019, developed by Jarek Duda, with a clear focus on addressing modern backup needs: security through client-side encryption, efficiency via deduplication and compression, and broad compatibility with cloud storage providers. It quickly gained traction in the open-source community as a powerful, user-friendly alternative to more traditional backup solutions. Its development has been consistently active, with ongoing enhancements and support for new features and storage backends, solidifying its position as a leading-edge backup tool.

SEE ALSO

rsync(1), tar(1), duplicity(1), borg(1), restic(1)

Copied to clipboard