Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared drive between Azure Virtual Machines

I have just moved my web site to an Azure Virtual Machine and have been up and running since last weekend. So far I'm very happy with the results and looking forward to taking advantage of Azure further in due course.

I do have what would seem to be a pretty common scenario - and, to my surprise, I can't find an obvious solution. I have a couple of VMs - one my primary server and the other which will be suspended and ready to kick in (manually is fine) if the first one has an issue. I backup my web site to Azure Storage (my backup utility supports saving to an Azure blob). That's the good news.

I had assumed that I could somehow mount the storage blob as a drive, therefore effectively having shared storage across the two VMs. However, to my surprise, I haven't found an obvious way to do that. I have found a third party utility (Gladinet Cloud Desktop) but it seems painfully slow. As I say, I admit I just assumed this would be an easy thing to do.

So, stepping back, what is the most straightforward way to access a storage blob from multiple VMs? I really don't want to set up a private network and then set up network file sharing - that seems so old school :) and places a specific dependency on one specific VM.

Any suggestions?

Thanks.

like image 468
Mark Williams Avatar asked Oct 27 '13 16:10

Mark Williams


People also ask

How do I create a shared drive in Azure?

Create an Azure file share When the Azure storage account deployment is complete, select Go to resource. Select File shares from the storage account pane. Select + File Share. Name the new file share qsfileshare, enter "1" for the Quota, leave Transaction optimized selected, and select Create.

How do I map a drive to Azure VM?

Step 1: Login to your Azure Server. Step 2: Open the file explorer and right on the Network and select Map network drive. Step 3: Now, specify the drive letter for the connection and the folder that you want to connect >> Select connect using different credentials and click on Finish.

How do I add an existing disk to another VM in Azure?

Attach an existing data disk Select your VM from the My virtual machines list on the lab Overview page. On the VM Overview page, select Disks under Settings in the left navigation. On the Disks page, select Attach existing. On the Attach existing disk page, select a disk, and then select OK.


4 Answers

This is now not just possible, but very easy, and it looks just like a filesystem. Check out the new Azure File Service (in preview as of this writing).

http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx

Quoting from the announcement:

"The Azure File service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between VMs using standard and familiar file system APIs like ReadFile and WriteFile."

It is better than just an SMB drive, as the announcement goes on to mention:

"In addition, the files can also be accessed at the same time via a REST interface, which opens a variety of hybrid scenarios. Finally, Azure Files is built on the same technology as the Blob, Table, and Queue Services, which means Azure Files is able to leverage the existing availability, durability, scalability, and geo redundancy that is built into our platform."

like image 64
codingoutloud Avatar answered Oct 02 '22 01:10

codingoutloud


In Azure Resource Manager "Storage Account" you can create a Network File Share that can be Mounted as a Drive to multiple VM's or to computers and devices not on Azure for both Unix, Linux and Windows.

In General, go to your Storage Account ➡ Files ➡ Create FileShare ➡ Name the Share and the Disk Space Quota ➡ Click Connect to obtain the command or windows or linux to mount the share to the respective devices. Note this ONLY WORKS for Local Redundant Storage, not Zone, not Geo Redundant.

https://www.youtube.com/watch?v=SGPJZMaSlis

The video tutorial above shows you step by step how to do this. The only restriction is needed is OS support of the SMB 3.0 protocol which Windows 8 or above does and Windows 2012 or above does. Requires Firewall Port 445 to be opened.

like image 38
CodeCowboyOrg Avatar answered Oct 02 '22 01:10

CodeCowboyOrg


You can access blobs from multiple VMs. This is a very common pattern. What you can't do is mount a drive (stored in a blob) on multiple VMs simultaneously. That is, if you decide to create a VHD disk and attach it to a VM (whether Linux or Windows - doesn't matter), then the blob-backed disk is locked to a VM and that VM can then work with the vhd like it would a local file system.

If, on the other hand, you deal with blobs discretely as single objects, you can easily work with these blobs across any number of VMs.

If you're looking to do something like network sharing (e.g. SMB), you'd either need to use the Azure File Service or stage your own SMB server VM.

In the case where you absolutely must have a mounted file system, yet want to use the file system in a primary/backup fashion, you could always do something via the API to unmount from one VM and remount to another VM. This can be executed via PowerShell (Windows only) or via the cross-platform command-line interface on Linux/Mac/Windows. You'd do this if your primary VM failed for some reason.

like image 39
David Makogon Avatar answered Oct 03 '22 01:10

David Makogon


this are good articles,
I am also looking for that, hope find the right solution. I hope you share your experience here with your choice.

Deciding when to use Azure Blobs, Azure Files, or Azure Disks
https://docs.microsoft.com/en-us/azure/storage/common/storage-decide-blobs-files-disks

there are premium disks
https://azure.microsoft.com/en-us/pricing/details/managed-disks/

Manually create and use a volume with Azure disks in Azure Kubernetes Service (AKS)
https://docs.microsoft.com/en-us/azure/aks/azure-disk-volume Note : An Azure disk can only be mounted to a single pod at a time. If you need to share a persistent volume across multiple pods, use Azure Files.

Performance guidelines for SQL Server in Azure Virtual Machines
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sql/virtual-machines-windows-sql-performance

Deploy a SQL Server container in Kubernetes with Azure Kubernetes Services (AKS)
https://docs.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-2017

enter image description here

like image 44
Valentin Petkov Avatar answered Oct 04 '22 01:10

Valentin Petkov