SLV Linux 迁移 - 快速入门
🚚 SLV Linux 迁移
通过 SSH 使用 rsync 将整个 Linux 磁盘迁移到新服务器。这是全盘迁移——源服务器上的所有内容都会复制到目标服务器,包括用户数据、配置、已安装的软件包和 SLV 节点设置。
**注意:**这与slv v switch(验证者身份迁移)不同。slv migrate linux复制整个文件系统,而slv v switch在两个已运行的节点之间交换验证者身份。
前提条件
- 源节点上已安装 SLV CLI
- 源和目标上都有
sudo/ root 访问权限 - 从源到目标的 SSH 访问(基于密码或密钥)
- 目标服务器应为全新安装(如果检测到现有数据,SLV 会发出警告)
基本用法
在源服务器上运行:
bash
sudo slv migrate linux --to root@new-server-ipsudo slv migrate linux --to root@new-server-iptext
🚚 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...选项
| 选项 | 描述 |
|---|---|
-t, --to <ssh> | SSH 目标(例如 root@new-server) |
-p, --port <port> | SSH 端口(默认:22) |
--skip-reboot | 迁移后跳过自动重启 |
--exclude <path> | 额外的 rsync 排除模式(可重复使用) |
--include <path> | 从默认排除列表中移除(可重复使用) |
--list-excludes | 显示当前排除列表并退出 |
-y, --yes | 跳过确认提示 |
自定义 SSH 端口
如果目标使用非标准 SSH 端口:
bash
sudo slv migrate linux --to root@new-server-ip --port 2222sudo slv migrate linux --to root@new-server-ip --port 2222自定义排除项
查看将要排除的内容:
bash
slv migrate linux --list-excludesslv migrate linux --list-excludes排除额外路径(例如跳过账本数据以加快迁移):
bash
sudo slv migrate linux --to root@new-server-ip --exclude /home/solv/ledgersudo slv migrate linux --to root@new-server-ip --exclude /home/solv/ledger非交互模式
用于脚本:
bash
sudo slv migrate linux --to root@new-server-ip --skip-reboot --yessudo 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。请参阅主网验证者迁移。