Linux command
rusnapshot 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Create a read-only snapshot
sudo rusnapshot -c [path/to/config.toml] --create
Create a read-write snapshot
sudo rusnapshot -c [path/to/config.toml] --create -w
List tracked snapshots
sudo rusnapshot -c [path/to/config.toml] -l
Delete a snapshot by ID
sudo rusnapshot -c [path/to/config.toml] --del --id [snapshot_id]
Clean old snapshots, keeping only the last 3
sudo rusnapshot -c [path/to/config.toml] --clean -k 3 --kind [hourly]
Restore a snapshot by ID
sudo rusnapshot -c [path/to/config.toml] -r --id [snapshot_id]
说明
rusnapshot is a simple and handy BTRFS snapshotting tool written in Rust. It provides snapshot creation, management, restoration, and automatic cleanup for BTRFS filesystems, using SQLite to track snapshots. Configuration is done via TOML files specifying snapshot source and destination paths, prefixes, and kinds. Snapshots can also be fully specified via command-line flags using --from and --to.
参数
- -c, --config _file_
- Path to TOML configuration file.
- --create
- Create a read-only snapshot.
- -w, --rw
- Create read-write snapshots instead of read-only.
- -l, --list
- List snapshots tracked in the database.
- --del
- Delete a snapshot. Requires --id.
- -r, --restore
- Restore a specific snapshot. Requires --id.
- --id _id_
- Snapshot ID or name to work with.
- --clean
- Enable snapshot cleaning, keeping only the last X snapshots specified with -k.
- -k, --keep _count_
- Number of snapshots to keep (default 3).
- --kind _type_
- Differentiator between snapshots with the same prefix (e.g., hourly, daily).
- -p, --prefix _name_
- Prefix for the snapshot name (default "rusnapshot").
- -d, --dfile _path_
- Path to the SQLite database file.
- --from _dir_
- Source directory for snapshot creation.
- --to _dir_
- Destination directory for snapshots.
- --timeout _ms_
- SQLite busy timeout in milliseconds (default 10000).
FAQ
What is the rusnapshot command used for?
rusnapshot is a simple and handy BTRFS snapshotting tool written in Rust. It provides snapshot creation, management, restoration, and automatic cleanup for BTRFS filesystems, using SQLite to track snapshots. Configuration is done via TOML files specifying snapshot source and destination paths, prefixes, and kinds. Snapshots can also be fully specified via command-line flags using --from and --to.
How do I run a basic rusnapshot example?
Run `sudo rusnapshot -c [path/to/config.toml] --create` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --config _file_ do in rusnapshot?
Path to TOML configuration file.