VIRTUAL HARD DISKS

What is Virtual Storage?

When we create a new virtual machine, its hard disk is virtual and the files of it is stored in the physical computer.

Benefits:

  • Storing our files hardware independently.
  • Exporting the virtual machine to an external disk and the people we give that disk can import and use it from anywhere around the world.
  • Restoring our virtual machine with backup and replicate software without data loss.
  • Duplicating our virtual machine.
  • Taking snapshots, so when we make changes into our guest machine and turn back to the beginning easily.
  • Thin provisioning provides allocating the space virtual machine needs initially and grows over time as it needs more.

We can consider the virtual hard disks under two main subjects: format and type.

Format

  • VHD

It is the old hard disk format which is named by the initials of “Virtual Hard Disk”. It supports virtual hard disks up to 2 TB. It is not resilient to consistency issues that caused by power failures.

  • VHDX

This is a new virtual hard disk format that coming with Windows Server 2012 Hyper-V. It has capacity of 64 TB, and is more resistant to breakdowns, especially in cases of unexpected power failure, has the ability to correct its structure in error situations thanks to its log mechanism. It provides larger sector disks than VHD format and larger block sizes for dynamic and differencing disks.

Type

  • FIXED SIZE

The virtual disks created in the Fixed Size type reserve the specified capacity from the physical disk at first even if there is no data yet. It usually used on production servers because it provides the best performance.

  • DYNAMICALLY EXPANDING

This type of disks thin provision i.e. does not reserve the specified capacity at the beginning, but it can expand to the maximum size that can be reached over time. It is usually used on the test servers that not need performance and do not consume unnecessary space on physical disk.

  • DIFFERENCING

When we want to make changes on the data without affecting the original disk, we create a child disk that only contains the changes on the parent disk and we can revert them. It usually used on the multiple virtual machines that all have the same operating systems and applications because it provides saving disk space by containing only the differences.

Creating a New Virtual Hard Disk in Hyper-V

First, click the “New” under the “Action” segment and select “Hard Disk“.

New Virtual Hard Disk appears and gives us some information. Click “Next“.

Then we choose the format of the virtual hard disk. We click the checkbox near the format that we want to choose and click “Next“.

After that we should choose the type of our virtual hard disk that is mentioned above. After selecting, click “Next“.

Then we specify name of our new virtual hard disk and decide where it will be stored if we do not want the default location.

Then we decide whether we want to create a blank disk or copy the contents of another disk to new one. And adjust the size of it if we want to create a new disk.

Finally, the summary screen appears. After reading, if we agree about all the configurations click “Finish“.

Our new virtual hard disk is now ready to use.

HYPER-V CREATING VIRTUAL MACHINE

How to Create a Virtual Machine?

Steps:

  1. Assign a name and location
  2. Assign virtual memory to the Virtual Machine
  3. Configure networking
  4. Connect to a virtual hard disk
  5. Define installation options for the operating system

Create a New Virtual Machine

To create a new virtual machine, click “New” which is under the “Actions” area, and select the “Virtual machine” option.

   

Then, New Machine Wizard, which will be our guide, appears with ‘Before you begin‘ section. You can click ‘Finish‘ to create a new virtual machine with default options or you can click ‘Next‘ to customize the options. We are clicking ‘Next‘ for see the options and understand them.

We can specify the name of our new virtual machine here. Name of my machine will be ‘New Test VM’. And we can change the storage location of your virtual machine by checking the box which says, ‘Store the virtual machine in a different location‘. I will continue with the default option which is: C:ProgramDataMicrosoftWindowsHyper-V

Then we should choose the generation of our virtual machine(VM). Once we create virtual machine, we cannot change its generation.

As you can see in the table below, Generation 2 does not support any 32-bit operating system.

64-Bit Versions

Generation 1

Generation 2

Windows Server 2012 R2

Yes

Yes

Windows Server 2012

Yes

Yes

Windows Server 2008 R2

Yes

No

Windows Server 2008

Yes

No

Windows 10

Yes

Yes

Windows 8.1

Yes

Yes

Windows 8

Yes

Yes

Windows 7

Yes

No

32-Bit Versions

Generation 1

Generation 2

Windows 10

Yes

No

Windows 8.1

Yes

No

Windows 8

Yes

No

Windows 7

Yes

No

After we decide the generation, we have to assign memory to our virtual machine. It can be assigned between 32 MB and 125829 MB. It is okay if you do not know how much virtual memory it should be assigned. Application member recommends an approximate amount of memory, but it is better to allocate a little bit more memory than recommended. The memory can be static or dynamic. If we choose to use dynamic memory, it starts from the ‘Startup memory’ and expands dynamically when needed. There are some operation system and application requirements to use dynamic memory. It would be better to read about it before you click the checkbox. I prefer to use dynamic memory, so I click the checkbox then I click Next.

Then, we should configure virtual networking for connect it to network. Usually, it would be a virtual switch which has physical connection to the internet and is shared between the virtual machines. One option is ‘not connected‘ means not connected to any kind of network. The other option is; connect to default virtual switch. This virtual switch was created when Hyper-V Server was enabled. We will talk about the configuring virtual networking more detailed in another article. For now, select the default switch and click Next.

Then, we will connect a virtual hard disk to our new virtual machine. It provides us storage to operating system that we will install. We have three options; we can create a new virtual hard disk, we can use an existing virtual hard disk if we have, or we can postpone virtual disk attachment. We will create a new virtual hard disk. We can rename it from the first blank, its default name is our virtual machine’s name plus the “.vhdx” extension. Vhdx is the new virtual hard disk format. From the second blank, we can change its storage location which is C:UsersPublicDocumentsHyper-VVirtual Hard Disks by default. And we can assign a size of that hard disk. It is 127 GB by default but as it is mentioned above, it will be dynamically expanding. So, the virtual hard disk starts very small, and after we install an operating system, it will able to expand until it will reach 127 GB. We can take the default option and click Next.


Then, the Wizard presents us the installation options of operating system(OS). The first option is postponing it to another time. The second option is installing media for an OS. It can be done by using a physical CD/DVD drive, which would be on the Hyper-V Server, and then inserting a DVD. Or if an ISO (disc image file) is already downloaded, and there is no DVD, select “Image file(.iso)” and click “Browse” for upload the file that it is going to be booted from this new virtual machine. Or it can be booted from a bootable floppy disk. The last option is installing an OS from a network-based installation server. It is useful when we want to install it automated and remotely like PXE boot. I will give details about PXE Booting in another article, so let’s focus on creating a virtual machine. I am choosing the first option and click Next.

And finally, the completing page appears to show us the summarization of our choices about the new virtual machine. Everything looks okay, so I click “Finish” and my new virtual machine “New Test VM” will be created.

Our first Virtual Machine appears in “Virtual Machines” area.

That is all for now. I hope it would help you. See you on another article.