Mount a Azure Blob storage container on Linux with blobfuse.
Published: 2022-08-02 11:10:00

**Blobfuse is a virtual file system driver for Azure Blob storage. Blobfuse allows you to access your existing block blob data in your storage account through the Linux file system.**

**Follow This Link**

```
https://docs.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux
```

## Install blobfuse on Linux

```
sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm
```
**Similarly, change the URL to .../ubuntu/16.04/... or .../ubuntu/18.04/... to reference another Ubuntu version.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/607v8w5ua8hx5gtjx51r.png)

## Install blobfuse

**On an Enterprise Linux distribution:**

```
sudo yum install blobfuse
```

**(Optional) Use a ramdisk for the temporary path**

**The following example creates a ramdisk of 16 GB and a directory for blobfuse. Choose the size based on your needs. This ramdisk allows blobfuse to open files up to 16 GB in size.**

```
sudo mkdir /mnt/ramdisk
```

```
sudo mount -t tmpfs -o size=16g tmpfs /mnt/ramdisk
```

```
sudo mkdir /mnt/ramdisk/blobfusetmp
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sx8ftvuea6hus07rftvf.png)

## Authorize access to your storage account

**For example, suppose you are authorizing with the account access keys and storing them in a config file. The config file should have the following format:**

> accountName myaccount
> accountKey storageaccesskey
> containerName mycontainer

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2s57ucncibnc61of3ab.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdu4evml9p2iaqt416ek.png)

**Create this file using:**

```
touch /path/to/fuse_connection.cfg
```

**Once you've created and edited this file, make sure to restrict access so no other users can read it.**

```
chmod 600 /path/to/fuse_connection.cfg
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/148du5fspubk5jpi08eb.png)

**Create an empty directory for mounting**

```
mkdir /mycontainer
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzsiuho4k24t2vuvfn20.png)

## Mount

**To mount blobfuse, run the following command with your user. This command mounts the container specified in** 
'/path/to/fuse_connection.cfg' onto the location '/mycontainer'.

```
blobfuse ~/mycontainer --tmp-path=/mnt/resource/blobfusetmp  --config-file=/path/to/fuse_connection.cfg -o attr_timeout=240 -o entry_timeout=240 -o negative_timeout=120
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gjyndx9q82vwg1ybm5pp.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otshou1rnin0i0a61bkw.png)

**Now you permanently mount it using this:**

```
inside vi /etc/fstab
```
**paste the following path shown below as per your naming.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xebrazhhup3tkgw2xkl9.png)

**After rebooting You can see the container mounted too**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3bmc0z5in6ofxzfe2d7r.png)