Sysadmin/Migrate virtual machine: Difference between revisions
No edit summary |
|||
| Line 29: | Line 29: | ||
=== Importing a VM from existing disk files === | === Importing a VM from existing disk files === | ||
# virt-install -v --accelerate --nographics --vcpus 2 | # virt-install -v --accelerate --nographics --vcpus 2 --ram 1024 --os-type linux --os-variant=ubuntu20.04 --network bridge:br0 --disk vol=boot/NEWVM-boot.img,bus=virtio --disk vol=nvme-pool/NEWVM-root,bus=virtio --name NEWVM --import | ||
The VM will boot and probably fail to mount the root because the UUID changed. | The new VM will boot and probably fail to mount the root because the UUID changed. | ||
You can fix this by dropping into grub the usual way: | You can fix this by dropping into grub the usual way: | ||
* virsh start --console NEWVM | |||
* press ESC before the kernel starts | * press ESC before the kernel starts | ||
* press e to edit a menu entry | * press e to edit a menu entry | ||
* modify the kernel command line (for example, root=/dev/vdb) | * modify the kernel command line (for example, root=/dev/vdb) | ||
* hit ctrl-x to boot | * hit ctrl-x to boot | ||
After booting, remember to update your grub.cfg and test it: | |||
# update-grub | |||
# reboot | |||
=== How to migrate a file-based guest to LVM (online method) === | === How to migrate a file-based guest to LVM (online method) === | ||