问题原文
原帖链接 · 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.
- Manually transfer each 3tb VMDK file (Extremely slow)
- Have downtime and resize to make the transfer nicer (downtime is not ideal)
- 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.
- Make a copy VM on the destination with working LVM encryption.
Make a second VM and mount the encrypted LVM to it to /mnt
Important so that the server itself is not running- Copy keys between servers for root users to prevent access issues
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
