You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This article references CentOS, a Linux distribution that is nearing End Of Life (EOL) status. Please consider your use and plan accordingly. For more information, see the [CentOS End Of Life guidance](~/articles/virtual-machines/workloads/centos/centos-end-of-life.md).
16
-
[Azure Files](storage-files-introduction.md) is Microsoft's easy to use cloud file system. Azure file shares can be mounted in Linux distributions using the [SMB kernel client](https://wiki.samba.org/index.php/LinuxCIFS).
16
+
17
+
Azure file shares can be mounted in Linux distributions using the [SMB kernel client](https://wiki.samba.org/index.php/LinuxCIFS).
17
18
18
19
The recommended way to mount an Azure file share on Linux is using SMB 3.1.1. By default, Azure Files requires encryption in transit, which is supported by SMB 3.0+. Azure Files also supports SMB 2.1, which doesn't support encryption in transit, but you can't mount Azure file shares with SMB 2.1 from another Azure region or on-premises for security reasons. Unless your application specifically requires SMB 2.1, use SMB 3.1.1.
19
20
@@ -31,21 +32,23 @@ If your Linux distribution isn't listed in the above table, you can check the Li
31
32
uname -r
32
33
```
33
34
34
-
> [!Note]
35
+
> [!NOTE]
35
36
> SMB 2.1 support was added to Linux kernel version 3.7. If you're using a version of the Linux kernel after 3.7, it should support SMB 2.1.
36
37
37
38
## Applies to
39
+
38
40
| File share type | SMB | NFS |
39
41
|-|:-:|:-:|
40
42
| Standard file shares (GPv2), LRS/ZRS |||
41
43
| Standard file shares (GPv2), GRS/GZRS |||
* <aid="install-cifs-utils"></a>**Ensure the cifs-utils package is installed.**
48
-
The cifs-utils package can be installed using the package manager on the Linux distribution of your choice.
51
+
Install the cifs-utils package using the package manager on the Linux distribution of your choice.
49
52
50
53
51
54
# [Ubuntu](#tab/Ubuntu)
@@ -84,7 +87,7 @@ On other distributions, use the appropriate package manager or [compile from sou
84
87
85
88
***The most recent version of the Azure Command Line Interface (CLI).** For more information on how to install the Azure CLI, see [Install the Azure CLI](/cli/azure/install-azure-cli) and select your operating system. If you prefer to use the Azure PowerShell module in PowerShell 6+, you may; however, the instructions in this article are for the Azure CLI.
86
89
87
-
***Ensure port 445 is open**: SMB communicates over TCP port 445 - make sure your firewall or ISP isn't blocking TCP port 445 from the client machine. Replace `<your-resource-group>` and `<your-storage-account>` and then run the following script:
90
+
***Ensure port 445 is open**: SMB communicates over TCP port 445 - make sure your firewall or ISP isn't blocking TCP port 445 from the client machine. Replace `<your-resource-group>` and `<your-storage-account>` and then run the following script:
88
91
89
92
```bash
90
93
RESOURCE_GROUP_NAME="<your-resource-group>"
@@ -110,6 +113,7 @@ On other distributions, use the appropriate package manager or [compile from sou
110
113
If you're unable to open up port 445 on your corporate network or are blocked from doing so by an ISP, you may use a VPN connection or ExpressRoute to work around port 445. For more information, see [Networking considerations for direct Azure file share access](storage-files-networking-overview.md).
111
114
112
115
## Mount the Azure file share on-demand with mount
116
+
113
117
When you mount a file share on a Linux OS, your remote file share is represented as a folder in your local file system. You can mount file shares to anywhere on your system. The following example mounts under the `/media` path. You can change this to your preferred path you want by modifying the `$MNT_ROOT` variable.
114
118
115
119
Replace `<resource-group-name>`, `<storage-account-name>`, and `<file-share-name>` with the appropriate information for your environment:
@@ -128,7 +132,7 @@ sudo mkdir -p $MNT_PATH
128
132
Next, mount the file share using the `mount` command. In the following example, the `$SMB_PATH` command is populated using the fully qualified domain name for the storage account's file endpoint and `$STORAGE_ACCOUNT_KEY` is populated with the storage account key.
129
133
130
134
# [SMB 3.1.1](#tab/smb311)
131
-
> [!Note]
135
+
> [!NOTE]
132
136
> Starting in Linux kernel version 5.0, SMB 3.1.1 is the default negotiated protocol. If you're using a version of the Linux kernel older than 5.0, specify `vers=3.1.1` in the mount options list.
133
137
134
138
```azurecli
@@ -188,14 +192,15 @@ You can use `uid`/`gid` or `dir_mode` and `file_mode` in the mount options for t
188
192
You can also mount the same Azure file share to multiple mount points if desired. When you're done using the Azure file share, use `sudo umount $mntPath` to unmount the share.
189
193
190
194
## Automatically mount file shares
195
+
191
196
When you mount a file share on a Linux OS, your remote file share is represented as a folder in your local file system. You can mount file shares to anywhere on your system. The following example mounts under the `/media` path. You can change this to your preferred path you want by modifying the `$MNT_ROOT` variable.
192
197
193
198
```bash
194
199
MNT_ROOT="/media"
195
200
sudo mkdir -p $MNT_ROOT
196
201
```
197
202
198
-
To mount an Azure file share on Linux, use the storage account name as the username of the file share, and the storage account key as the password. Because the storage account credentials may change over time, you should store the credentials for the storage account separately from the mount configuration.
203
+
To mount an Azure file share on Linux, use the storage account name as the username of the file share, and the storage account key as the password. Because the storage account credentials might change over time, you should store the credentials for the storage account separately from the mount configuration.
199
204
200
205
The following example shows how to create a file to store the credentials. Remember to replace `<resource-group-name>` and `<storage-account-name>` with the appropriate information for your environment.
To automatically mount a file share, you have a choice between using a static mount via the `/etc/fstab` utility or using a dynamic mount via the `autofs` utility.
233
238
234
239
### Static mount with /etc/fstab
240
+
235
241
Using the earlier environment, create a folder for your storage account/file share under your mount folder. Replace `<file-share-name>` with the appropriate name of your Azure file share.
Finally, create a record in the `/etc/fstab` file foryour Azure file share. In the command below, the default 0755 Linux file and folder permissions are used, which means read, write, and execute for the owner (based on the file/directory Linux owner), read and execute for usersin owner group, and read and execute for others on the system. You may wish to set alternate `uid` and `gid` or `dir_mode` and `file_mode` permissions on mount as desired. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation) on Wikipedia.
250
+
Finally, create a record in the `/etc/fstab` file foryour Azure file share. In the command below, the default 0755 Linux file and folder permissions are used, which means read, write, and execute for the owner (based on the file/directory Linux owner), read and execute for usersin owner group, and read and execute for others on the system. You might wish to set alternate `uid` and `gid` or `dir_mode` and `file_mode` permissions on mount as desired. For more information on how to set permissions, see [UNIX numeric notation](https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation).
245
251
246
-
> [!Tip]
252
+
> [!TIP]
247
253
> If you want Docker containers running .NET Core applications to be able to write to the Azure file share, include **nobrl**in the SMB mount options to avoid sending byte range lock requests to the server.
248
254
249
255
```bash
@@ -262,10 +268,11 @@ fi
262
268
sudo mount -a
263
269
```
264
270
265
-
> [!Note]
271
+
> [!NOTE]
266
272
> Starting in Linux kernel version 5.0, SMB 3.1.1 is the default negotiated protocol. You can specify alternate protocol versions using the `vers` mount option (protocol versions are `3.1.1`, `3.0`, and `2.1`).
267
273
268
274
### Dynamically mount with autofs
275
+
269
276
To dynamically mount a file share with the `autofs` utility, install it using the package manager on the Linux distribution of your choice.
270
277
271
278
# [Ubuntu](#tab/Ubuntu)
@@ -345,6 +352,7 @@ After you've created the file share snapshot, follow these instructions to mount
345
352
If the mount fails, see [Troubleshoot Azure Files connectivity and access issues (SMB)](/troubleshoot/azure/azure-storage/files-troubleshoot-smb-connectivity?toc=/azure/storage/files/toc.json).
346
353
347
354
## Next steps
355
+
348
356
See these links for more information about Azure Files:
349
357
350
358
- [Planning for an Azure Files deployment](storage-files-planning.md)
0 commit comments