Deploying Azure Virtual Machines with Smaller OS Disks
Microsoft recently made it possible to deploy a virtual machine from the Azure Marketplace with a smaller-than-usual OS drive. This helps you to reduce your storage costs.
Passwords Haven’t Disappeared Yet
123456. Qwerty. Iloveyou. No, these are not exercises for people who are brand new to typing. Shockingly, they are among the most common passwords that end users choose in 2021. Research has found that the average business user must manually type out, or copy/paste, the credentials to 154 websites per month. We repeatedly got one question that surprised us: “Why would I ever trust a third party with control of my network?
Changes with Managed Disks
Microsoft introduced Managed Disks earlier this year. Several technical new features were enabled by Managed Disks but this came at a cost, literally.
If you use unmanaged disks or Standard Storage, then you pay for the amount of data that is stored in the virtual hard disks or Hyper-V VHD files. You do not pay for the size of the disks. Let’s look at what this means. If you deployed a virtual machine on Standard Storage from a Microsoft image, then the OS disk was 127GB in size. Ignore the disk size that the Microsoft pricing pages and tools use because that refers to the free temp drive. The cost of the virtual machine does not include the cost of the OS disk or data disks, so they must be accounted for. If the C: drive has 20GB of files, then you pay for 20GB of page blob and disk, not for 127GB of disk.
Note, Premium Storage is always charged based on the size of the disk, even with unmanaged disks.
If you added 4 x 1023GB of unmanaged data disks to that virtual machine and created a 3.99TB volume using a simple virtual disk from a Storage Spaces disk pool that has 4 times the performance of a single disk, then the same guidance applies. If I place a 200GB database into that 3.99TB volume, then I pay for 200GB of page blob and disk, not for 4 x 1023GB of disks.
Why did Microsoft go with 127GB? Create a new virtual machine using Hyper-V Manager and you will note that the default new disk size is 127GB.
However, this all changes with managed disks. With managed disks, we pay for the size of the disk. The amount of data contained within the disk is irrelevant. I have to pay for a 127GB disk for every virtual machine deployment from the Azure Marketplace, even if there are only 20GB of files.
Smaller Managed Disks
The days of deploying big disks and worrying about data size are over with Managed Disks, which are probably the type of disk that we should use from now on. We need to pay more attention to data size so that we are sizing disks appropriately.
What about the OS disk? We probably have 100GB of wasted and paid for disk space there. The cost is $2.95 for an S30 in East US. Some would be tempted to put data onto the OS disk but that is a bad idea. Some applications like Active Directory do not support this and data disks offer better performance and flexibility.
Instead, there are two things to note with managed disks. First, Microsoft gave us two small sizes. We can deploy small data disks using these sizes and minimize the spending on storage:
- S4: Up to 32GB — costing $0.77 in East US
- S6: Up to 64GB — costing $1.51 in East US
Next, Microsoft has shared a number of new images for Windows Server 2008 R2 SP1, Windows Server 2012, Windows Server 2012 R2, and Windows Server 2016 with a Server Core option and smaller OS disks. These images are listed as [smalldisk] in the Marketplace.
If you deploy a [smalldisk] image, your virtual machine will have a 30GB OS disk instead of a 127GB one. That might seem small but remember:
- All data should go onto data disks.
- The paging file resides on the zero-cost temp drive.
This will reduce the cost of the OS disk from $2.95 to $0.77 and you can use the savings to deploy a data disk for your data. This was a best practice anyway.
Deploying [smalldisk] Images
If you want to deploy a [smalldisk] image in the Azure Portal, you should start in the Marketplace. Search for [smalldisk] and a list of available images will appear.
Select an image and complete the usual Create Virtual Machine wizard. Note that if you use other methods to create a virtual machine in the Azure Portal, you will not get the [smalldisk] options.