Azure blob storage is one of the popular services from Azure leveraged by customers, giving them the ability to store unstructured data at nearly limitless scale. It is an object storage service used by enterprises in a wide variety of use cases: backup, disaster recovery, long term data archival, logging and analytics, to name a few. Though these are some of the most popular use cases for Azure Blob, there is a less common use case for it: as a file system to be mounted on Linux machines, a handy tool to have in your Linux on Azure deployment.
In this blog, we will walk you through the process of mounting Azure Blob as a file system and discuss the advantages and disadvantages of this approach.
Jump down using the links below, or read on for the full details:
Object storage uses a flat namespace that may not fit in well with all use cases. Drives mounted as file systems integrate well into the operating system. Applications can access this storage without an additional overlay of transfer protocols or security configurations. In such cases, using Azure Blob storage as a drive helps quickly create a distributed file store without additional operational overhead.
Consider the case of legacy applications that are being migrated to the cloud using a lift and shift approach that need access to file shares. Refactoring a legacy code base to incorporate object storage APIs is challenging and often out of scope for such deployments. By using Azure Blob storage as a file system, these applications can be migrated without touching the code base. The applications will continue to work as they used to work on-prem as the Azure Blob will be mounted as a drive in a transparent manner as a local drive path.
Mounting Azure Blob as a drive enables its usage as a shared file system, giving multiple servers concurrent access. This is helpful for the type of files that need to be shared between different systems, such as common configuration and log files for web applications.
Let’s look at some of the options available to mount Azure Blob as a local drive on Linux-based systems using Azure Virtual machines.
BlobFuse is an open source tool that uses Azure storage APIs to implement file system operations. In order to accomplish this, the tool interacts with the Linux FUSE kernel module via the open source fuse3 library in the backend.
Though it is an open-source tool, BlobFuse is endorsed by Microsoft to be used as a solution for mounting Azure storage as a file system in Linux. The tool supports all basic file system operations as well as local caching for files for improved performance.
Azure Blob storage supports the NFS 3.0 protocol which can be used to mount blobs as NFS file shares in Linux machines. This requires a hierarchical namespace to be enabled while creating the storage. The file shares can be connected to Azure virtual machines as well as on-premises storage systems when hybrid connectivity is enabled.
Azure Blob can be mounted as a file system folder in any Linux distribution using BlobFuse. In this demo, we’ll show how to mount it in an Ubuntu machine in Azure.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install libfuse3-dev fuse3
sudo apt-get install blobfuse2
sudo mkdir /mnt/resource/blobfuse2tmp -p
sudo chown <yourusername> /mnt/resource/blobfuse2tmp
mkdir ~/blobcontainer
allow-other: true
logging:
type: syslog
level: log_debug
components:
- libfuse
- file_cache
- attr_cache
- azstorage
libfuse:
attribute-expiration-sec: 120
entry-expiration-sec: 120
negative-entry-expiration-sec: 240
file_cache:
path: /mnt/resource/blobfuse2tmp
timeout-sec: 120
max-size-mb: 4096
attr_cache:
timeout-sec: 7200
azstorage:
type: block
account-name: blobfusetest2044
account-key: xxxxxx
endpoint: https://blobfusetest2044.blob.core.windows.net/
mode: key
container: myfilesystem
sudo blobfuse2 mount ~/blobcontainer --config-file=./config.yaml
cd ~/blobcontainer
mkdir temp
echo "hello world" > temp/new.txt
While it is possible to mount Azure Blob storage as a file share using BlobFuse for some use cases, there are certain caveats to the approach that you need to keep in mind.
Considering factors such as IOPS requirements, performance, file access frequency. etc., you should evaluate whether mounting Blob storage as a file system is a good fit solution for your application.
NetApp Cloud Volumes ONTAP offers a simpler way for using file systems on Azure storage. Cloud Volumes ONTAP brings in the power of trusted NetApp storage management capabilities to the cloud and delivers advanced storage efficiencies, data protection, and optimization in Azure.
Cloud Volumes ONTAP has a wide range of features to power your file sharing workloads:
In this blog we saw how to set up Azure Blob as a file system using BlobFuse. This can be a useful deployment option for specific use cases, such as creating distributed file systems, and storing logs, common configuration files, media files etc. However, due to the inherent limitation of using object storage as a file system, your mileage may vary.
While this approach can be handy when migrating legacy applications to the cloud which can’t be modified to use object storage directly, the overall performance of the solution may not align with enterprise LOB goals.
If you’re looking for a better way to deliver shared file storage in the cloud, try Cloud Volumes ONTAP. With native capabilities that can leverage Azure Blob storage, you’ll be able to deploy a file system that can gain important data protection benefits, better storage efficiency, and improved overall storage costs.