How many times we was in situation where our physical drives ran out of space? The only option was to replace it with something bigger and then move all of the data over successfully. What a waste of time.
When working with virtual machines that are running on virtual drives we have the ability to expand those drives when ever needed. Virtual drive is just a file so it is much easier to manipulate with it. There are 4 different types of virtual drives:
1. Fixed disk – A fixed disk is like a static disk that has a fixed size and doesn’t grow over time. It can provide better performance as compared to dynamic disks. The larger disk you create, the longer time it will take.
2. Dynamic disk – as they sound, they get changed over time. If we create 100 GB dynamic disk, it won’t immediately deduct the same amount of disk space from the physical storage. It will get created with a very small size and it will keep growing as you put data on this disk.
3. Differencing disk – (called child disk), it is based on a linked parent disk. It stores changes made to parent disk. It comes into use when we take a snapshot of a VM, where after creating the snapshot, Hyper-V leaves the first parent VHD intact and creates a new child disk that gets linked to the parent virtual hard disk. This type of disk is never recommended for production.
4. Pass-through disk – It is a physical disk connected to the host machine as storage device.
There are 3 formats which we can choose: VHD, VHDX and VHD Set
- VHD – Max size is 2 TB, native disk support of 4 KB and secure offload data transfer is not supported. No protection against corruption during power outages. On fly resizing is not available which means that you can’t grow or shrink the disk without shutting down the VM. Gen 1 VMs can use both VHD and VHDX files
- VHDX – Max size is 64 TB, native disk support of 4 KB and secure offload data transfer is supported. Better resiliency via protection against corruption during power outages, Disk resizing (on fly) is available. Gen 2 VMs can use only VHDX files
- VHD Set – New feature in windows server 2016, it is used for sharing virtual hard disks between several VMs. VHD Set is very usful in deployment of guest clusters. You will need to run Windows Server 2016 to be able to use VHD Set. When you create VHD Set disk 2 files are created:
- avhdx file that contains data, it can be fixed or dynamic, (I will create dynamic)
- vhds – which contains metadata (It coordinate information between guest cluster nodes)
So let’s see how to create a new harddrive.
Inside Hyper-V Manager, right-click on the name of your Hyper-V server and choose New -> Hard Disk
Before you begin page will pop-up. Click next
On Choose Disk Format page, select which disk format you want to create and click next
On Disk Type page, choose what type of virtual disk do you want to create, Next
Specify Name and Location and click Next
On Configure Disk page, I will create a new drive, click next and finish.
Let’s see how we can add this new created drive to a virtual machine.
Right-Click on VM and select Settings
Inside settings, click on SCSI Controller and click on Hard Drive –> Add
New Hard Drive Session will open. Any location that already has a disk will be marked as In Use. I will choose 3. Last step is to Browse and find the disk file which we want to attach. Click Apply and OK
Inside VM you will need to open Disk management and first bring this new disk online. Right-Click on it and select Online
Next step is to Initialize it, Right-Click on it and select Initialize Disk
New window will pop-up. Here we need to choose if we want to use MBR or GPT partition. I will choose MBR. Click OK
Last thing is to create a new volume. Right click in unallocated space and click on New Simple Volume
New simple volume wizard will pop-up. Click next 2 times. On Assign Drive letter chose one (In my case it will be E:) and click next
On Format Partition Page, choose Volume Label and (if not selected by default) check Perform a quick format and click next and finish.
Our new drive is ready for use.