Показаны сообщения с ярлыком clone. Показать все сообщения
Показаны сообщения с ярлыком clone. Показать все сообщения

пятница, 15 июля 2011 г.

Clone VM disk

One of flaws of Proxmox is that it does not have ability to clone virtual hard disks. If you store VN disks as files then you simply create another machine, then go to CLI (ssh to cluster node) and cp VM disk (which is file on host machine disk) to file that store new machine disk. But it may be confused to clone disks that are stored on LVM groups.

Here is the solution: use dd instead of cp, and do it in such a way:

dd if=/dev/{sourceLVMGroupName}/vm-{$VMID_SOURCE}-disk-{#} of=/dev/{destLVMGroupName}/vm-{$VMID_NEW}-disk-{#}

For example, if I have such a setup:

# pvscan
PV /dev/sdb VG VG_vmstore lvm2 [931.51 GB / 899.51 GB free]


I simply do

dd if=/dev/VG_vmstore/vm-101-disk-1 of=/dev/VG_vmstore/vm-102-disk-1