admin:linux:virt-manager

virt-manager KVM GUI

You have to install this on the target machine:

  • netcat (nc)
  • qemu-kvm
  • libvirtd
  1. Click on the “File” menu at the top left of the window.
  2. Click on the “New Virtual Machine” menu entry.
  3. Choose your installation media.
  4. Click on “Forward”.
  5. Follow the wizard as usual until you reach step 4.
  6. On step 4, choose “Select or create custom storage”.
  7. Inside the text field, type something like “/dev/disk/by-id/{id of the disk}” or “/dev/sdXX”.
    1. If you don’t want to ever use command line, you can install GParted or GNOME Disks, they’ll tell you the /dev path.
  8. Click “Forward”.
  9. Finish the wizard as you would do usually.

Do NOT use a physical disk or partition if you plan to do anything risky or if you don’t know what are you doing.

Using a physical disk, you can lose data, overwrite the bootloader by mistake, or a virus could make your computer unbootable by messing up with labels.

Using a physical partition is, however, more safe than using a physical disk, but you can still lose the data of the partition. Do NOT share a mounted physical partition except if you know what are you doing.

Upon deletion of the VM, when it asks for “Deleting associated storage files”, do NOT forget to uncheck your /dev device.

  1. Click on the “File” menu at the top left of the window.
  2. Click on the “New Virtual Machine” menu entry.
  3. Choose “Import existing disk image” in the wizard.
  4. Inside the text field, type something like “/dev/disk/by-id/{id of the disk}” or “/dev/sdXX”.

If you don’t want to ever use command line, you can install GParted or GNOME Disks, they’ll tell you the /dev path.

  1. Choose the appropriate “OS Type” and “Version”.
  2. Click “Forward”.
  3. Finish the wizard as you would do usually.

WARNING: You may want to personalize the VM settings and disk emulation settings in order to boot properly on it.

If your OS expects SATA and virt-manager sets it up to IDE, you will probably be unable to boot without a reinstall ‒ but if you use this steps' list instead of the first one, it’s precisely to not reinstall it.

As well, all warnings of the first method applies here.

Note: Booting using this method on an already-installed partition is almost impossible, since bootloaders are often inside the disk, and not in a partition.

Instead:

  1. Go make a VM with a little virtual disk with a LiveCD/LiveDVD/LiveUSB as installation source. Little = 101 MiB.
  2. Inside the settings of the VM, add a new hard disk with a path like “/dev/disk/by-id/{id of the disk}” or “/dev/sdXX”.
    1. If you don’t want to ever use command line, you can install GParted or GNOME Disks, they’ll tell you the /dev path.
  3. Start the virtual machine.
  4. Create a partition table on the virtual disk.
  5. Create a 100 MiB ext2 partition on this virtual disk.
  6. Mount that new partition.
  7. Inside a Terminal, run: grub-install {/dev path to your 100 MiB partition} –boot-directory={mounted path to your 100 MiB partition}/boot/grub2
  8. Then run create a grub.cfg inside the{mounted path to your 100 MiB partition}/boot/grub2 folder suitable for booting on the 2nd hard disk.
    1. grub-mkconfig may not probe the distribution on the other disk if it lacks a partition table.
    2. GRUB can boot from a physical partition.
  9. Remove the LiveCD/LiveDVD/LiveUSB from your VM.
  10. Reboot.
  • Last modified: 2024-07-05 14:31