Transitioning from Windows 7/8 OEM to Windows 10 Virtual Machine
I have a laptop that came with Windows 7 and added Linux Mint for dual boot, but have always been annoyed by the need to interrupt my Mint session to do something in Windows. From time to time I've thought it would be nice to put it in a VM instead, but the task seemed too much trouble and also I hated the thought of sending more money to the Evil Empire for something I already owned.
When I somehow messed up the Windows partition and made it unbootable this became more pressing. Also I wanted to take advantage of the free upgrade to Win 10 before it expires on July 29.
With some web searching I learned that it's possible to install a standard Windows 7 (or 8 or 8.1) into a VirtualBox VM using an OEM product key. I was able to do this and then upgrade to Windows 10. It occurs me that the steps I worked out may be useful to others, so I am listing them below. This assumes you will also upgrade to Win 10... if not, modify accordingly.
Already upgraded to Windows 10? You can fresh-install it to a VM and then *maybe* transfer the entitlement by contacting Microsoft support via the app for that. See this article.
Due to trial and error the following steps are not exactly what I did, but are what I would do in hindsight. If you find any mistakes please let me know.
Prerequisites for the host computer:
- Linux installed.
- VirtualBox installed.
- At least 6 GB total RAM and 60 GB available disk space.
- Product key for the original Windows 7, 8 or 8.1 install that came with your computer.
- Broadband Internet access.
Here's what to do:
-
Look at the Microsoft sticker on your computer and note the Windows version and product key.
-
Find an ISO download for the Windows 7 SP1 (or 8 or 8.1) flavor that matches your OEM install. It will likely be a torrent as MS no longer makes them available unless you have a non-OEM product key. File names and their SHA1 checksums may be found here.
-
Download it, compute the SHA1 checksum (use sha1sum in Linux) and either verify it against the above or do a web search for that checksum to make sure it's legit.
-
Make a VirtualBox VM for Windows 10 with at least 3 GB RAM and 40 GB virtual disk. It's important that it has the CPU support for Win 10 so you can upgrade to that later. In the examples below we assume you named it "WinVM".
-
Attach the ISO to the virtual DVD drive of the new VM and start it up.
-
Install Windows and put in your OEM product key when prompted.
-
After the install is done, activate it as instructed with a phone call to Microsoft.
-
If this is Windows 7, run Internet Explorer inside the VM and install this single update. This installs a newer version of Windows Update which is helpful because the original one is very slow! The new one is also slow, but hopefully not so much.
-
Also at this time download the "sdelete" utility and put it in a new folder somewhere in the VM.
-
Run Windows Update and install all the important and optional updates. This will take hours! There will be some reboots involved. Windows Update appears to have a memory leak so if the VM is short on memory (less than 3-4 GB) I suggest breaking this up into multiple update sessions.
-
You should now have the Windows 10 upgrade offer on your taskbar. Proceed with that upgrade, or skip this step if you don't want to yet.
-
Make sure the new Windows installation is still activated (Settings -> Updates & Security -> Activation).
-
Install VirtualBox Guest Additions into the VM, and any other applications that you care to install before storage optimization.
-
Run Disk Cleanup to remove all unnecessary files that it can possibly remove.
-
Open a command prompt in the VM, go to the directory where you put sdelete and type this command to zero out unused space:
sdelete -z -
Shut down the VM and make a clone of it using the VirtualBox GUI. I named mine "Win10". Because you ran sdelete this will take up much less disk space on the host computer.
-
Do this at the Linux command line to get the hardware UUID of the old VM:
VBoxManage showvminfo WinVM | grep 'Hardware UUID' -
Do the following to set the new "Win10" VM to the same hardware UUID and thus avoiding activation failure.
VBoxManage modifyvm Win10 --hardwareuuid xxxx
... where xxxx is the UUID shown by the previous step. -
Boot up the clone and make sure it still shows as activated.
-
Once you are satisfied the clone is OK, remove the old bloated WinVM machine via the VirtualBox GUI.
For future cloning it should not be necessary to set the hardware UUID again, as step 18 should cause it to be preserved.