Connect to virtual machine Hyper-V additional virtual hard disk
Hyper-V allows you to connect virtual hard disks not only from when creating a virtual machine, but also any time later. To connect later and the primary disk, for example, with a previously installed guest OS, and any other virtual hard disk – even empty, though with the data. Virtual hard disk formats, VHD and VHDX is working with Hyper-V are created to waste your time with Windows disk management. But Hyper-V is certainly easier to create the hypervisor and then in a single process to connect to the desired virtual machine.
Below we consider the process of connecting to a virtual machine Hyper-V one, in addition to the basic virtual hard disk.
1. The application of the additional virtual hard disks
Different virtual hard disk than the primary, is connected, for example, if the virtual machine you need to increase disk space. Two separate virtual machine disk will allow you to experiment with software designed to work with multiple physical drives – HDD or SSD. The same disk as the additional can be connected to multiple VMS that all of them provide access to data that is stored on the disc.
The VHD or VHDX file extra drive can also be used as a two-way transfer of data between the physical computer and the virtual machines. Connecting and disconnecting virtual hard disks in Windows on a physical machine is carried out by using commands in the context menu invoked on the VHDX and VHD in the system Explorer. This command «Mount» and «Eject» respectively.
2. The choice of controller when connecting an additional disk to the virtual machine
To connect the disk of the virtual machine must be powered off.
Select the desired virtual machine in Hyper-V Manager and open the properties window. This can be done from the context menu, and clicking «Settings» on the right side of the window.
The ability to connect virtual disks in the parameters window appears when you select the disk controller. In our case, for example, the selected virtual machine is generation 2, such as those which provide for the connection of virtual disks only to SCSI controller. Accordingly, working with virtual machines generation 2 in the settings window, do click on the equipment item «SCSI controller». Next, select the connection object – the «Hard drive». And click «Add».
Virtual machine on Hyper-V generation 1 to work with virtual disks connected to the SCSI controller, and IDE controller. To the last is imperative to mount virtual hard drives from which booting a Windows guest. And here is an additional hard disks can be connected either to an IDE controller and SCSI controller. In terms of performance of the virtual machine the controller does nothing. But to the choice of SCSI controller will still have recourse if there is a need to connect to the virtual machine generation 1 more than 4 drives (including the main with an installed guest OS). To connect to each of the 2 possible IDE channels can only be on 2 discs. Total – 4. While the SCSI channel to a virtual machine can connect up to 256 virtual disks. So, each of the 4 SCSI controllers provides connection 64 disks. But in virtual machines generation 1 you cannot boot from drives connected to the SCSI controller.
Virtual machines generation 1 make a choice of controller – SCSI or IDE, depending on the situation. Then also choose the connection object — the «Hard drive». Click «Add».
Further steps will be about the same.
3. Connect to existing virtual machine VHDX and VHD
After clicking «Add» will see the form to add the VHDX for virtual machines generation 2 VHDX or VHD for cars generation 1. Using the browse button in this form to add existing VHD or VHDX disk. After opening it in the Explorer window, click the «Apply» button at the bottom of the settings window.
And, in fact, all you can turn on and test the virtual machine.
4. Create a new VHDX and VHD and connect it to the virtual machine
To to the virtual machine to connect a new hard disk, you will require more steps, such a disk you need to create the Hyper-V tools, then initialize and allocate the disk space of Windows guest tools. Consider all this in detail.
In the form of adding disks VHDX and VHD virtual machine settings to create a new disk, and click «Create».
Will see the welcome window of the wizard. Click «Next».
Window disk format — VHDX or VHD appears only when the virtual machine generation 1. Select the file format of the disk and click «Next.»
File format VHDX for virtual machines generation 2 is provided by default. Because the disc creation starts with the selection of his types – fixed, dynamic, differencing. For each type in this window there is a small certificate confirming their specificity. In our case, we chose dynamic disk type. Click «Next».
Specify the storage location of the disk file on the computer and specify the drive name. Click «Next».
The configuration window of the new disc includes not only creating empty drive with Unallocated space, but also create a new disk with passing up on it structure and data of other disks the physical hard disks and SSD, and virtual VHDX and VHD disks. In the process of copying the contents of a physical disk cannot exclude individual partitions, folders or files. Because this process with large volumes of drives to be painfully slow.
If you copy the contents of entire physical or virtual hard disk is created the disk adopts their structure and, therefore, does not require initialization and allocation of disk space in a separate step. Copy the contents of the existing drives is not our case. In our case we choose the first item, and create an empty disk available, the default size of 127 GB. Click «Next».
Created drive will automatically appear in the number of devices a SCSI or IDE controller and connected to the virtual machine.
But a new blank disc need to initialize and allocate its space. To the consideration of this question will return at the end.
5. Operations on disks connected to a virtual machine
Management of all connected to the virtual machine disks is done in the parameters window. For the selected disk number on the SCSI or IDE controllers available in the following functions:
- «Edit» – function that runs a wizard the hard drive. In this function, is the disk compression, increasing its size, convert disk type to another (dynamic or fixed), and the conversion of disk format VHDX to VHD and back;
- «Test» – open the properties window of the hard disk;
- Overview – replacement of an existing VHDX or VHD disk file to another;
- Delete – delete disk.
Changes such as change of hard disk file, or delete it, you must use the «Apply» button at the bottom of the settings window.
6. Setting boot from an additional hard disk
If the additional hard disk installed guest OS or such there were, for example, during experimentation with the cloning of the disk, the virtual machine with this guest OS can be downloaded. It is necessary to install an additional hard disk first in the queue of the connected SCSI or IDE controllers.
In the virtual machine settings, first switch on the main hard drive, the one that was connected first. Changing the position of his controller from 0 to 1.
Then switch on the secondary hard disk for which you want to set the boot priority. The position of his controller exhibited from 1 to 0. Click the below «Apply»button.
All the VM will boot from the secondary drive. To return all back, you need to travel back.
7. A separate wizard for creating virtual hard disks in Hyper-V
Hyper-V is composed of a separate wizard to create the virtual hard disk format VHDX and VHD. With its help, the disks can be created without any associated connection to specific virtual machines. The wizard starts when you press the «new» button in the right part of the window Hyper-V Manager.
8. Initializing the new hard disk and disk allocation
Finally, let us return to the final stage of connecting to the virtual machine a new hard disk to its initialization and allocation of storage space. For this we need a regular disk management Windows guest.
Run the virtual machine. In operating system, open the disk management utility. It is available in Windows 8.1 and 10 in the context menu on the «start»button.
In Windows 7 you can use the normal service Run. Press Win+R, enter in the service Run the command diskmgmt.msc and click OK.
Windows has no access to the new hard drive. In the window of the disk management tool will see that the second disk is shown as Disk 1, not initialized.
As a rule, the process of connecting a new hard disk is automatically accompanied by a window, it is initialized when you start the disk management tool. If not called on the new drive context menu and choose «Initialize disk».
In the window initialization, you need to choose the partition style of the disk. For virtual machines generation 2, it will be the second option – the GPT style. And in the case of virtual machines generation 1 you need to choose the first MBR. Click «OK».
After initialization, you will see that the new hard drive is shown Unallocated. On the basis of this space you can create partitions on the drive. In our case, we’ll skip the only section. There is Unallocated space on drive context menu and choose «new simple volume».
Next, follow the wizard and places making some changes.
Now the new hard disk virtual machine feature in the section.
It is visible in the system Explorer, and it is possible to put the data.