Converting a Physical Disk to Virtual
Virtual machine (VM) technology is one of the great features of modern computers. Converting physical machines to virtual (P2V) is possible and usually straightforward.
Some tidbits to be aware:
- A large disk is needed to accommodate the conversion environment.
- The final virtual disk can be shrunk using “dynamic” or “sparse” files, but the initial conversion will be the full size of the original physical disk.
Unlike a physical system, with a virtual disk commonly one goal is to create as small a virtual disk as possible. The basic approach is to clone the existing disk to a much smaller physical disk. That way when using tools such as
dd to create a disk image of the smaller physical disk the virtual disk file size is much smaller than the original physical disk.
Windows specific details:
- Ensure the system is not online in any manner. Pull the Ethernet cable and toggle the wireless radio off.
- Temporarily disable fast boot, the paging file, and hibernation. This is needed for aggressive defragging.
- Perform an aggressive defrag and system clean.
- After defragging and before restoring the paging file, resize the Windows C: partition using Windows
Disk Administrator. Do not be overly aggressive. Leave sufficient partition space for future files and new software.
- When first run inside a virtual machine, Windows might not boot because of the change from physical to virtual hardware. Windows might successfully self-repair, but a repair disk might be needed.
- When first run inside a virtual machine, Windows will try to reactivate unless certain elements of the hardware are emulated.
- Disk2vhd is a dependable tool but is limited to 127 GB or smaller disks.
A caveat with proprietary software, notably software used in educational environments, is the software might be designed to detect running inside a virtual machine. There are articles online how to circumvent that detection, but generally circumventing the detection is challenging. Most of these articles will be about testing malware inside a virtual machine because most malware is designed not to function inside virtual machines. Nonetheless those articles will provide clues about avoiding detection.
The good news with converting is the entire P2V exercise can be repeated as often as desired to tweak the final VM. Do not be afraid of destroying anything. Always keep the original physical disk intact and untouched. Use spare disks for the conversion.