LoginSignup
2
0

More than 3 years have passed since last update.

WSL環境にblobfuseをインストールしてAzure Storageにアクセスする

Last updated at Posted at 2021-01-28

はじめに

WSL/Linux環境からAzure Storage (Azure blob storageやAzure data lake storage gen2)にアクセスしたい場合が多いのではないのでしょうか。
そういった場合にAzure StorageをLinux環境へマウントできるBlobfuseを使うとはかどります!

Microsoftのリポジトリを追加する

Ubuntu 20.04 環境の場合:

curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod
sudo apt-get update

blobfuseをインストール

sudo apt-get install blobfuse

マウントの準備

バッファとして使用するディレクトリを作成する。

sudo mkdir /mnt/resource/blobfusetmp -p
sudo chown <username> /mnt/resource/blobfusetmp

ストレージアカウントの資格情報ファイルを作成していきます。

vim ~/fuse_connection.cfg

任意のテキストエディタでファイルを開いたら、次の内容を書き込みます。

accountName <myaccount>
accountKey <storageaccesskey>
containerName <mycontainer>

他のユーザーが見えないようアクセス権を制限します。

chmod 600 ~/fuse_connection.cfg

マウント用の空ディレクトリを作成します。

mkdir ~/azurestorage

マウントします

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

アンマウント

sudo fusermount -u azurestorage

でアンマウントできます。

参考文献

https://docs.microsoft.com/ja-jp/windows-server/administration/Linux-Package-Repository-for-Microsoft-Software
https://qiita.com/mihomiporin1110/items/177e4f3e2f42ef86becf

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0