← 返回命令列表

Linux command

restic 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Initialize a repository

restic -r [/path/to/repo] init

Backup a directory

restic -r [/path/to/repo] backup [/path/to/data]

List snapshots

restic -r [/path/to/repo] snapshots

Restore from latest snapshot

restic -r [/path/to/repo] restore latest --target [/path/to/restore]

Restore specific snapshot

restic -r [/path/to/repo] restore [snapshot_id] --target [/path/to/restore]

Check repository integrity

restic -r [/path/to/repo] check

Remove old snapshots

restic -r [/path/to/repo] forget --keep-daily [7] --prune

Backup to S3

restic -r s3:s3.amazonaws.com/[bucket_name] backup [/path/to/data]

Mount snapshots

restic -r [/path/to/repo] mount [/mnt/restic]

说明

restic is a fast, secure, and efficient backup program. It creates encrypted, deduplicated snapshots of your data to local or remote repositories including local disk, SFTP, S3, Azure, Google Cloud Storage, and more. Each backup creates a snapshot containing the state of the files at that point in time. Restic uses content-defined chunking for deduplication, meaning identical data is only stored once across all snapshots. All data is encrypted with AES-256. Restore operations can target the entire snapshot or specific files. The mount command allows browsing snapshots as a FUSE filesystem.

参数

-r _repo_, --repo _repo_
Repository location.
-p _file_, --password-file _file_
File containing repository password.
--verbose
Verbose output.
init
Initialize a new repository.
backup
Create a new snapshot.
restore
Extract files from a snapshot.
snapshots
List all snapshots.
forget
Remove snapshots (needs --prune to free space).
prune
Remove unreferenced data.
check
Verify repository integrity.
mount
Mount repository as FUSE filesystem.
--exclude _pattern_
Exclude files matching pattern.
--keep-last _n_
Keep last n snapshots.
--keep-daily _n_
Keep n daily snapshots.

FAQ

What is the restic command used for?

restic is a fast, secure, and efficient backup program. It creates encrypted, deduplicated snapshots of your data to local or remote repositories including local disk, SFTP, S3, Azure, Google Cloud Storage, and more. Each backup creates a snapshot containing the state of the files at that point in time. Restic uses content-defined chunking for deduplication, meaning identical data is only stored once across all snapshots. All data is encrypted with AES-256. Restore operations can target the entire snapshot or specific files. The mount command allows browsing snapshots as a FUSE filesystem.

How do I run a basic restic example?

Run `restic -r [/path/to/repo] init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -r _repo_, --repo _repo_ do in restic?

Repository location.