🚚 SLV Migrate Linux
透過 SSH 使用 rsync 將整個 Linux 磁碟遷移到新伺服器。這是全盤遷移——源伺服器上的所有內容都會複製到目標伺服器,包括使用者資料、配置、已安裝的軟體包和 SLV 節點設定。
注意:這與 slv v switch(驗證者身份遷移)不同。slv migrate linux 複製整個檔案系統,而 slv v switch 在兩個已執行的節點之間交換驗證者身份。
前提條件
- 源節點上已安裝 SLV CLI
- 源和目標上都有
sudo / root 存取權
- 從源到目標的 SSH 存取(基於密碼或金鑰)
- 目標伺服器應為全新安裝(如果檢測到現有資料,SLV 會發出警告)
基本用法
在源伺服器上執行:
sudo slv migrate linux --to root@new-server-ip
sudo slv migrate linux --to root@new-server-ip
🚚 SLV Linux Migration
Source: ubuntu (this machine)
Destination: [email protected]
📋 Exclude list:
• /dev/*
• /proc/*
• /sys/*
• /tmp/*
• /run/*
• /mnt/*
• /media/*
• /lost+found
• /swapfile
• /snap/*
• /var/log/*
? Start migration? This will overwrite data on the destination. › Yes
Syncing... (this may take a while depending on disk size)
√ Migration complete
Rebooting destination...
🚚 SLV Linux Migration
Source: ubuntu (this machine)
Destination: [email protected]
📋 Exclude list:
• /dev/*
• /proc/*
• /sys/*
• /tmp/*
• /run/*
• /mnt/*
• /media/*
• /lost+found
• /swapfile
• /snap/*
• /var/log/*
? Start migration? This will overwrite data on the destination. › Yes
Syncing... (this may take a while depending on disk size)
√ Migration complete
Rebooting destination...
選項
自定義 SSH 埠
如果目標使用非標準 SSH 埠:
sudo slv migrate linux --to root@new-server-ip --port 2222
sudo slv migrate linux --to root@new-server-ip --port 2222
自定義排除項
檢視將要排除的內容:
slv migrate linux --list-excludes
slv migrate linux --list-excludes
排除額外路徑(例如跳過賬本資料以加快遷移):
sudo slv migrate linux --to root@new-server-ip --exclude /home/solv/ledger
sudo slv migrate linux --to root@new-server-ip --exclude /home/solv/ledger
非互動模式
用於指令碼:
sudo slv migrate linux --to root@new-server-ip --skip-reboot --yes
sudo slv migrate linux --to root@new-server-ip --skip-reboot --yes
工作原理
- 預檢——驗證 SSH 連線,如果目標有現有資料則發出警告
- rsync——透過 SSH 複製整個檔案系統(排除系統偽檔案系統)
- 遷移後——自動重啟目標伺服器(除非使用
--skip-reboot)
遷移使用 rsync 的 --archive --hard-links --acls --xattrs 選項來保留所有檔案屬性、權限和特殊檔案。
⚠️ 重要提示
- 以 root 執行(或使用
sudo)。非 root 遷移會遺漏系統檔案。
- 目標應為全新伺服器。現有資料將被覆蓋。
- rsync 退出碼 23/24(部分傳輸)被視為警告而非錯誤。某些檔案(如活躍日誌)可能無法完美傳輸。
- 遷移後,在停用源伺服器前驗證節點是否正常工作。
- 對於驗證者身份遷移(兩個執行中的驗證者之間零停機時間切換),請使用
slv v switch。請參閱主網驗證者遷移。