LinuxCommandLibrary

resticprofile

Manage restic backup profiles

TLDR

List all saved snapshots

$ resticprofile
copy

Run a backup on the default profile
$ resticprofile backup
copy

Run a backup with a specific profile (default profile is "default")
$ resticprofile [[-n|--name]] "[profile_name]" backup
copy

Run in dry-run mode and show the underlying restic commands
$ resticprofile --dry-run backup
copy

Display the names of all profiles from the configuration file
$ resticprofile profiles
copy

Generate shell completions
$ resticprofile generate [--bash-completion|--zsh-completion]
copy

Show all details of a profile
$ resticprofile show [[-n|--name]] "[profile_name]"
copy

SYNOPSIS

restic profile [profile_options] command [command_options] [global_options]

PARAMETERS

command
    The specific restic subcommand to run and profile (e.g., backup, restore, check). All arguments following this command are passed directly to it.

--cpuprofile file
    Writes CPU profile data to the specified file. This helps identify functions consuming the most CPU time.

--memprofile file
    Writes memory allocation profile data to the specified file. Useful for detecting memory leaks or excessive memory usage.

--blockprofile file
    Writes block I/O profile data to the specified file. Helps analyze disk and network read/write patterns.

--mutexprofile file
    Writes mutex contention profile data to the specified file. Useful for identifying bottlenecks due to concurrent access to shared resources.

--profile-duration duration
    Specifies the duration for which profiling data should be collected (e.g., 30s, 5m, 1h). After this duration, profiling stops, but the command continues.

--profile-path path
    Specifies the directory where profile data files should be written. Defaults to the current working directory.

DESCRIPTION

The restic profile command is a powerful diagnostic tool within the restic backup program. Its primary function is to run a specified restic subcommand (such as backup, restore, or check) while collecting detailed performance data. This data, often in the pprof format, can then be analyzed using tools like `go tool pprof` to identify bottlenecks in CPU usage, memory allocation, I/O operations, or concurrency. It's invaluable for diagnosing and optimizing performance issues, especially in large repositories or during long-running operations. Users can specify various types of profiles (CPU, memory, block, mutex) and define the duration for which profiling data should be collected. It's important to note that this command is typically invoked as `restic profile` rather than a standalone `resticprofile` binary, which does not exist in standard restic installations.

CAVEATS

The command you are likely looking for is `restic profile`, which is a subcommand of `restic`, not a standalone `resticprofile` binary. Profiling adds some overhead to the execution of the profiled command, so it's not recommended for regular use. Analyzing the generated profile files requires familiarity with Go's `pprof` tool (`go tool pprof`), which is part of the Go development kit. Without this tool, the raw profile data is not easily interpretable.

USAGE EXAMPLE

To profile a backup operation for 60 seconds and generate a CPU profile:

restic profile --cpuprofile cpu.pprof --profile-duration 60s backup /path/to/data --tag my-backup

This will run the `backup` command, collecting CPU data for the first 60 seconds. The `cpu.pprof` file can then be analyzed.

ANALYZING PROFILE DATA

Once a profile file (e.g., `cpu.pprof`) is generated, it can be analyzed using `go tool pprof`. For example, to view the CPU profile in an interactive web interface:

go tool pprof -http=:8080 cpu.pprof

This command starts a web server on port 8080, providing a graphical representation of the profile data, including call graphs and flame graphs.

HISTORY

`restic` is an open-source, modern backup program written in Go, first released in 2014. Given its origin in a compiled language like Go, performance profiling capabilities are a natural extension of its development toolkit. The `profile` subcommand was integrated to provide developers and advanced users with the ability to diagnose and optimize the performance of backup, restore, and other repository operations, ensuring the tool remains efficient for large-scale data management.

SEE ALSO

restic(1), go tool pprof(1)

Copied to clipboard