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

How to Migrate an oversized Encrypted server on ESXi

· 52CE 我爱测

So, I have gotten myself into a particular predicament and have seen a few pieces of ways to solve my problem but I am missing some parts in between. The basis of my problem is that I have an old ESXi managed server with a few cr…

问题原文

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

So, I have gotten myself into a particular predicament and have seen a few pieces of ways to solve my problem but I am missing some parts in between.

The basis of my problem is that I have an old ESXi managed server with a few critical debian VMs and a new ESXi server that I want to host these VMs. The servers are in separate data centers and while the actual used size of the VMs is only a few Gbs directly they are each setup as encrypted LVMs so ESXi sees them as fully filled 3tb drives. Ideally I would like to create a copy of non-critical parts of these VMs and then at some point in time announce downtime and freeze them and transfer the critical parts. If the disc were not encrypted I could just shrink the drives but my understanding is that to shrink them I would need to shutdown the servers which is less than ideal. As such this the paths I see I could take.

  1. Manually transfer each 3tb VMDK file (Extremely slow)
  2. Have downtime and resize to make the transfer nicer (downtime is not ideal)
  3. Use some combination of DD, sfdisk, LVM tools, and dump to transfer stuff over to new VMs

I would love to use 3 but I honestly am unsure exactly how I would do this or the best way of doing this that would preserve the LVMs and encrypted setup.

已采纳解答

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

So, this was the best scenario after the P2V failed.

  1. Make a copy VM on the destination with working LVM encryption.
  2. Make a second VM and mount the encrypted LVM to it to /mnt

    Important so that the server itself is not running
    
  3. Copy keys between servers for root users to prevent access issues
  4. Run the following command

    rsync -aHxvK --numeric-ids --progress --exclude=/etc/fstab --exclude=/etc/crypttab --exclude=/etc/initramfs-tools/conf.d/* --exclude=/etc/network/* --exclude=/mnt/* --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/boot/* --exclude=/root/*   [email omitted]:/* /mnt/
    

This will copy most of the non-changing files and give you a functioning "copy" of the server. Most of this rsync is shown in a few guides online but I found that /etc/crypttab is needed for encrypted volumes or it doesn't boot and initramfs is needed or you console spam on boot

Once this is done You schedule a short downtime and shut down major services like database and web servers and do a final transfer of those directories before bringing up and transferring endpoints to the new server.

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

资料来源与适用范围

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

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

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