Sysadmin/Migrate virtual machine: Difference between revisions

No edit summary
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, take a copy of the kernel and initrd:


  treehouse# scp VMNAME:/boot/{vmlinuz,initrd}-2.6.31-22-server /srv/vm/kernel/ubuntu/
  treehouse# scp VMNAME:/boot/{vmlinuz,initrd}-2.6.31-22-server /srv/vm/kernel/ubuntu/
* Then, create the logical volume and attach it to the running VM:
  treehouse# virsh vol-create-as treehouse VMNAME-root 10G
  treehouse# virsh vol-create-as treehouse VMNAME-root 10G
  treehouse# virsh attach-disk VMNAME /dev/treehouse/VMNAME-root vdc
  treehouse# virsh attach-disk VMNAME /dev/treehouse/VMNAME-root vdc
Line 45: Line 48:


=== How to migrate a file-based guest to LVM (offline method) ===
=== How to migrate a file-based guest to LVM (offline method) ===
This method works by taking down the virtual machine during the migration and mounting the
partition inside the hard drive image. Mounting qcow2 files require a fancier 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: