Add Backrest.md
Deploy / deploy (push) Successful in 43s

This commit is contained in:
2026-03-26 16:59:39 +08:00
parent d2ddba7ba2
commit 816336fe06
7 changed files with 128 additions and 9 deletions
+122
View File
@@ -0,0 +1,122 @@
# Backrest: 备份新选择
## 环境
- Ubuntu 24.04 LTS
- Docker & Docker Compose
## 安装
``` bash
mkdir ~/backrest && cd ~/backrest
touch docker-compose.yml && nano docker-compose.yml
```
请按照实际情况修改 `docker-compose.yml` 中的相关部分。
``` yaml title="docker-compose.yml"
services:
backrest:
image: garethgeorge/backrest:latest
container_name: backrest
hostname: your-server-name
ports:
- "9898:9898"
volumes:
# Backrest data
- /path/to/backrest/data:/data
- /path/to/backrest/config:/config
- /path/to/backrest/cache:/cache
- /path/to/backrest/tmp:/tmp
# Rclone config
- /path/to/backrest/rclone:/root/.config/rclone
# Data backup path
- /path/to/immich-app:/backup/immich-app:ro
# Data restore path
- /path/to/backrest/restore:/restore
environment:
BACKREST_DATA: /data
BACKREST_CONFIG: /config/config.json
XDG_CACHE_HOME: /cache
TMPDIR: /tmp
TZ: "Asia/Shanghai"
restart: unless-stopped
```
``` bash
sudo docker compose up -d
```
## 配置
用浏览器打开 `http://your-server-ip:9898`,首次启动需要配置服务器名称和管理员账号密码。
填写 Cron 表达式时可以参考[这个网站](https://crontab.guru/)。
### 仓库
- **仓库名称**: 名称中只能包含数字和字母,以及短横线 - 或下划线 _ ,创建后不可更改。
- **仓库 URI**
- 本地: `/path/to/your/storage`,绝对路径,需要在 `docker-compose.yml` 的 `volumes` 段填写映射路径。
- 阿里云 OSS: `s3:https://oss-[Region ID].aliyuncs.com/[Bucket Name]`
- **密码**: 建议密码熵值至少为 128 位(20 个字符或更长)。点击 `生成` 以使用浏览器的加密随机 API 生成一个随机密码。**妥善保存该密码!**
- **环境变量**(阿里云 OSS)
- [获取 AccessKey](https://ram.console.aliyun.com/users)
- `AWS_ACCESS_KEY_ID=[your-AccessKey-id]`
- `AWS_SECRET_ACCESS_KEY=[your-AccessKey-secret]`
- **选项**(阿里云 OSS)
- `-o s3.bucket-lookup=dns`
- `-o s3.region=[Region ID]`
- `--limit-upload 1800` (上传限速,单位为 KiB/s)
- **清理策略**
- **清理后最大未引用数据占比**: `10`
- **调度类型**: `Cron`
- **Cron 表达式**: `0 8 * * 3` (每周三早上8点)
- **参考时钟**: `本地`
- **检查策略**
- **读取数据百分比**: `10`
- **调度类型**: `Cron`
- **Cron 表达式**: `0 8 * * 4` (每周四早上8点)
- **参考时钟**: `本地`
### 调度计划
- **调度计划名称**: 名称中只能包含数字和字母,以及短横线 - 或下划线 _ ,创建后不可更改。
- **路径**: `/path/to/your/data`,绝对路径,需要在 `docker-compose.yml` 的 `volumes` 段填写映射路径。
- **备份调度**
- **调度类型**: `Cron`
- **Cron 表达式**: `0 6 * * *` (每天早上6点)
- **参考时钟**: `本地`
- **保留策略**: `按计数`
- **保留最近的N个快照**: `7`
## 恢复数据
以下讨论设备正常运行时恢复部分数据,和设备重置后从零恢复数据两种情况。
### 部分数据恢复
点击数据所在的调度计划,找到希望恢复的对应时间点的备份,在“快照”处打开“快照浏览器”。
点击希望恢复的文件夹/文件的右侧选项,点击 `Restore to path`。
`Restore to path`: `/restore/[backrest-generate]`
恢复的数据会存放在 `/path/to/backrest/restore/[backrest-generate]` 内。
### 从零恢复数据
参照上述流程重新安装 Backrest。
参照上述流程重新配置仓库,**仓库 URI**、**密码**、**环境变量**(阿里云 OSS)和**选项**(阿里云 OSS)等务必与此前配置一致。
在对应仓库界面内,点击 `索引快照`。快照完成索引后,将按创建时间顺序以树状视图显示在 Backrest 中。
接下来,可参照部分数据恢复的流程恢复需要的数据。
## 参考
[Restore Files | Backrest](https://garethgeorge.github.io/backrest/introduction/restore-files)
[Backrest:自建备份方案的一种可能 - 初之音](https://www.himiku.com/archives/backrest.html)
@@ -88,4 +88,4 @@ tar -xzvf /backup/3-buyvm-lv_grafana-storage.tar.gz -C /
## 参考 ## 参考
[Backup and Restore of Docker Volumes: A Step-by-Step Guide](https://osmosys.co/blog/backup-and-restore-of-docker-volumes-a-step-by-step-guide/) [Backup and Restore of Docker Volumes: A Step-by-Step Guide OSMOSYS](https://osmosys.co/blog/backup-and-restore-of-docker-volumes-a-step-by-step-guide/)
+1 -1
View File
@@ -42,4 +42,4 @@
## 参考 ## 参考
[极1s(hc5661)刷 padavan 固件全纪录](https://www.3kjs.com/topic/10014.html) [路由极1s hc5661 padavan固件全纪录 - 科技师](https://www.3kjs.com/topic/10014.html)
+1 -1
View File
@@ -84,7 +84,7 @@
## 参考 ## 参考
[Install LineageOS on Xiaomi Mi 8 Pro](https://wiki.lineageos.org/devices/equuleus/install) [Install LineageOS on equuleus | LineageOS Wiki](https://wiki.lineageos.org/devices/equuleus/install)
@@ -237,4 +237,4 @@ lvextend -l +100%FREE /dev/pve/data
[Proxmox Beginners Guide: Everything You Need to Get Started - YouTube](https://www.youtube.com/watch?v=lFzWDJcRsqo) [Proxmox Beginners Guide: Everything You Need to Get Started - YouTube](https://www.youtube.com/watch?v=lFzWDJcRsqo)
[What are these 100.x.y.z addresses?](https://tailscale.com/docs/concepts/tailscale-ip-addresses) [What are these 100.x.y.z addresses? · Tailscale Docs](https://tailscale.com/docs/concepts/tailscale-ip-addresses)
@@ -135,8 +135,4 @@ sudo echo "[host_ip]:[/path/on/host] /mnt/nas nfs auto,nofail,noatime,nolock,int
## 参考 ## 参考
[Storage - Proxmox VE](https://pve.proxmox.com/wiki/Storage) [Storage - Proxmox VE](https://pve.proxmox.com/wiki/Storage)
[Proxmox VE Storage](https://proxmox.homelab.cattom.site/pve-docs/chapter-pvesm.html)
[QEMU/KVM Virtual Machines](https://proxmox.homelab.cattom.site/pve-docs/chapter-qm.html)
+1
View File
@@ -99,6 +99,7 @@ nav:
- "Redmi 4X (santoni)": tech/Redmi4X(santoni).md - "Redmi 4X (santoni)": tech/Redmi4X(santoni).md
- "2026年3月18日事故": tech/2026-3-18.md - "2026年3月18日事故": tech/2026-3-18.md
- "定制 Debian 13 镜像": tech/Customize-Debian-13-Image.md - "定制 Debian 13 镜像": tech/Customize-Debian-13-Image.md
- "Backrest: 备份新选择": tech/Backrest.md
- "安装和配置 Proxmox 9": tech/Proxmox-9-Install-and-Configuration.md - "安装和配置 Proxmox 9": tech/Proxmox-9-Install-and-Configuration.md
- "PicoKeys: YubiKey 的开源平替": tech/Picokeys.md - "PicoKeys: YubiKey 的开源平替": tech/Picokeys.md
- "手把手教你备份和还原 Docker 卷": tech/Backup-and-Restore-of-Docker-Volumes-A-Step-by-Step-Guide.md - "手把手教你备份和还原 Docker 卷": tech/Backup-and-Restore-of-Docker-Volumes-A-Step-by-Step-Guide.md