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

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

问题描述

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

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

 

操作步骤

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

 

准备条件:

1) 开启NFS的Azure Storage Account (官网中说可以选择 Root Squash为All Squash。谨记,最好是选择No Root Squash,不然会遇见Mount成功,但是没有查看/操作 /mnt/test 目录的权限问题)

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)

 

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

 

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.

4) 使用 df -h 查看 FileSystem信息,可以看见挂载Blob的大小。

 

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

Error Cause / resolution
Access denied by server while mounting Ensure that your client is running within a supported subnet. See the Supported network locations.
No such file or directory Make sure to type the mount command and it's parameters directly into the terminal. If you copy and paste any part of this command into the terminal from another application, hidden characters in the pasted information might cause this error to appear. This error also might appear if the account isn't enabled for NFS 3.0.
Permision denied The default mode of a newly created NFS v3 container is 0750. Non-root users do not have access to the volume. If access from non-root users is required, root user must change the mode to 0755. Sample command: sudo chmod 0755 /mnt/<newcontainer>
EINVAL ("Invalid argument") This error can appear when a client attempts to:
  • Write to a blob that was created from a blob endpoint.
  • Delete a blob that has a snapshot or is in a container that has an active WORM (Write Once, Read Many) policy.
EROFS ("Read-only file system") This error can appear when a client attempts to:
  • Write to a blob or delete a blob that has an active lease.
  • Write to a blob or delete a blob in a container that has an active WORM (Write Once, Read Many) policy.
NFS3ERR_IO/EIO ("Input/output error") This error can appear when a client attempts to read, write, or set attributes on blobs that are stored in the archive access tier.
OperationNotSupportedOnSymLink error This error can be returned during a write operation via a Blob or Azure Data Lake Storage Gen2 API. Using these APIs to write or delete symbolic links that are created by using NFS 3.0 is not allowed. Make sure to use the NFS v3 endpoint to work with symbolic links.
mount: /mnt/test: bad option; Install the nfs helper program using sudo apt install nfs-common.

 

参考文档

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

 

相关文章
|
25天前
|
应用服务中间件 Linux nginx
【Azure App Service】基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?
基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?Web App Linux 默认使用的 Nginx 版本是由平台预定义的,无法更改这个版本。
134 77
|
3月前
|
缓存 网络协议 测试技术
NFS挂载信息如何调整?
NFS挂载信息如何调整?
147 3
|
4月前
|
存储 安全 Unix
网络文件系统 (NFS)
【10月更文挑战第12天】
210 5
|
1月前
|
Linux 网络性能优化 网络安全
Linux(openwrt)下iptables+tc工具实现网络流量限速控制(QoS)
通过以上步骤,您可以在Linux(OpenWrt)系统中使用iptables和tc工具实现网络流量限速控制(QoS)。这种方法灵活且功能强大,可以帮助管理员有效管理网络带宽,确保关键业务的网络性能。希望本文能够为您提供有价值的参考。
96 28
|
1月前
|
网络协议 Unix Linux
深入解析:Linux网络配置工具ifconfig与ip命令的全面对比
虽然 `ifconfig`作为一个经典的网络配置工具,简单易用,但其功能已经不能满足现代网络配置的需求。相比之下,`ip`命令不仅功能全面,而且提供了一致且简洁的语法,适用于各种网络配置场景。因此,在实际使用中,推荐逐步过渡到 `ip`命令,以更好地适应现代网络管理需求。
42 11
|
1月前
|
Ubuntu Linux 开发者
Ubuntu20.04搭建嵌入式linux网络加载内核、设备树和根文件系统
使用上述U-Boot命令配置并启动嵌入式设备。如果配置正确,设备将通过TFTP加载内核和设备树,并通过NFS挂载根文件系统。
114 15
|
2月前
|
Ubuntu Unix Linux
Linux网络文件系统NFS:配置与管理指南
NFS 是 Linux 系统中常用的网络文件系统协议,通过配置和管理 NFS,可以实现跨网络的文件共享。本文详细介绍了 NFS 的安装、配置、管理和常见问题的解决方法,希望对您的工作有所帮助。通过正确配置和优化 NFS,可以显著提高文件共享的效率和安全性。
274 7
|
3月前
|
域名解析 网络协议 安全
|
4月前
|
运维 监控 网络协议

热门文章

最新文章