PageRenderTime 64ms CodeModel.GetById 26ms app.highlight 34ms RepoModel.GetById 1ms app.codeStats 0ms

/articles/storage/storage-how-to-use-files-linux.md

https://gitlab.com/apachipa/azure-content
Markdown | 141 lines | 91 code | 50 blank | 0 comment | 0 complexity | 19287dff08075160903ec5307f46ba5a MD5 | raw file
  1<properties
  2	pageTitle="How to use Azure Files with Linux | Microsoft Azure"
  3        description="Create an Azure file share in the cloud with this step-by-step tutorial. Manage your file share content, and mount a file share from an Azure virtual machine (VM) running Linux or an on-premises application that supports SMB 3.0."
  4        services="storage"
  5        documentationCenter="na"
  6        authors="mine-msft"
  7        manager="aungoo"
  8        editor="tysonn" />
  9
 10<tags ms.service="storage"
 11      ms.workload="storage"
 12      ms.tgt_pltfrm="na"
 13      ms.devlang="na"
 14      ms.topic="article"
 15      ms.date="02/29/2016"
 16      ms.author="minet" />
 17
 18
 19# How to use Azure File Storage with Linux
 20
 21## Overview
 22
 23Azure File storage offers file shares in the cloud using the standard SMB protocol. With Azure Files, you can migrate enterprise applications that rely on file servers to Azure. Applications running in Azure can easily mount file shares from Azure virtual machines running Linux. And with the latest release of File storage, you can also mount a file share from an on-premises application that supports SMB 3.0.
 24
 25You can create Azure file shares using the [Azure Portal](https://portal.azure.com), the Azure Storage PowerShell cmdlets, the Azure Storage client libraries, or the Azure Storage REST API. Additionally, because file shares are SMB shares, you can access them via standard file system APIs.
 26
 27File storage is built on the same technology as Blob, Table, and Queue storage, so File storage offers the availability, durability, scalability, and geo-redundancy that is built into the Azure storage platform. For details about File storage performance targets and limits, see [Azure Storage Scalability and Performance Targets](storage-scalability-targets.md).
 28
 29File storage is now generally available and supports both SMB 2.1 and SMB 3.0. For additional details on File storage, see the [File service REST API](https://msdn.microsoft.com/library/azure/dn167006.aspx).
 30
 31>[AZURE.NOTE] The Linux SMB client doesn’t yet support encryption, so mounting a file share from Linux still requires that the client be in the same Azure region as the file share. However, encryption support for Linux is on the roadmap of Linux developers responsible for SMB functionality. Linux distributions that support encryption in the future will be able to mount an Azure File share from anywhere as well.
 32
 33## Video: Using Azure File storage with Linux
 34
 35Here's a video that demonstrates how to create and use Azure File shares on Linux.
 36
 37> [AZURE.VIDEO azure-file-storage-with-linux]
 38
 39## Choose a Linux distribution to use ##
 40
 41When creating a Linux virtual machine in Azure, you can specify a Linux image which supports SMB 2.1 or higher from the Azure image gallery. Below is a list of recommended Linux images:
 42
 43- Ubuntu Server 14.04+
 44- RHEL 7+
 45- CentOS 7+
 46- Debian 8
 47- openSUSE 13.2+
 48- SUSE Linux Enterprise Server 12
 49- SUSE Linux Enterprise Server 12 (Premium Image)
 50
 51## Mount the file share ##
 52
 53To mount the file share from a virtual machine running Linux, you may need to install an SMB/CIFS client if the distribution you are using doesn't have a built-in client. This is the command from Ubuntu to install one choice cifs-utils:
 54
 55    sudo apt-get install cifs-utils
 56
 57Next, you need to make a mount point (mkdir mymountpoint), and then issue the mount command that is similar to this:
 58
 59     sudo mount -t cifs //myaccountname.file.core.windows.net/mysharename ./mymountpoint -o vers=3.0,username=myaccountname,password=StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
 60
 61You can also add settings in your /etc/fstab to mount the share.
 62
 63Note that 0777 here represent a directory/file permission code that gives execution/read/write permissions to all users. You can replace it with other file permission code following Linux file permission document.
 64
 65Also to keep a file share mounted after reboot, you can add a setting like below in your /etc/fstab:
 66
 67    //myaccountname.file.core.windows.net/mysharename /mymountpoint cifs vers=3.0,username= myaccountname,password= StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
 68
 69For example, if you created a Azure VM using Linux image Ubuntu Server 15.04 (which is available from the Azure image gallery), you can mount the file as below:
 70
 71    azureuser@azureconubuntu:~$ sudo apt-get install cifs-utils
 72    azureuser@azureconubuntu:~$ sudo mkdir /mnt/mountpoint
 73    azureuser@azureconubuntu:~$ sudo mount -t cifs //myaccountname.file.core.windows.net/mysharename /mnt/mountpoint -o vers=3.0,user=myaccountname,password=StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
 74    azureuser@azureconubuntu:~$ df -h /mnt/mountpoint
 75    Filesystem  Size  Used Avail Use% Mounted on
 76    //myaccountname.file.core.windows.net/mysharename  5.0T   64K  5.0T   1% /mnt/mountpoint
 77
 78If you use CentOS 7.1, you can mount the file as below:
 79
 80    [azureuser@AzureconCent ~]$ sudo yum install samba-client samba-common cifs-utils
 81    [azureuser@AzureconCent ~]$ sudo mount -t cifs //myaccountname.file.core.windows.net/mysharename /mnt/mountpoint -o vers=3.0,user=myaccountname,password=StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
 82    [azureuser@AzureconCent ~]$ df -h /mnt/mountpoint
 83    Filesystem  Size  Used Avail Use% Mounted on
 84    //myaccountname.file.core.windows.net/mysharename  5.0T   64K  5.0T   1% /mnt/mountpoint
 85
 86If you use Open SUSE 13.2, you can mount the file as below:
 87
 88    azureuser@AzureconSuse:~> sudo zypper install samba*  
 89    azureuser@AzureconSuse:~> sudo mkdir /mnt/mountpoint
 90    azureuser@AzureconSuse:~> sudo mount -t cifs //myaccountname.file.core.windows.net/mysharename /mnt/mountpoint -o vers=3.0,user=myaccountname,password=StorageAccountKeyEndingIn==,dir_mode=0777,file_mode=0777
 91    azureuser@AzureconSuse:~> df -h /mnt/mountpoint
 92    Filesystem  Size  Used Avail Use% Mounted on
 93    //myaccountname.file.core.windows.net/mysharename  5.0T   64K  5.0T   1% /mnt/mountpoint
 94
 95## Manage the file share ##
 96
 97The [Azure Portal](https://portal.azure.com) provides a user interface for managing Azure File Storage. You can perform the following actions from your web browser:
 98
 99- Upload and download files to and from your file share.
100- Monitor the actual usage of each file share.
101- Adjust the file share size quota.
102- Copy the `net use` command to use to mount your file share from a Windows client.
103
104You can also use the Azure Cross-Platform Command-Line Interface (Azure CLI) from Linux to manage the file share. Azure CLI provides a set of open source, cross-platform commands for you to work with Azure Storage, including File storage. It provides much of the same functionality found in the Azure Portal as well as rich data access functionality. For examples, see [Using the Azure CLI with Azure Storage](storage-azure-cli.md).
105
106## Develop with File storage ##
107
108As a developer, you can build an application with File storage by using the [Azure Storage Client Library for Java](https://github.com/azure/azure-storage-java). For code examples, see [How to use File storage from Java](storage-java-how-to-use-file-storage.md).
109
110You can also use the [Azure Storage Client Library for Node.js](https://github.com/Azure/azure-storage-node) to develop against File storage.
111
112## Feedback and more information ##
113
114Linux users, we want to hear from you!
115
116The Azure File storage for Linux users' group provides a forum for you to share feedback as you evaluate and adopt File storage on Linux. Email [Azure File Storage Linux Users](mailto:azurefileslinuxusers@microsoft.com) to join the users' group.
117
118## Next steps
119
120See these links for more information about Azure File storage.
121
122### Conceptual articles and videos
123
124- [Azure Files Storage: a frictionless cloud SMB file system for Windows and Linux](https://azure.microsoft.com/documentation/videos/azurecon-2015-azure-files-storage-a-frictionless-cloud-smb-file-system-for-windows-and-linux/)
125- [Get started with Azure File storage on Windows](storage-dotnet-how-to-use-files.md)
126
127### Tooling support for File storage
128
129- [Transfer data with the AzCopy Command-Line Utility](storage-use-azcopy.md)
130- [Create and manage file shares](storage-azure-cli.md#create-and-manage-file-shares) using the Azure CLI
131
132### Reference
133
134- [File Service REST API reference](http://msdn.microsoft.com/library/azure/dn167006.aspx)
135
136### Blog posts
137
138- [Azure File storage is now generally available](https://azure.microsoft.com/blog/azure-file-storage-now-generally-available/)
139- [Inside Azure File Storage](https://azure.microsoft.com/blog/inside-azure-file-storage/)
140- [Introducing Microsoft Azure File Service](http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx)
141- [Persisting connections to Microsoft Azure Files](http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/27/persisting-connections-to-microsoft-azure-files.aspx)