Post

Physical to Virtual Migration of Windows Machines

Physical to Virtual Migration of Windows Machines

P2V (Physical to Virtual) is a process that involves migrating the operating system, applications, and data from a physical server to a virtual machine (VM).

Developers using a P2V approach transfer their physical environment into a digital one. By doing this, they use less hardware and physical space, and reap the benefits of VMs, including more flexibility because VMs can run on multiple platforms. P2V is commonly used for server virtualization. It is also popular as a way for Mac users to run Windows applications.

Among the various tools available for P2V migration, Disk2VHD and Clonezilla stand out as popular and effective options.

  • Disk2VHD - developed by Sysinternals, allows users to create VHD (Virtual Hard Disk) images of physical disks, making it a straightforward choice for converting physical machines to VMs. It supports both VHD and VHDX formats, providing flexibility depending on the virtualization platform.
  • Clonezilla - is an open-source cloning tool that allows for the backup and recovery of disk images. While it may require more technical knowledge to operate effectively, its robust features make it a powerful option for comprehensive disk imaging and cloning tasks.

Steps Involving to perform a P2V migration using the Disk2VHD tool from Sysinternals. This utility is particularly useful for creating a virtual hard disk image of Windows physical machine, which can then be imported into a virtualization environment such as Proxmox.

Procedure to Make VHD Image

  1. Download Disk2VHD: The tool can be obtained from the official Microsoft Sysinternals website at https://learn.microsoft.com/en-us/sysinternals/downloads/disk2vhd.
  2. Run the Executable: After downloading, execute the Disk2VHD program.
  3. Select the Partition to Backup: Choose the partitions that need to be backed up for the migration.
  4. Choose the Destination Path: Specify a destination path, such as a USB device. Ensure the format is set to VHDX by checking the Use Vhdx box, then initiate the backup process.

VM Setup in Proxmox

Setting up a VM in Proxmox for the newly created VHD image requires careful configuration. A new VM should be created without any media, utilizing the following specifications:

  • Machine Type: Use VirtIO-GPU for graphics.
  • Machine Model: Set to Q35 for better compatibility.
  • Firmware: OVMF (UEFI) should be selected to support modern boot options.
  • Disk Controller: Choose VirtIO SCSI as a single controller.
  • Storage Options: Enable EFI & TPM Storage and QEMU Agent.
  • Resource Allocation: Allocate a minimum of 4 CPU cores and 8GB of RAM.

No initial disk is needed at this stage, as the VHD image will be imported later.

Image Format Conversion & Attach Disk to VM

Proxmox does not support the VHDX format directly. Therefore, the following steps must be taken to convert the image format and attach it to the VM:

  1. Attach External Hard Drive: Connect the external hard drive containing the VHDX image to the Proxmox server.
  2. Mount the Disk: Mount the external drive to access the VHDX file.
  3. Convert the VHDX to RAW Format: Execute the following command to convert the VHDX image to RAW format
    1
    
     qemu-img convert -f vhdx /mnt/usb/windows-server/windows-server.vhdx -O raw /tmp/backup/windows.raw
    
  4. Import the RAW Disk to Proxmox: Use the following command to attach the converted RAW disk to the VM
    1
    
     qm importdisk 100 /tmp/backup/windows.raw local-zfs
    

    Here, 100 represents the VM ID in Proxmox.

Make VM Ready

To finalize the VM setup, adjustments must be made in the VM’s hardware settings. The previously unused disk should be attached to the SATA bus, ensuring proper connectivity. Once configured, the VM can be started, allowing the migrated operating system and applications to run within the Proxmox environment.

This post is licensed under CC BY 4.0 by the author.