Hello everyone, today in this blog post we would try to understand Azure windows based virtual machine storage but before moving forward you need the following prerequisites:
- An active Azure account. (If you don’t have an account, you can create a free accountin just a couple of minutes.)
- Create a resource group.
- Create a storage account and virtual machine in the same resource group.
Just like any other computer, virtual machines in Azure use disks as a place to store an operating system, applications, and data. All Azure virtual machines after creation have at least two disks – a Windows operating system disk and a temporary disk as shown below:
The operating system disk is created from an image, and both the operating system disk and the image are virtual hard disks (VHDs) stored as page blob in an Azure storage account’s container. Virtual machines also can have one or more data disks, which are also stored as VHDs. The number of processors, data disk, IOPS and size of the temporary disk depend on the size of the virtual machine you had chosen. Anytime you can change the size of the virtual machine by just navigating to the Size option under virtual machine and choose the plan and hit Select button as shown below, your virtual machine will spin up to the selected VM size in few minutes.
Note that the VM sizes would be available only for the disk type Standard (HDD) or Premium (SSD) of your virtual machine you had chosen at the time of VM creation.
Let’s dive deep into each disk type used by virtual machines:
Operating System Disk
Each virtual machine has one attached operating system disk. It’s registered as a SATA drive and labeled as the C: drive by default. This disk has a max limit of 2 TB. The operating system disk could be the uploaded VHD file containing Windows/ Linux operating system or it could be the image of the operating system within Azure. Both are stored as VHD file in storage account’s container the difference is that the uploaded or copied VHD file can be either read-write or read-only and the VHD file which are created from operating system image within Azure are ready-only.
One of the primary reasons customers use Microsoft Azure Virtual Machines is the fact that Virtual Machines support persistent disks. By persistent it means that data written to these persistent disks will be available through reboots, start/stop, or other lifecycle events. However virtual machines also contain one temporary disk on each VM. The data on these temporary disks may not remain through standard VM lifecycle events. This is because the data for the temporary disks is stored on the host operating system running the hypervisor software while the data for persistent disks is stored in Microsoft Azure Storage. The temporary disk is very useful for data which, you guessed it, is temporary in nature.
A great example of this type of data for Windows is the page file. In fact, when a new Windows VM is provisioned from an image in Azure we configure the page file to be located on this temporary disk. Customers should not use the temporary disk for data that should be persistent.
Data disk is a VHD that’s connected to a virtual machine to store application information, or other information you require to keep. Data disks are enrolled as SCSI drives and are labeled with a letter that you select. Each information disk has a most extreme capacity of 4095 GB.
While creating virtual machine in Azure If you use an operating system image that includes data disks, Azure also creates the data disks when it creates the virtual machine. Otherwise, you add data disks after you create the virtual machine.
You can add data disks to a virtual machine at any time, by attaching the disk to the virtual machine. You can use a VHD that you’ve uploaded or copied to your storage account, or use an empty VHD that Azure creates for you. Attaching a data disk associates the VHD file with the virtual machine by placing a ‘lease’ on the VHD so it can’t be deleted from storage while it’s still attached.
You could also store data securely in virtual machine disk by just enabling the Storage Service Encryption by simply navigating to the Encrypt option of your storage account as shown below:
Note that after enabling Storage Service Encryption only new data will be encrypted and decrypted as you access it, and any existing files in this storage account will remain as they were.
I hope this blog post make you pretty clear about virtual machine storage in Microsoft Azure and pros and cons for each type of storage. We will be back soon with more knowledgeable topics from Microsoft’s technology stack, Thank you.