【Azure 存储服务】如何把开启NFS 3.0协议的Azure Blob挂载在Linux VM中呢?(NFS: Network File System 网络文件系统) - LuBu0505/My-Code GitHub Wiki

问题描述

如何把开启NFS协议的Azure Blob挂载到Linux虚拟机中呢?

【答案】:可以使用 NFS 3.0 协议从基于 Linux 的 Azure 虚拟机 (VM) 或在本地运行的 Linux 系统,在 Blob 存储中装载容器 

操作步骤

参考官方文档(Mount Blob storage by using the Network File System (NFS) 3.0 protocol: https://docs.microsoft.com/en-us/azure/storage/blobs/network-file-system-protocol-support-how-to )可以成功的让 NFS 3.0的Blob Mount到VM中。 image.png

准备条件:

1) 开启NFS的Azure Storage Account

2) Linux 虚拟机(本示例中使用的为 UbuntuServer 18.04-LTS)

3) Storage Account与Linux 处于同一虚拟网络中,并且在Storage Account中设置允许访问的子网。

注意事项:

1)在创建Storage Account的时候要先开启ADLS Gen 2.0 (即Enable Hierarchical namespace 和 Enable network file system v3) image.png

  1. 使用PuTTy,SSH登录到VM后,需要使用用root权限执行mount命令。 使用* sudo -i *切换到root目录中。同时,如果没有安装nfs helper会提示bad option消息。只需使用 sudo apt install nfs-common 安装nfs helper。 image.png

3)最终,使用正确的 Storage Account 和 Container 名称替换下面指令中的信息。

mkdir -p /mnt/test

mount -o sec=sys,vers=3,nolock,proto=tcp <storage-account-name>.blob.core.chinacloudapi.cn:/<storage-account-name>/<container-name>  /mnt/test

#1: Replace the <storage-account-name> placeholder that appears in this command with the name of your storage account.

#2:Replace the <container-name> placeholder with the name of your container.

image.png

如果遇见错误,可以参考文档后面的常见错误部分,在本次的实验中,就先后遇见了 Access denied by server while mounting 和 *mount: /mnt/test: bad option;*错误。 image.png

参考文档

Mount Blob storage by using the Network File System (NFS) 3.0 protocol:https://docs.microsoft.com/en-us/azure/storage/blobs/network-file-system-protocol-support-how-to

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

分类: 【Azure 存储服务】

标签: NFS: Network File System 网络文件系统NFS 3.0协议的Azure Blob挂载在Linux VMAzure环境Azure Developer