How to make new KVM with existing hard drive

5,155

Solution 1

virt-install ... --disk [path to your existing image] --import ...

--import
Skip the OS installation process, and build a guest around an existing disk image. The device used for booting is the first device specified via "--disk" or "--file".

--disk [path]
path - A path to some storage media to use, existing or not. Existing media can be a file or block device. Specifying a non-existent path implies attempting to create the new storage, and will require specifyng a ’size’ value.

Solution 2

qemu-img command can convert any img format.

You can convert .vdi image to raw image. All hypervisors support raw image format. Then you can convert raw image to qed/qcow2 format to save image size.

Share:
5,155

Related videos on Youtube

jwbensley
Author by

jwbensley

Senior network engineer / architect Programmer Hobbyist hardware hacker/tinkerer

Updated on September 18, 2022

Comments

  • jwbensley
    jwbensley over 1 year

    I've been looking through the options of the QEMU binary, and I can't work this one out: Is it possible to make a new KVM machine with an existing hard drive image with an OS (XP Pro in this case) already installed?

    I have seen a guide online to turn my VirtualBox XP Pro hard drive (.vdi) into a qemu image (which I have done) but I can't seem to make a new KVM using this existing hard drive?

  • jwbensley
    jwbensley over 12 years
    Ah, the import option, I didnt find this. Thanks so much :D
  • Edward Shen
    Edward Shen almost 11 years
    qemu-img command support vdi format.
  • Edward Shen
    Edward Shen almost 11 years
    qemu can directly run vdi format disk.