Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


migrate_kvm_vm

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
migrate_kvm_vm [2014/06/12 14:59] adminmigrate_kvm_vm [2015/03/16 13:22] admin
Line 29: Line 29:
   * Enable autostart on new host. <code>virsh autostart vmns2</code>   * Enable autostart on new host. <code>virsh autostart vmns2</code>
   * Clean up vm and storage on old host / NAS.   * Clean up vm and storage on old host / NAS.
 +====LV to qcow2 image==== 
 +  * Use qemu-img to convert from an lvm to qcow2 format <code>qemu-img convert -O qcow2 /dev/vg_name/lv_name/ /var/lib/libvirt/images/image_name.qcow2</code> 
 +  * If you want the image compressed add '-c' right after the word convert. 
 +  * Edit the xml for the image <code>virsh edit image_name</code> 
 +  * Modify the disk stanza, adding a type to the driver line; on the source line change 'dev' to 'file' and modify the path: <code>driver name='qemu' type='qcow2' 
 +source file='/var/lib/libvirt/images/image_name.qcow2'</code> 
 +  * Shrink the file <code>qemu-img convert -c -O qcow2 source.qcow2 shrunk.qcow2</code>
migrate_kvm_vm.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1