🚚 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。请参阅主网验证者迁移。