SLV 備份 - 快速入門

🗄️ SLV 備份

SLV Backup 使用 restic 為您的節點建立加密的增量備份。所有資料在上傳前都在客戶端使用 AES-256 加密——伺服器永遠不會看到您的明文資料。
傳統模式:SLV 也支援未加密的 tar+zstd 備份(不使用 --restic)。我們強烈建議對所有新備份使用 --restic

前提條件

  • 目標節點上已安裝 SLV CLI
  • sudo 訪問許可權(全盤備份需要)
  • 已登入(slv login)且有活躍的儲存訂閱
  • 已安裝 resticapt install restic

建立加密備份

bash
sudo slv backup create --restic --yes
text
🗄️  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.

首次執行時的操作

  1. 生成一個隨機加密密碼並儲存到 ~/.slv/restic-password(許可權 0600)
  2. 在 ERPC 雲端儲存上初始化一個 restic 倉庫
  3. 備份整個磁碟(排除系統偽檔案系統)

後續執行

僅上傳已更改的檔案(增量)。去重功能可降低儲存成本。

列出備份

bash
sudo slv backup list
顯示雲端儲存中的 restic 快照和傳統 tar 備份。

從備份恢復

恢復最新快照:
bash
sudo slv backup restore latest
恢復特定快照:
bash
sudo slv backup restore b6925e6d
恢復傳統 tar 備份:
bash
sudo 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 check

設定自動備份(Cron)

bash
sudo slv backup create --restic --cron daily
間隔描述
daily每天執行一次
weekly每週執行一次
monthly每月執行一次
off移除 cron 任務

保留策略

預設情況下,超過 7 天的快照會自動清理:
bash
sudo slv backup create --restic --retention 14

自定義排除項

檢視當前排除列表:
bash
slv backup create --list-excludes
新增額外的排除路徑:
bash
sudo 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 backup
注意:傳統備份未加密。我們建議所有新備份遷移到 --restic