|
1 | 1 | --- |
2 | 2 | title: Recommended and useful mountOptions settings on Azure Files |
3 | 3 | description: Learn about the useful and recommended mountOptions settings when you configure the storage class object on Azure Files. |
4 | | -ms.date: 09/14/2024 |
| 4 | +ms.date: 04/25/2025 |
5 | 5 | ms.reviewer: chiragpa, nickoman, v-leedennis |
6 | 6 | ms.service: azure-kubernetes-service |
7 | 7 | #Customer intent: As an Azure Kubernetes user, I want to learn about mount option settings so that I can set up my Azure Files storage class object optimally on my Azure Kubernetes Service (AKS) cluster. |
8 | 8 | ms.custom: sap:Storage |
9 | 9 | --- |
10 | 10 | # Use mountOptions settings in Azure Files |
11 | 11 |
|
12 | | -This article discusses the useful and recommended mounting options when you configure the storage class object on Azure Files. These mounting options help you to provision storage on your Kubernetes cluster. |
| 12 | +This article discusses recommended mount options when you configure the storage class object on Azure Files. These mounting options help you to provision storage on your Kubernetes cluster. |
13 | 13 |
|
14 | 14 | ## Recommended settings |
15 | 15 |
|
16 | | -The following `mountOptions` field settings are recommended for the Kubernetes version and the file and directory mode (permissions): |
| 16 | +The following `mountOptions` are recommended for SMB and NFS shares: |
17 | 17 |
|
18 | | -| Setting | Recommended value | |
19 | | -|----------------------------------|-------------------| |
20 | | -| Kubernetes version | 1.12.2 or later | |
21 | | -| `file_mode` and `dir_mode` value | `0777` | |
22 | | - |
23 | | -The following configuration file is an example of how to set the file and directory permissions: |
| 18 | +**SMB shares** |
24 | 19 |
|
25 | 20 | ```yaml |
26 | | -kind: StorageClass |
27 | 21 | apiVersion: storage.k8s.io/v1 |
| 22 | +kind: StorageClass |
28 | 23 | metadata: |
29 | | - name: azurefile |
30 | | -provisioner: kubernetes.io/azure-file |
31 | | -mountOptions: |
32 | | - - dir_mode=0777 |
33 | | - - file_mode=0777 |
34 | | - - uid=1000 |
35 | | - - gid=1000 |
36 | | - - mfsymlinks |
37 | | - - nobrl |
38 | | - - cache=none |
| 24 | + name: azurefile-csi |
| 25 | +provisioner: file.csi.azure.com |
| 26 | +allowVolumeExpansion: true |
39 | 27 | parameters: |
40 | | - skuName: Standard_LRS |
| 28 | + skuName: Premium_LRS # available values: Premium_LRS, Premium_ZRS, Standard_LRS, Standard_GRS, Standard_ZRS, Standard_RAGRS, Standard_RAGZRS |
| 29 | +reclaimPolicy: Delete |
| 30 | +volumeBindingMode: Immediate |
| 31 | +mountOptions: |
| 32 | + - dir_mode=0777 # modify this permission if you want to enhance the security |
| 33 | + - file_mode=0777 # modify this permission if you want to enhance the security |
| 34 | + - mfsymlinks # support symbolic links |
| 35 | + - cache=strict # https://linux.die.net/man/8/mount.cifs |
| 36 | + - nosharesock # reduces probability of reconnect race |
| 37 | + - actimeo=30 # reduces latency for metadata-heavy workload |
| 38 | + - nobrl # disable sending byte range lock requests to the server and for applications which have challenges with posix locks |
41 | 39 | ``` |
42 | 40 |
|
43 | | -## Other useful settings |
| 41 | +**NFS shares** |
| 42 | +
|
| 43 | +```yaml |
| 44 | +apiVersion: storage.k8s.io/v1 |
| 45 | +kind: StorageClass |
| 46 | +metadata: |
| 47 | + name: azurefile-csi-nfs |
| 48 | +provisioner: file.csi.azure.com |
| 49 | +parameters: |
| 50 | + protocol: nfs |
| 51 | + skuName: Premium_LRS # available values: Premium_LRS, Premium_ZRS |
| 52 | +reclaimPolicy: Delete |
| 53 | +volumeBindingMode: Immediate |
| 54 | +allowVolumeExpansion: true |
| 55 | +mountOptions: |
| 56 | + - nconnect=4 # improves performance by enabling multiple connections to share |
| 57 | + - noresvport # improves availability |
| 58 | + - actimeo=30 # reduces latency for metadata-heavy workloads |
| 59 | +``` |
44 | 60 |
|
45 | | -You might also find the following `mountOptions` settings useful: |
| 61 | +> [!NOTE] |
| 62 | +> The location to configure mount options (mountOptions) depends on whether you're provisioning dynamic or static persistent volumes. If you're [dynamically provisioning a volume](/azure/aks/azure-csi-files-storage-provision#dynamically-provision-a-volume) with a storage class, specify the mount options on the storage class object (kind: StorageClass). If you’re [statically provisioning a volume](/azure/aks/azure-csi-files-storage-provision#statically-provision-a-volume), specify the mount options on the PersistentVolume object (kind: PersistentVolume). If you’re [mounting the file share as an inline volume](/azure/aks/azure-csi-files-storage-provision#mount-file-share-as-an-inline-volume), specify the mount options on the Pod object (kind: Pod). |
46 | 63 |
|
47 | | -| Setting | Description | |
48 | | -|--|--| |
49 | | -| `mfsymlinks` | This setting forces the Azure Files mount (Common Internet File System, or cifs) to support symbolic links. | |
50 | | -| `nobrl` | This setting prevents sending byte range lock requests to the server. It's necessary for certain applications that break with cifs-style mandatory byte range locks. Most cifs servers don't yet support requesting advisory byte range locks. If an application doesn't use this setting and breaks with cifs-style mandatory byte range locks, error messages such as `Error: SQLITE_BUSY: database is locked` might occur. | |
| 64 | +For best practices when using Azure Files, see [Provision Azure Files storage](/azure/aks/azure-csi-files-storage-provision#best-practices). |
51 | 65 |
|
52 | 66 | [!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments