How to mount Azure Blob Storage inside a Linux machine

From PUBLIC-WIKI
Jump to navigation Jump to search

Get information about credentials file

  • Login to the Azure Portal:
https://portal.azure.com/
  • From the upper search field, write “Storage accounts”
  • From the main pane, click on the target storage account name -> from the main pane, click on Access keys -> write the following details on a temporary location for future use:
  • Storage account name
  • Key 1 -> Key
  • Logoff the Azure portal

Blob Fuse installation

  • Login using SSH to the target Linux machine using privileged account.
  • Follow the instructions below to install the Blobfuse:
https://github.com/Azure/azure-storage-fuse/wiki/1.-Installation
  • Run the command sudo vi /opt/connection.cfg to create config file with the following content:
accountName <account-name>
accountKey <account-key-name >
containerName <container-name>
Note 1: Replace <account-name> with the value of the storage account name from the Azure portal
Note 2: Replace <account-key-name> with the value of the “key” from the Azure portal
Note 3: Replace <container-name> with the target Azure blob storage container name
  • Change the permissions of the connection.cfg file
sudo chown MyUser:MyUser /opt/connection.cfg
sudo chmod 600 /opt/connection.cfg
Note: Replace MyUser with the username you have logged into the Linux machine

Mount phase

  • Run the commands below to mount the Azure blob storage:
sudo mkdir -p /dev/cloudstorage
sudo mkdir -p /dev/cloudstoragetmp
sudo chown -R MyUser:MyUser /dev/cloudstorage/
sudo chown -R MyUser:MyUser /dev/cloudstoragetmp/
blobfuse /dev/cloudstorage --tmp-path=/dev/cloudstoragetmp --config-file=/opt/connection.cfg
Note: Replace MyUser with the username you have logged into the Linux machine
  • To view the content of the Google cloud storage bucket, switch to the new mount point:
cd /dev/cloudstorage

Unmount phase

  • When completing the work on the bucket, from the Linux SSH console, and run the commands below to unmount the Google Cloud Storage:
cd ~
fusermount -u /dev/cloudstorage
  • Logoff the Linux machine

Additional references regarding permanent mount using FSTAB

https://blogs.msdn.microsoft.com/uk_faculty_connection/2019/02/20/blobfuse-is-an-open-source-project-developed-to-provide-a-virtual-filesystem-backed-by-the-azure-blob-storage/
https://github.com/Azure/azure-storage-fuse/wiki/1.-Installation
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux