Hello everyone, my name is Riccardo Raneri
and I'm going to show you a quick way to transform a physical Windows 10 installation into a
virtual one, using only free tools, and fixing a problem that usually occurs when Windows
was originally installed in EFI mode. Let's start checking our disk setup. This is a physical installation of Windows
10; for what it's worth, here I'm using a Microsoft Surface Pro 3, that is basically
a laptop. We have the main "C" drive, then a micro SD
card in the built-in reader, and finally a USB external disk that we will use for our
migration. Here we're using an empty disk, but it's not
mandatory. The target disk has to be in NTFS format,
to avoid file size restrictions that exist in FAT32 partitions. In a nutshell, we're going to copy the entire
system disk to our external USB drive, turning it into a virtual machine that will be identical
to the source one. We will do it with Disk2VHD, a free tool from Sysinternals. The User Interface is very minimalist; it
shows the list of partitions that were found on our system, the same we have seen in File Explorer. In addiction of these, we have two system
partitions that are normally hidden. There is another one that it's not listed
here, but we will talk later about this. Let's start checking only the partitions we
want to be part of the virtualized system we're going to build. Here we want to keep the "C" drive, so we
uncheck the other units: the "D" SD card and the "E" external USB disk. The system partions have to be included, so let's keep the checks on them. Here we choose where to save the big file
that will contain everything. In our case, it's the "E" external drive,
but your target could be different: just choose where to put the file and set a name for it. You can even save it in the same disk you're
duplicating, it will not cause a loop: the process will be slower but - if you have enough
space - it will work. The last important option is "Use VHDX". Just keep it unchecked, because we will use
"VirtualBox" for the virtualization process, and (today) it doesn't support the VHDX format
yet. So don't check this option and make sure you're
creating a VHD file. OK, everything is set, so we can click on
"Create". The process will last a long time, especially
if you're cloning a big drive or your target drive is not like a bat out of hell. In this case we're copying a 250
drive to a USB 2.0 external disk, and it will take almost two hours. With the magic of cinema, we can make these
two hours turn into seconds. When the process is over, we can take a look
to the generated file. Its size should correspond - more or less
- to the sum of the used space in the partitions we chose in Disk2VHD. Well, the file is ready, so we can proceed
with the virtualization. We will use VirtualBox. You can do it also with other softwares, like
the ones from VMWare or Microsoft Hyper-V. Here I'm using VirtualBox because it's free,
it's open source and it has a wide community around, so it's easy to ask help or find useful
informations on the internet. In addictions of this, I already use it for
other projects on Vagrant that I'm sharing with a customer, so this is my choice, but
feel free to experiment with other solutions, if you prefer, and make me know in the comments,
if you would like to share your experience. VirtualBox interface is quite intuitive. Just click on "New" to start a simple wizard
that asks for the name of the Virtual Machine we are creating. Let's name it with something banal, like "My
P2V Windows Machine". You have to select the O.S. family and the
version of the operating system you will use. Here it's Windows 10 64, just like
the source physical machine. Next, the memory we want to assign to the
VM. It's about optimization, you can leave 2 GB
that VirtualBox sets by default and maybe change it laters if you have plenty of RAM
on the host machine and you want your VM to run a little faster. The last step asks you about the hard drive
of this virtual machine. We already have it, so let's choose "use an
existing virtual hard disk file" and, of course, choose the .VHD file we created with Disk2VHD
before. Just click on "create", and your brand new
machine is saved and ready. The physical installation from which we cloned
Windows was installed using a EFI disk setup, so we have to change a setting of the virtual
one, accordingly. Let's open the settings of the VM; in the
"system" section we have a checkbox: "Enable EFI". It has to be activated. Now it's time to try with a first boot. We don't expect to see our VM work on first
try... and in fact, as you can see, we've got the UEFI shell instead of the Windows
boot screen. This is the problem I was telling you in advance,
during the quick introduction of this tutorial. Disk2VHD is not able to do a proper copy of
the EFI partition. This partition is responsible for the initial
boot, so we have to recreate it to get our virtual machine running. Take note that everything we will do from
now on, is needed only for EFI systems. If you are cloning a non-EFI physical machine
(for example a legacy one based on BIOS), the virtual one will simply boot without further
steps. Well, a Windows boot disk is what we need. Maybe you will not have it, because manufacturers
don't ship new computers with the installation media, nowadays. The good news is that we can get an installation
ISO file directly from Microsoft, using their Windows 10 Media Creation Tool, that is freely
downloadable. The tool is very simple, you have only to
choose to create a new installation media because we need an ISO file. Here I'm editing the language just because
it detects my primary language that is italian, but I prefer to have an english install disk
for this tutorial. Again, choose "ISO file" here because we don't
need to install it on an external drive, and choose where to save the ISO. Let's save it on the desktop. The download is huge, so pay attention if
you're using a metered connection. It will take about half an hour, if you're
using broadband. When the download is over, simply click on
Finish, and we ended up with our 3.5 GB ISO file on the Desktop. Now, back on VirtualBox and our dead shell. We open the "Devices" menu and choose "Optical
Drives", then "Choose disk image". Of course, we pick the ISO file we just downloaded,
and finally we request a reset. Here you have to quickly press a key to boot
from the ISO file. And here the Windows 10 installation comes. I just change the keyboard map because I'm
using the italian layout. Of course we don't want to reinstall Windows
on our Virtual Machine, we will use it only to restore the boot EFI partition. A first click on "Troubleshoot" and a second
on "Command prompt". Let's use "diskpart", a microsoft tool for
partition management. When the diskpart prompt appears, type "list
disk". We should have only one disk, so we choose
it typing "select disk 0". Now we want to check the list of the available
volumes, with "list vol". And this is the list: there's the main "C"
drive, that is "Volume 1". We recognize it also by its size; we have
the mounted ISO disk, with letter "D", and then we can see the two system partitions
that we selected in Disk2VHD; here are marked as Volume 2 and 4, without letters. In the middle we have Volume 3, without letter,
200 MB and reported as "RAW" format. This is the EFI partition, and in fact something
is wrong with it because it should be in FAT32 format. Let's fix it. We type "Select vol 3" (but double check you're
selecting the right one, your volume number could be different) and then "Assign letter
L", followed by a colon. I chose "L" simply because it's not in use,
but it's a random choice. Now that we have a letter for this volume,
we can format it. We do it with this command: FORMAT FS -equal
sign- FAT32, *space*, LABEL -equal sign- BOOT, boot between double quotes. The format process will be very quick. Now we can exit diskpart, simply typing exit...
... and move to the newly formatted "L" volume, typing "L" followed by colon. What we're going to do now, is to manually
recreate structure of the boot directory in this volume, that is empty. We create a "efi" directory, typing "md efi"
and then we enter it, with "cd efi". Now that we are in the efi directory, we create
another directory named "microsoft", with "md microsoft". Then we enter the "microsoft" directory with
"cd microsoft" and we create a third directory, named "boot", with "md boot". Finally we enter also into this last directory
with "cd boot" and we are ready to setup the volume. Type "bootrec" * space * /fixboot. It should be immediate. A side note: sometimes, this doesn't work
and you will get an "access is denied" error. In this case you will have to perform some
additional steps that I cover in a little appendix at the end of this video, so just
jump forward if your stucked at this point! If you get the confirmation message, we are
almost done. Type "bcdboot" *space* "C", colon, backslash,
windows *space* slash L en hypen us *space* slash "s" *space* L, colon *space* slash "F"
*space* ALL. This is the "L" of our "L" volume. It's a long command, but it was the last one. After some seconds, you will get a confirmation
message. We're done. Type exit to quit the command line and come
back to the previous screen. Click on "Turn off your PC", and we are back
to the VirtualBox control panel. Click "start" again. This time we will not touch the keyboard because
we want a regular boot from the "C" drive. If you see the dots spinning, it's a good
sign. Let's go in high speed mode. And finally... it just works. Don't be scared if the virtualized system
is very very slow, it depends by many factors but it can be improved and probably doesn't
depends by the host computer or by Virtualbox. For example, here I virtualized a system that
originally runs on an solid state drive, using a traditional external hard disk, and moreover
it's running on USB 2.0 that is not exactly the best in terms of performances. Don't forget to install the VirtualBox Guest
Additions, that will optimize Windows to run in virtualized mode. It installs a set of custom drivers for the
virtual hardware, the video card in particular, and installing it... is always a good idea. We are at the end of our tutorial, I hope
it will be useful for you. Thanks for watching! A note about the "access is denied" error. It can occur when we type the bootrec command. It has happened to me, but it's not the norm. I think it's related to the way Disk2VHD creates
the structure of the virtual disk: something goes wrong and we get a locked EFI partition. The working solution I found is to remove
and re-create it from scratch. List the partition table and identify the
one that contains the EFI volume. You can search for a size correspondence,
in my case it's 200 MB, so I select partition two; then type "delete
partition override". Now, as you can see, partition 2 is gone leaving
an "hole" between partitions one and three. With a simple "create partition primary",
diskpart will fill this gap with a new partition with the same size of the one we just deleted. Now we can proceed with the other steps without
get into the access denied error when you give the bootrec command.