Using the Azure file sharing service on Linux
?
Using SMB 3.0 to connect to Azure from the user's own data requires an encrypted connection, but the current Linux SMB client is temporarily unsupported, and the Linux open source community is working to add that functionality to the Linux distribution, so for now, Users cannot directly mount the Azure file sharing service in their data center using a Linux machine, nor can they use it across region.
This article is all about Linux virtual machines on Azure, using Azure's file sharing services, and with Azure in the same region. China area Linux versions of Azure File storage can be used as follows:
- Install the relevant SMB tools and drivers on CentOS:
$ sudo yum install samba-client Samba-common cifs-utils
?
?
- After the installation is complete, create a mount directory, such as/mnt/myfileshare:
?
- Once the installation is complete, you can use the Mount command to mount the Azure File shared service, using the following command:
sudo mount -t cifs //存储账户名称. file.core.chinacloudapi.cn /mysharename ./mymountpoint -o vers=3.0,username=myaccountname,password=存储账户key,dir_mode=0777,file_mode=0777
?
For example:
sudo mount-t cifs//mystorageacctfile.file.core.chinacloudapi.cn/myfileshare/mnt/fileshare-o vers=3.0,user= Mystorageacctfile,password= "XXXXX", dir_mode=0777,file_mode=0777
Once created, you can see the files that were previously uploaded in PowerShell:
Test the Mounted directory structure, create a directory, and create a file:
Get the file updates in the shared files directory in PowerShell, and you can see the total newly created directories and files for the shared file system:
- In order to persist file mounts for the Azure file sharing service, you need to add mount points and services to the Fstab file, for example in the previous example:
Mystorageacctfile.file.core.chinacloudapi.cn/myfileshare/mnt/fileshare CIFS vers=3.0,username= mystorageacctfile,password=xxxx,dir_mode=0777,file_mode=0777
?
?
Your azure file share will still connect automatically after the reboot.
?
Using the Azure file service on Ubuntu 15.10
?
1. Install the CIFS driver, in fact in the latest Ubuntu 15.10, the default CIFS drivers and tools have been installed
2. Mount the Azure file store to the specified mount point, as in the CentOS command:
?
sudo mount-t cifs//mystorageacctfile.file.core.chinacloudapi.cn/myfileshare/mnt/fileshare-o vers=3.0,user= mystorageacctfile,password=xxxx,dir_mode=0777,file_mode=0777
3. Add Fstab Auto-start.
Using the Azure file service on SuSE
1. The general process is similar to the Linux process above and requires the installation of Samba-related services:
2. Mount the Azure file store to the specified mount point:
sudo mount-t cifs//mystorageacctfile.file.core.chinacloudapi.cn/myfileshare/mnt/fileshare-o vers=3.0,user= mystorageacctfile,password=xxxx,dir_mode=0777,file_mode=0777
3. Add the configuration fstab so that shared storage can be loaded automatically.
?
Azure file SMB3.0 files sharing Service (4)