Azure

Shared Disk On Azure

Azure allows us to use share a disk for more than one virtual machine. If you have two virtual machines and you want to use one single data disk for storage on both of the virtual machines then it is possible to do that. Azure shared disk allows a managed disk to be attached to multiple virtual machines. 

Please note that by default, one disk can only be attached at a time to one virtual machine but if you have a clustered workload then both of the virtual machines can share a single disk.

For example, if your VM has a SQL Server workload and if it has been clustered then both of these virtual machines can use a single shared disk.

Another thing to note here is that when it comes to shared disks, it can only be enabled for premium and ultra disks that means you cannot use the standard disk as a shared disk.

How it works

Remember if we have a workload that is clustered then all the virtual machines in that cluster can read or write to their attached disk. Cluster application is used to reserve the disk for virtual machines so based on the reservation chosen by the clustered application each virtual machine gets the chance to read and write or use the attached disk.

Benefits

  • Save cost since you only pay for one disk usage
  • Good performance
  • Better IOPS because of premium and ultra disk

Pricing

it is based on the disk you use like if you choose premium or ultra then it depends on that. Please refer to this link to learn more about pricing.

How to create and use Azure shared disk

We need to first create the disk so that we can attach it to our virtual machine while creating it.

Go to Azure Portal and click on create a resource and search for the disk.

Select managed disk and click on create. Fill in all the details like subscription, resource group, location, disk name, and size.

When it comes to size click on change size and choose the disk size which has maximum shares. Please make sure to choose a disk size that supports the use of maximum shares. I am going for 256 GiB which has two max shares and can be shared by two virtual machines.

You can leave everything default and go to the Advanced tab and enable shared disk and in the maximum shares, I will choose two. Now click on review and create and give it some time for deployment. Once the deployment is complete and the disk is ready, now we can attach the disk to the virtual machine.

Now when you’re creating a virtual machine you can go to the Disk tab and under Data Disk you can click on attach an existing disk and it will be attached to your virtual machine. Now all you need to go to both of your virtual machines and initialize the disk to use the disk.

You can refer to this article where I have explained how to create and add a data disk to an Azure virtual machine and the rest of the process is explained in this article.

Now, in this article I explained how to create and attach a shared disk but if you want data on the disk to be shared across virtual machines via shared disk then you need to use the clustered application as I have explained at the beginning of this article. You can use the service available on Windows Server for a file cluster because the cluster application will ensure that the files are available on both machines. It is responsible for ensuring that the data gets shared across the machines.

So in this article, we learned how to create and attach shared disks on Azure for virtual machines and what are the advantages and pricing.

Tags
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close