大网数据广告活动
服务器运维问答

How can I migrate a VPS from one provider to another while keeping configurations? Can I just use `rsync / destination:/`?

· 52CE 我爱测

How can I migrate from one VPS to another, while keeping the configurations? I saw this question Best way to migrate data between two linux VPS But that was only to migrate the data. I have set up an email server (Dovecot/Postfix…

问题原文

原帖链接 · Chloe · CC BY-SA 3.0

How can I migrate from one VPS to another, while keeping the configurations?

I saw this question Best way to migrate data between two linux VPS

But that was only to migrate the data.

I have set up an email server (Dovecot/Postfix) which is a pain to set up, Tomcat, PHP, Apache, Webmin, etc. and would like to copy the configurations for them without having to set everything up again.

I'm afraid if I copy the root directories, there will be special files like /dev that should not be copied.

已采纳解答

原帖链接 · kasperd · CC BY-SA 3.0

I went through that exact task a few days ago. The steps I performed was essentially this:

  1. Create a bind mount of the root file system in a separate location on the source VPS. For example mount --bind / /mnt/servername
  2. Create a tar file containing all of /mnt/servername. For example tar -C /mnt -c servername | ssh user@newserver dd of=copy.tar
  3. Extract the tar file. At this point it is important to use the --numeric-owner flag for tar.
  4. Replace the network configuration in the extracted image with one suitable for the destination VPS.
  5. Move the files into their final position (this is the tricky part).

Step 5 becomes a lot simpler if the destination VPS offers management features such as netboot, virtual console, etc. The VPS I was migrating to offered both of the above. The virtual console was utilizing a VNC client connecting to the hypervisor for access to the virtual display.

If you don't have such management features, you need to get that step right in the first try. And updating the boot loader is challenging.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-03-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。