meta data for this page
  •  

This is an old revision of the document!


KVM

Migrate Windows 7/10 Virtual Box

(Optional) Preparation

Cleanup disc space and remove all unnecessary drivers:

  • uninstall Virtual Box Guest Additions
  • Download and run registry file: Mergeide.zip
  • Restart VM
  • sdelete -z c: d: e:
  • Enable ClearPageFileAtShutdown.reg
  • Shutdown VM

Now two methods are possible:

DRAFT

Fastest method: create Proxmox machine and import vbox hard discs to newly created Proxmox VM.

No VirtualBox preparation, no IDE drivers. Just import discs to new machine.

  • Create new Proxmox machine with similar parameters to old one
  • Import disc images (repeat for all VDI discs)
    • As RAW images with all benefits (compression, thin provisioning, snapshots) of local-zfs storage:
      qm importdisk 701 WIN7_C.vdi local-zfs
      • 21743 MB VDI compacted file occupied 15,2G on ZFS with compression ratio 1.24x
    • As QCOW2 files on every file storage:
      qm importdisk 701 WIN7_C.vdi local -format qcow2
  • Connect new discs into machine:
    • qm set 701 --scsi<N> local-zfs:vm-701-disk-<N>,discard=on,size=64G
    • NOTE: discard=on should be enabled for thin provisioned storage to reclaim unused space
  • Edit config file to change just connected discs from SCSI to IDE. Remember to update CDROM IDE number to do not be in conflict with new discs.
    • sed -i 's/scsi/ide/g' /etc/pve/qemu-server/702.conf
    • /etc/pve/qemu-server/702.conf
      ide0: local-zfs:vm-702-disk-1,discard=on,size=64G
      ide1: local-zfs:vm-702-disk-2,discard=on,size=64g
      ide2: local-zfs:vm-702-disk-3,discard=on,size=8G
      ide3: nas326-ISOs:iso/virtio-win-0.1.173.iso,media=cdrom,size=384670K
      scsi0: local-zfs:vm-702-disk-0,discard=on,size=32G
      scsihw: virtio-scsi-pci
  • Setup correct boot order
  • Start Windows 10
    • Windows should load correctly
    • Go to Device Manager and install missing drivers. See Virtio drivers
    • Shutdown system
  • Edit config file to change IDE discs to SCSI
  • Setup correct boot order
  • Start Windows 10
  • ERROR: Windows stuck during booting when VirtIO SCSI driver.
    • It is known KVM issue with VirtIO SCSI driver when more than 1 CPU core is used!
    • Changing CPU to 1 core solves problem.
    • It works with odd number of cores (1,3,5)
  • Windows will crash (becasue storage driver is not supported). Windows will reboot into repair mode.
  • Provide virtio drivers in virtual cd-rom (latest 1.1.173 was used)
  • Select Start-up Repair
  • Switch SCSI to IDE:
    sed -i 's/scsi/ide/g' /etc/pve/qemu-server/701.conf
    • Manually correct numbering conflict with CD-ROM ide drive
    • Setup correct boot order
  • Add one dummy (small size) hard disc to SCSI controller
  • Enable QEMU Guest Agent
  • Boot Windows, go to Device Manager and install missing drivers:

  • Shutdown machine
  • Switch disc controller from IDE to SCSI. Edit /etc/pve/qemu-server/701.conf
    • Setup correct boot order

sed -i 's/ide/scsi/g' /etc/pve/qemu-server/701.conf

Importing only disc

Fastest method: create Proxmox machine and import vbox hard disc to newly created Proxmox VM.

  • Create new Proxmox machine with similar parameters to old one
  • Import disc images (repeat for all VDI discs)
    • As RAW images with all benefits (compression, thin provisioning, snapshots) of local-zfs storage:
      qm importdisk 701 WIN7_C.vdi local-zfs
      • 21743 MB VDI compacted file occupied 15,2G on ZFS with compression ratio 1.24x
    • As QCOW2 files on every file storage:
      qm importdisk 701 WIN7_C.vdi local -format qcow2
  • Connect new discs into machine:
    • qm set 701 --scsi<N> local-zfs:vm-701-disk-<N>,discard=on,size=64G
    • NOTE: discard=on should be enabled for thin provisioned storage to reclaim unused space
  • Switch SCSI to IDE:
    sed -i 's/scsi/ide/g' /etc/pve/qemu-server/701.conf
    • Manually correct numbering conflict with CD-ROM ide drive
    • Setup correct boot order
  • Add one dummy (small size) hard disc to SCSI controller
  • Enable QEMU Guest Agent
  • Boot Windows, go to Device Manager and install missing drivers:
    • PCI Simple Communication Controller PCI\VEN1AF4&DEV_1003 –> Virtio console vioserial
    • Red Hat VirtIO SCSI pass-through controller vioscsi\w7\amd64
    • NetKVM\w7\amd64
    • (PCI\VEN_1AF4&DEV_1002) –> VirtIO Balloon Driver Balloon\w7\amd64
    • vm generation id (ACPI/QEMUVGID)
  • Shutdown machine
  • Switch disc controller from IDE to SCSI. Edit /etc/pve/qemu-server/701.conf
    • Setup correct boot order

sed -i 's/ide/scsi/g' /etc/pve/qemu-server/701.conf

NOT WORKING: Importing OVA file

  • Very slow method, exporting OVA needs to copy all discs into exported and well compressed file.
  • In VirtualBox choose “File” –> “Export Appliance”
    • select to export all network cards and MAC addresses
  • Proxmox cannot import OVA files directly. Please unpack it with command
    tar -xvf WIN7.ova
    • After unpacking, manifest file .ovf will be available.
  • qm importovf 701 ./WIN7.ovf local-zfs --dryrun --format qcow2
    • WARNING:
      warning: unable to parse the VM name in this OVF manifest, generating a default value
    • Create account/Login to VMWare page and download ovftool

T.B.C without success, more similar issues described here: