Changes

no edit summary
Line 1: Line 1: −
== How to migrate a file-based guest to LVM (online method) ==
+
=== How to migrate a file-based guest to LVM (online method) ===
    
* First, create the logical volume and attach it to the running VM:
 
* First, create the logical volume and attach it to the running VM:
Line 44: Line 44:  
  #treehouse virsh start lightwave --console
 
  #treehouse virsh start lightwave --console
   −
== How to migrate a file-based guest to LVM (offline method) ==
+
=== How to migrate a file-based guest to LVM (offline method) ===
    
* Determine the offset of the root partition within the raw disk image:
 
* Determine the offset of the root partition within the raw disk image:
Line 56: Line 56:  
* Then create an LV and copy over everything as in the online case
 
* Then create an LV and copy over everything as in the online case
   −
== How to migrate an LVM-based guest to another host ==
+
=== How to migrate an LVM-based guest to another host ===
    
(untested procedure)
 
(untested procedure)
Line 76: Line 76:  
Make sure you pass all the fancy switches to rsync or you'll loose
 
Make sure you pass all the fancy switches to rsync or you'll loose
 
information on the copy.
 
information on the copy.
 +
 +
 +
=== Alternative to convert file based VM to block based LVM (Assumes server is treehouse) ===
 +
 +
Stop the VM
 +
 +
sudo virsh stop ''name_of_vm''
 +
 +
Convert the qcow2 file to a raw file
 +
 +
sudo qemu-img convert "name_of_vm".qcow2 -O raw "name_of_vm".raw
 +
 +
Create the LVM - Make sure the "size_of_vm" is equal or greater than the size of your raw image
 +
 +
sudo virsh vol-create-as treehouse "name_of_vm" "size_of_vm"
 +
 +
Copy the raw image to the LVM
 +
 +
sudo dd if="name_of_vm".raw of=/dev/treehouse/"name_of_vm" bs=1M
 +
 +
Edit the VM configuration
 +
 +
sudo virsh edit "name_of_vm"
 +
 +
    <devices>
 +
      ...
 +
      <disk type='block' device='disk'>      <----- change disk type to block
 +
        <source dev='/dev/treehouse/"name_of_vm"'/>      <------ note that the source is now dev= and not file=
 +
        <target dev='vda' bus='virtio'/>
 +
      </disk>
 +
      ...
 +
    </devices>
 +
 +
Now start your VM and your all set
84

edits