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。