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 == | == How to migrate a file-based guest to LVM == | ||
* First, create the logical volume and attach it to the running VM: | |||
treehouse# scp lightwave:/boot/{vmlinuz,initrd}-2.6.31-22-server /srv/vm/kernel/ubuntu/ | treehouse# scp lightwave:/boot/{vmlinuz,initrd}-2.6.31-22-server /srv/vm/kernel/ubuntu/ | ||
| Line 5: | Line 7: | ||
treehouse# virsh attach-disk lightwave /dev/treehouse/lightwave-root vdc | treehouse# virsh attach-disk lightwave /dev/treehouse/lightwave-root vdc | ||
treehouse# virsh console lightwave | treehouse# virsh console lightwave | ||
* From within the VM, format the new volume and move things over | |||
lightwave# mkfs.ext4 -L lightwave-root -O flex_bg,extent,uninit_bg,sparse_super /dev/vdc | lightwave# mkfs.ext4 -L lightwave-root -O flex_bg,extent,uninit_bg,sparse_super /dev/vdc | ||
| Line 13: | Line 17: | ||
lightwafe# umount /mnt | lightwafe# umount /mnt | ||
lightwave# ^D | lightwave# ^D | ||
* Then edit the VM configuration to make it boot without GRUB, using externally provided kernel and initrd: | |||
treehouse# virsh edit lightwave | treehouse# virsh edit lightwave | ||
| Line 32: | Line 38: | ||
... | ... | ||
</devices> | </devices> | ||
* Reboot | |||
#treehouse virsh destroy lightwave | #treehouse virsh destroy lightwave | ||