Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


migrate_from_vmware_to_kvm

Migrate from VMWare to KVM

Note: complex (hardware) VM configurations might not work well.

Steps

  • Get info about image file(s):
    # qemu-img info Offsec\ VM.vmdk
    image: Offsec VM.vmdk
    file format: vmdk
    virtual size: 40G (42949672960 bytes)
    disk size: 13G
    cluster_size: 65536
    Format specific information:
        cid: 1630022050
        parent cid: 4294967295
        create type: twoGbMaxExtentSparse
        extents:
            [0]:
                virtual size: 4261412864
                filename: Offsec VM-s001.vmdk
                cluster size: 65536
                format: SPARSE
            [1]:
                virtual size: 4261412864
                filename: Offsec VM-s002.vmdk
                cluster size: 65536
                format: SPARSE
            [2]:
                virtual size: 4261412864
                filename: Offsec VM-s003.vmdk
                cluster size: 65536
                format: SPARSE
            [3]:
                virtual size: 4261412864
                filename: Offsec VM-s004.vmdk
                cluster size: 65536
                format: SPARSE
            [4]:
                virtual size: 4261412864
                filename: Offsec VM-s005.vmdk
                cluster size: 65536
                format: SPARSE
            [5]:
                virtual size: 4261412864
                filename: Offsec VM-s006.vmdk
                cluster size: 65536
                format: SPARSE
            [6]:
                virtual size: 4261412864
                filename: Offsec VM-s007.vmdk
                cluster size: 65536
                format: SPARSE
            [7]:
                virtual size: 4261412864
                filename: Offsec VM-s008.vmdk
                cluster size: 65536
                format: SPARSE
            [8]:
                virtual size: 4261412864
                filename: Offsec VM-s009.vmdk
                cluster size: 65536
                format: SPARSE
            [9]:
                virtual size: 4261412864
                filename: Offsec VM-s010.vmdk
                cluster size: 65536
                format: SPARSE
            [10]:
                virtual size: 335544320
                filename: Offsec VM-s011.vmdk
                cluster size: 65536
                format: SPARSE
  • Convert vmdk to qcow2:
    qemu-img convert -f vmdk Offsec\ VM.vmdk -O qcow2 offsecvm.qcow2
  • Change owner:
    chown qemu. offsecvm.qcow2
  • Convert vmx to xml:
    vmware2libvirt -f Offsec\ VM.vmx > offsecvm.xml
  • Change other settings as needed.
    • VM name.
    • network (MAC address).
    • source file (qcow2).
    • emulator: /usr/libexec/qemu-kvm.
  • Import the XML, define the VM:
    virsh define offsecvm.xml
  • Edit the VM and change:
    virsh edit vmoffsec
    • driver name='qemu' type='qcow2'
      source file='/path/to-qcow2-file'
  • Start the vm:
    virsh start vmoffsec
  • Auto start at boot:
    virsh autostart vmoffsec
migrate_from_vmware_to_kvm.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1