I’ve been running Windows on my gaming desktop and am ready to make the switch to Linux (I run arch at work and cachyOS on my personal laptop). However, I’ve got some software that I want to use that’s Windows-only, and I’d rather not replace them and re-learn from scratch. Does anyone know of any software or methods to take the currently installed Windows OS and move it into a VM image I could run on Linux?

  • BananaTrifleViolin@piefed.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 hours ago

    Ok, the best way to do this is to install VM software on linux (I use KVM/QEMU) then make a new Windows guest and install from scratch using a Windows install ISO file. It’s the better method as the new Windows install will have no bloat from your original install, the boot partition will be set up properly and there won’t be redundant old drivers and configuration issues that could be very messy in the guest.

    I have a KVM/QEMU windows VM with a license that runs fine; I use it rarely mainly to use work’s version of MS Office. You can migrate the license from your original install over to the VM so you don’t have to pay for a new Windows license. If you also have data to transfer into the VM from the original windows partition, you can either directly mount that partition inside the VM or mount the partition in your Linux host as a read only partition, and then share that as a folder into the VM. Then you can transfer any files you want into within your guest machine (e.g. within the windows guest copy files from the shared folder, drive D: onto the guests machines drive C:). It’s much much easier than the complexity and issues of cloning an existing partition and trouble shooting it to work in a VM.

    If you really want to go down the route of taking the current installed OS and move that into a VM image, then the best way is making a disk image of the whole windows drive (assuming it’s a boot partition + C: drive) or clone both the boot partition + windows partitions into their own files if it’s a shared drive with Linux. There are lots of tools that can do this; “dd” and “partclone” are 2 particularly common tools you can use from a linux terminal to create a .img file of the partitions, and then you mount those into a VM. But messing with Windows boot partitions is always messy, and you’ll likely also need a Windows Recover disc to also mount in the partition to “repair” the boot partition in the new machine. You will also have to troubleshoot hardware issues if Windows can’t cope with the sudden complete hardware change from your host PC to the new virtual hardware.

    Honestly, make a fresh Windows machine in a VM and transfer your files in. It’s far easier.

    EDIT:
    Here is a good guide to setting up a Windows guest in KVM/QEMU including TPM 2.0 for linux.

    https://computingforgeeks.com/windows-11-installation-on-kvm-with-virt-manager/

    Then with once you have a working Windows VM, this is a good guide for setting up a shared folder (I’d mount your windows drive within your Linux host as RO, and then share the mount point as a folder into your guest; that reduces the risk of data loss):

    https://www.debugpoint.com/kvm-share-folder-windows-guest/

    I didn’t write these guides but have read them through and they’re what I’d do/did for my Windows VM. If you choose to migrate your drive instead, you’ll still need to set up the hardware of the virtual machine as in these guides, but instead of creating a new virtual drive file, use the disk image you create from your windows partitions.

  • gabmus@retrolemmy.com
    link
    fedilink
    English
    arrow-up
    11
    ·
    4 hours ago

    If you have enough space and plan on using libvirt or any other virtualization technology that just lets you use img files as virtual disks, you can just dump the entire disk with dd:

    (replace /dev/sda with the disk containing windows)

    dd if=/dev/sda of=./windows-disk.img status=progress
    
  • drrodneymckay_@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    4 hours ago

    There are many ways, many programs, and many processes that you could step through. Figure out what VM software you will use under Linux to pick your virtual disk file format, the sort when you are going to backup your existing install, and if anything is in your way like disk encryption.

    If you can boot a live linux or pull the drive, look at qemu-img, I haven’t used it myself in awhile for syntax but Google suggests a command like this will work for you

    sudo qemu-img convert -f raw -O qcow2 -p /dev/sdX /path/to/disk.qcow2