SLV 备份 - 快速入门
🗄️ SLV 备份
SLV Backup 使用 restic 为您的节点创建加密的增量备份。所有数据在上传前都在客户端使用 AES-256 加密——服务器永远不会看到您的明文数据。
传统模式:SLV 也支持未加密的 tar+zstd 备份(不使用--restic)。我们强烈建议对所有新备份使用--restic。
前提条件
- 目标节点上已安装 SLV CLI
sudo访问权限(全盘备份需要)- 已登录(
slv login)且有活跃的存储订阅 - 已安装
restic(apt install restic)
创建加密备份
bash
sudo slv backup create --restic --yessudo slv backup create --restic --yestext
🗄️ SLV Backup (restic mode)
Region: default
Retention: 7 days
⚠️ Restic encryption password generated and saved to:
/home/solv/.slv/restic-password
BACK UP THIS FILE — without it, backups cannot be restored.
🔧 Initializing restic repository (if needed)...
📦 Creating restic backup...
Files: 151263 new, 0 changed, 0 unmodified
Dirs: 22486 new, 0 changed, 0 unmodified
Added to the repository: 4.107 GiB (1.837 GiB stored)
processed 151263 files, 4.366 GiB in 0:50
snapshot b6925e6d saved
✅ Restic backup complete
🧹 Applying retention policy (keep within 7 days)...
✅ Backup complete.🗄️ SLV Backup (restic mode)
Region: default
Retention: 7 days
⚠️ Restic encryption password generated and saved to:
/home/solv/.slv/restic-password
BACK UP THIS FILE — without it, backups cannot be restored.
🔧 Initializing restic repository (if needed)...
📦 Creating restic backup...
Files: 151263 new, 0 changed, 0 unmodified
Dirs: 22486 new, 0 changed, 0 unmodified
Added to the repository: 4.107 GiB (1.837 GiB stored)
processed 151263 files, 4.366 GiB in 0:50
snapshot b6925e6d saved
✅ Restic backup complete
🧹 Applying retention policy (keep within 7 days)...
✅ Backup complete.首次运行时的操作
- 生成一个随机加密密码并保存到
~/.slv/restic-password(权限 0600) - 在 ERPC 云存储上初始化一个 restic 仓库
- 备份整个磁盘(排除系统伪文件系统)
后续运行
仅上传已更改的文件(增量)。去重功能可降低存储成本。
列出备份
bash
sudo slv backup listsudo slv backup list显示云存储中的 restic 快照和传统 tar 备份。
从备份恢复
恢复最新快照:
bash
sudo slv backup restore latestsudo slv backup restore latest恢复特定快照:
bash
sudo slv backup restore b6925e6dsudo slv backup restore b6925e6d恢复传统 tar 备份:
bash
sudo slv backup restore backup-mynode-20260318.tar.zstsudo slv backup restore backup-mynode-20260318.tar.zst验证备份完整性
bash
sudo restic -r rest:https://<apiKey>:[email protected]/v3/storage/restic/ \
--password-file ~/.slv/restic-password checksudo restic -r rest:https://<apiKey>:[email protected]/v3/storage/restic/ \
--password-file ~/.slv/restic-password check设置自动备份(Cron)
bash
sudo slv backup create --restic --cron dailysudo slv backup create --restic --cron daily| 间隔 | 描述 |
|---|---|
daily | 每天运行一次 |
weekly | 每周运行一次 |
monthly | 每月运行一次 |
off | 移除 cron 任务 |
保留策略
默认情况下,超过 7 天的快照会自动清理:
bash
sudo slv backup create --restic --retention 14sudo slv backup create --restic --retention 14自定义排除项
查看当前排除列表:
bash
slv backup create --list-excludesslv backup create --list-excludes添加额外的排除路径:
bash
sudo slv backup create --restic --exclude /home/solv/ledger --exclude /home/solv/snapshotssudo slv backup create --restic --exclude /home/solv/ledger --exclude /home/solv/snapshots加密与安全
| 功能 | 详情 |
|---|---|
| 加密 | AES-256-CTR + Poly1305-AES(客户端) |
| 完整性 | SHA-256 内容寻址存储 |
| 去重 | 内容定义分块 |
| 服务端可见性 | 无——服务器仅能看到加密的数据块 |
| 密码文件 | ~/.slv/restic-password(权限 0600) |
| 从备份中排除 | ~/.slv/restic-password、~/.slv/api.yml、~/.slv/backup.env |
⚠️ 重要提示:请单独备份您的~/.slv/restic-password文件。没有此文件,您的备份将无法恢复。
选项参考
| 选项 | 描述 |
|---|---|
--restic | 使用 restic 进行加密增量备份(推荐) |
-r, --region <region> | 存储区域(默认:eu) |
--exclude <path> | 额外排除的路径(可重复使用) |
--include <path> | 从默认排除列表中移除(可重复使用) |
--list-excludes | 显示当前排除列表并退出 |
--retention <days> | 清理超过 N 天的快照(默认:7) |
--cron <interval> | 设置 cron 任务(daily/weekly/monthly/off) |
-y, --yes | 跳过确认提示 |
--upload | 传统:上传 tar 备份到云存储 |
-o, --output <path> | 传统:tar 备份的输出文件路径 |
传统模式(tar+zstd)
为了向后兼容,仍支持未加密的 tar 备份:
bash
sudo slv backup create --upload --yes # Unencrypted tar backupsudo slv backup create --upload --yes # Unencrypted tar backup注意:传统备份未加密。我们建议所有新备份迁移到--restic。