Skip to content

Instantly share code, notes, and snippets.

@pjobson
Last active December 27, 2021 03:45
Show Gist options
  • Save pjobson/ea1179c5d9adac9ec92122439a76a9e3 to your computer and use it in GitHub Desktop.
Save pjobson/ea1179c5d9adac9ec92122439a76a9e3 to your computer and use it in GitHub Desktop.
Windows 10 Physical Drive to VirtualBox VM

Windows Physical Drive to VirtualBox VM

What You Need

  • Windows Computer (I'm using Win10)
  • Linux Computer (I'm using Mint 20.1)
  • External Drive
    • The largest supported image size is 127GB, so if you have a bunch of personal files on your Windows computer, migrate it to a different drive..

Boot your Windows Machine

  1. Download Disk2vhd.zip
  2. Plugin an external drive and format it to exFAT.
  3. Open Disk2vhd
  4. Select all of the drives, except for your USB drive and ceate a VHDX file. Set the save path to your external drive.
  5. Mine hung on the D: drive, so I cancelled it, this may be because the drive was failing, I'm not sure.
  6. Open Command Prompt as Administrator

Boot your Linux Machine

  1. Install VirtualBox if you have not.
  2. Plug in your external drive.
  3. Open Terminal
  4. mkdir -p mkdir -p "~/VirtualBox VMs/Win10Backup"
  5. VBoxManage clonehd /path/to/<filename>.vhdx "~/VirtualBox VMs/Win10Backup/Win10HDD.vdi --format VDI"
  6. Wait awhile.
  7. Download Windows 10 ISO.
  8. Open Virtual Box
    1. Select Tools at the top, then the menu icon, then Media
    2. If you have stuff in there, remove it. Sometimes it adds everything and then doesn't work properly later.
    3. Click Add
    4. Select your Windows10HDD folder then Win10HDD.vdi
    5. Select Tools, menu, Welcome
    6. New
      1. Name: anything
      2. Machine Folder: default
      3. Type: Microsoft Windows
      4. Version: Windows 10
      5. NEXT
      6. Memory: minimum to have Win10 usable is 8GB
      7. NEXT
      8. Use an existing virutal hard disk file: select your Win10HDD.vdi
      9. OK
    7. Settings
      1. System
      2. Motherboard
      3. Boot Order: Uncheck Floppy
      4. Extended Features: Enable EFI (special OSes only)
      5. Processors: give it 4 cores minimum
      6. Display
      7. Screen
      8. Video Memory: 128MB
    8. Start the VM
    9. Wait until you get to the language selection screen
    10. SHIFT-F10 to open Command Prompt
      1. diskpart
      2. list vol
      3. You should see one with RAW FS
      4. sel vol #
      5. assign letter=V:
      6. exit
      7. V:
      8. format V: /FS:FAT32
      9. bcdboot C:\windows /s V: /f UEFI
    11. Eject the Win10 ISO and reoot.
    12. This should boot into your Windows 10 disk image.
    13. Install Guest additions from the Devices menu.

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment