Pc Guide

How to create and attach a VHD virtual disk in Windows 10

VHD WindowsOne of the most popular formats for creating virtual disks is VHD, supported by Microsoft and other companies engaged in virtualization programs. These discs are usually mounted on the system using dedicated and commercial programs (with a high cost) available in the professional field but difficult to access in the home, especially if we do not have the possibility to access the advanced tools reserved for companies remotely or from home. and IT engineers.

What many users don’t know is that Windows 10 is enough to immediately connect and read virtual disks in VHD format, without having to install anything else! In this guide we will show you then how to connect a VHD virtual disk in Windows 10, using an advanced tool present within the operating system and unknown to most people, often even by experts.

READ ALSO: How to install Windows on virtual hard disk (VHD) in dual-boot

Mount VHD virtual disk

In the following chapters, we will show you how to immediately load a virtual disk in VHD format on Windows using Disk management. However, mounted on-the-fly disks will not be retained the next time Windows 10 starts or restarts; to make the access to the VHD file permanent we will show you how to create a scheduled operation so that you always have access to the virtual disk without having to repeat the mounting steps every time.

Link VHD files in Windows 10

To connect a virtual disk in VHD format to Windows 10 we open the Start menu at the bottom left, we search disk management, open the first item that will be shown in the search, and, in the new window that will appear, press at the top on Action and then on Collega file VHD.

Collega VHD

In the small window that opens in the center, press the button Browse and let’s go to the path where we stored the virtual disk, select the right file, press on You open, and finally on OK. If we want the disk to be added in read-only mode (ie we can read the files present but we cannot add others or modify them), just check the item Read-only before pressing the button OK.

Now the disk is correctly connected to the system: we will immediately assign a letter to the new partition or new partitions present and we will be able to access the contents of the virtual disk by opening the Start menu, looking for the File Explorer item, and finally taking us to the section This PC, where the new disk will appear in the section Devices and Units. If the disk is not viewable in File Explorer, perhaps a virtual drive letter has not been correctly assigned; to remedy this, we advise you to read our guide Assign / Change letter to disk drives, external drives, USB sticks.

Disconnettere file VHD in Windows 10

If we have mounted a VHD virtual disk and we want to unmount it without having to shut down or restart the PC, all we have to do is open it again Disk management from the Start menu, right-click on the virtual disk name (bottom, left) and use the entry Detach VHD files.

Unplug VHD

A confirmation window will appear where you just need to click on OK to disconnect the virtual disk.

Create a VHD virtual disk from scratch

Gives Computer Management, right-click on Disk Management and this time use the option “Crea file VHDA window will open in which you can specify the VHD file size, format, and location to save it.

As a format, choose the VHDX which is more secure, stable, and which may be larger and more dynamic (i.e. it grows by itself as you add files).

Now, in Disk Management, you will see another disk (Disk 2 in my case) with it written above Not initialized and unallocated. In the gray section of the new virtual disk, right-click and select Initialize Disk and choose whether to use MBR e GPT (MBR is compatible with all versions of Windows so that’s fine).

Right-click in the white area that says not allocated, to select New simple volume, choose the size of the new volume.

As you would with any real disk, even with the virtual disk you can create more partitions if you want, choose a drive letter to assign to the partition, and format the disk in NTFS o FAT32 (better NTFS if you are using the virtual hard disk for backup files from your computer).

Now open Windows Explorer to find the new virtual disk treated and seen as a USB stick.

Set VHD disk autostart

The virtual disks mounted via Disk Management will be automatically unmounted as soon as we restart or shut down the computer, forcing us to repeat the steps seen in the previous chapter at each boot. If we need to access the virtual disk files permanently, we will have to create a scheduled task in Windows 10.

To program the connection of the VHD virtual disk in Windows 10 we open the Start menu again, this time we search Scheduler, we open the corresponding app, and press to the right on the item Create activity.

VHD boot

We will have to act on all the cards shown, so let’s take a few minutes of our time and follow all the indications collected in the following list to the letter:

  • Nel tab General we choose a name of your choice in the field Name, we check the item Run regardless of users’ connection, we also check the item Run with the highest privileges and be sure to select Windows 10 in the field Configure for.
  • Nel tab Activation we press down on New, we select the item On startup in the field Start the business. we check at the bottom of the item Activated and finally press on OK.
  • Nel tab Actions we press down on New, let’s make sure it’s checked Program started in the field Operation and enter the command powershell.exe in the field Program or script.
  • Always in the same window seen a little while ago we insert in the field Add arguments (optional) the command Mount-DiskImage “percorso-file” (taking care to replace the file path with the one where we saved the VHD file).
  • At the end of the configuration, press OK twice to confirm.

The system will ask us for the login credentials of our Windows account in use so that we can perform this type of scheduled activity with the right permissions. At the next reboot or start of Windows 10 let’s go straight to the path File Explorer -> This PC, so as to be able to ascertain the correct functioning of the scheduled task (we will see the virtual disk already mounted at startup).

If we don’t know how to enter the file path inside the command shown above, we can get help from a program like Everything, available for free from the official website.

App Everything

After installing this program on your computer, just start it, look for the files in “.vhd” format in the search bar, right-click on the VHD virtual disk that we want to mount, and press on the item Copy the full path to the clipboard; now we just have to copy the path inside the PowerShell arguments field, as seen a little while ago.

Conclusions

Although it is not a very common operation in the home, it is always interesting to know that Windows 10 offers a series of hidden tools that can also manage virtual disks (a prerogative of business environments), so as to be able to manage this type of situations without having to rely on virtualization programs (the most effective are also paid and cost a lot).

If we have never delved into virtualization, we recommend that you read our guides right away Best programs to virtualize operating systems e Use a virtual machine in Windows 10 with Hyper-V.

Also, in the past, I had also explained how it was possible to clone Windows disk to VHD virtual disk.

Leave a Reply

Your email address will not be published. Required fields are marked *