Azure 上为Liunx VM 挂载File类型的存储。

Posted aladinggao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Azure 上为Liunx VM 挂载File类型的存储。相关的知识,希望对你有一定的参考价值。

1. Create a storage account in Azure, copy the storage account endpoint URL (with postfix of "file.core.chinacloudapi.cn") and storage access key to a temp file.

2. Download and install Azure CLI: https://www.azure.cn/documentation/articles/xplat-cli-install (REBOOT PC after installation).

3. Download and install latest Node.JS: https://nodejs.org/en/#download (Optional, in some case, Azure CLI may encounter problem)

4. Connect to the storage account and create sub-folders by Azure CLI.: https://www.azure.cn/documentation/articles/xplat-cli-connect  

4.1 open Azure CLI (CMD or PowerShell on Windows, Shell on Linux).  

4.2 for US Azure - Connect to Azure: azure login, then follow the instruction to login.     
for China Azure - Connect to Azure: azure login -e AzureChinaCloud -u username -p password  

4.3 Create share first: azure storage share create <nameofshare> -a <storage Accountname> -k <storage account access Key>  

4.4 Create folder for share: azure storage directory create --share <nameofshare> -p <nameofsharefolder> -a <storageAccountname> -k <storage account access Key>  

4.5 (optional for test), upload local file to the folder just created: azure storage file upload ‘c:\a.a‘ <nameofshare> <nameofsharefolder>

5. Mount to Linux server: https://www.azure.cn/documentation/articles/storage-how-to-use-files-linux (note: on that page, there are instruction for different Linux versions).
command for reference: host~$ sudo mount -t cifs //ACCOUNTNAME.file.core.windows.net/myshare /mnt/mountpoint -o vers=3.0,user=<StorageAccountName>,password=<StorageaccountAccessKey>,dir_mode=0777,file_mode=0777

5. Using utility like WinSCP connect to the linux server and check the mountpoint to verify the folder and file is there.

以上是关于Azure 上为Liunx VM 挂载File类型的存储。的主要内容,如果未能解决你的问题,请参考以下文章

在 Azure VM 上使用 cloud-init 挂载数据磁盘失败

通过Azure File Service搭建基于iscsi的共享盘

Liunx系统中磁盘分区及相关指令——实验操作篇(理论基于理论篇)

Liunx 挂载磁盘

如何在 Azure VM 上设置 FTP

Azure上批量创建OS Disk大于30G的Linux VM