A couple of weeks, a 12-15 years old desktop PC of mine died. After a quick investigation, it appeared to have some sort of electrical problem around the mainboard and the power supplier.
I took a full week, to evaluate what to do. From the hardware point of view, it didn’t deserve any replacement.
What is annoying me, is the 180€ of Windows 10 Professional (32-bit) license that I would lose in the case of retirement.
After a couple of days of preparations, I decided to clone the system partition into a Virtualbox VM.
By using Windows 10 PC, and free programs:
- clone the system hard disk to a virtual one
- create the virtual machine to use it
- assist the OS to accept and adapt to the changes
Before doing anything, you have to take care of the following prerequisites:
- you need your Windows serial number to register it again if it will be requested. Since you may not have it, you get it by running a utility like Nirsoft ProduKey.
- the hard disk hosting the system partition shall be still working, and you shall be able to plug it in a PC (by a free slot, a USB-SATA/IDE converter, …)
- if you plan to host this VM into a Windows 10 64 bits PC, you have to turn off Core Isolation from Windows Security settings.
- you have enough free space Gb into your working PC to be able to work with disk images.
Cloning a physical partition to a virtual one
The first step is to download Disk2vhd from MS SysInternal.
This small utility will create a .VHD (Hyper-V file format) from our ‘dead’ physical partition.
Even if I can still use it directly by a Virtualbox VM, I want to have more control over the disk type, size…
At this point we will need to use directly vboxmanage, the Virtualbox administrative console.
To create a proper disk according to our wishes directly by the command line below:
vboxmanage createmedium disk --filename <new disk full path filename> [--size <megabytes>|--sizebyte] [--format VDI|VMDK|VHD] [--variant Standard,Fixed,Split2G,Stream,ESX]
in my case:
vboxmanage createmedium disk --filename <new disk full path filename> --size 65535 –format VMDK
then fill it with .VHD contents by the following command line:
vboxmanage clonemedium disk <inputfile .vhd> <created file> --existing
Make a copy of the filled disk to avoid repeating the process too far in case the things went bad.
Creating a VM to use the cloned disk
Now we can create a new VM, use the new converted disk.
In my case: 4 processors, 4 GB ram, the new disk, and a network card.
Turn it on, and wait for the login page.
In my case, Windows10 took about 15 minutes to adapt itself to the new hardware.
Then I followed the following steps:
- adjust the swap file, and reboot
- install the VirtualBox Extensions, and reboot
- in Windows 10, go to Settings -> Privacy -> Background apps, and temporarily disable them all. This will prevent slowdowns while MS Store updates every present app.
Restore them at your favorite settings, once you completed all the cleanup tasks.
- activate Windows again, if requested
- uninstall every driver and program not needed anymore.
Programs such Iobit Uninstaller can be a good help.
- start the Device Manager, inspect the devices, uninstall and delete any devices linked to the old hardware.
- if you wish to inspect and disable quite hidden program debris like services, device drivers, … programs like MS SysInternals Autoruns can ease the task.
- remove hibernation mode by typing the following command from an administrative command prompt:
powercfg /h off
- go to Power Settings, set it to performance or balanced, and remove any ‘hibernation‘ or ‘suspend‘ (or another power-saving setting) from the basic & advanced options.
- apply any system update.
- let the VM run free for a couple of hours to allow the OS to fix to the new environment.
During all these steps is very useful saving several snapshots of the VM. In this way we will be able to roll back to any fatal action that we may do.