|
| 1 | +--- |
| 2 | +title: Azure file share – failed to delete files from Azure file share |
| 3 | +description: Identify and troubleshoot the failure to delete files from Azure File Share. |
| 4 | +author: v-miegge |
| 5 | +ms.topic: troubleshooting |
| 6 | +ms.author: kartup |
| 7 | +ms.date: 10/25/2019 |
| 8 | +ms.service: storage |
| 9 | +ms.subservice: common |
| 10 | +--- |
| 11 | + |
| 12 | +# Azure file share – failed to delete files from Azure file share |
| 13 | + |
| 14 | +The failure to delete files from Azure File Share can have several symptoms: |
| 15 | + |
| 16 | +**Symptom 1:** |
| 17 | + |
| 18 | +Failed to delete a file in azure file share due to one of the two issues below: |
| 19 | + |
| 20 | +* The file marked for delete |
| 21 | +* The specified resource may be in use by an SMB client |
| 22 | + |
| 23 | +**Symptom 2:** |
| 24 | + |
| 25 | +Not enough quota is available to process this command |
| 26 | + |
| 27 | +## Cause |
| 28 | + |
| 29 | +Error 1816 occurs when you reach the upper limit of concurrent open handles allowed for a file, on the computer where the file share is being mounted. For more information, see the [Azure Storage performance and scalability checklist](https://docs.microsoft.com/azure/storage/blobs/storage-performance-checklist). |
| 30 | + |
| 31 | +## Resolution |
| 32 | + |
| 33 | +Reduce the number of concurrent open handles by closing some handles. |
| 34 | + |
| 35 | +## Prerequisite |
| 36 | + |
| 37 | +### Install the latest Azure PowerShell module |
| 38 | + |
| 39 | +* [Install the Azure PowerShell module](https://docs.microsoft.com/powershell/azure/install-az-ps) |
| 40 | + |
| 41 | +### Connect to Azure: |
| 42 | + |
| 43 | +``` |
| 44 | +# Connect-AzAccount |
| 45 | +``` |
| 46 | + |
| 47 | +### Select the subscription of the target storage account: |
| 48 | + |
| 49 | +``` |
| 50 | +# Select-AzSubscription -subscriptionid "SubscriptionID" |
| 51 | +``` |
| 52 | + |
| 53 | +### Create context for the target storage account: |
| 54 | + |
| 55 | +``` |
| 56 | +$Context = New-AzStorageContext -StorageAccountName "StorageAccountName" -StorageAccountKey "StorageAccessKey" |
| 57 | +``` |
| 58 | + |
| 59 | +### Get the current open handles of the file share: |
| 60 | + |
| 61 | +``` |
| 62 | +# Get-AzStorageFileHandle -Context $Context -ShareName "FileShareName" -Recursive |
| 63 | +``` |
| 64 | + |
| 65 | +## Example result: |
| 66 | + |
| 67 | +|HandleId|Path|ClientIp|ClientPort|OpenTime|LastReconnectTime|FileId|ParentId|SessionId| |
| 68 | +|---|---|---|---|---|---|---|---|---| |
| 69 | +|259101229083|---|10.222.10.123|62758|2019-10-05|12:16:50Z|0|0|9507758546259807489| |
| 70 | +|259101229131|---|10.222.10.123|62758|2019-10-05|12:36:20Z|0|0|9507758546259807489| |
| 71 | +|259101229137|---|10.222.10.123|62758|2019-10-05|12:36:53Z|0|0|9507758546259807489| |
| 72 | +|259101229136|New folder/test.zip|10.222.10.123|62758|2019-10-05|12:36:29Z|13835132822072852480|9223446803645464576|9507758546259807489| |
| 73 | +|259101229135|test.zip|37.222.22.143|62758|2019-10-05|12:36:24Z|11529250230440558592|0|9507758546259807489| |
| 74 | + |
| 75 | +### Close an open handle: |
| 76 | + |
| 77 | +To close an open handle, use the following command: |
| 78 | + |
| 79 | +``` |
| 80 | +# Close-AzStorageFileHandle -Context $Context -ShareName "FileShareName" -Path 'New folder/test.zip' -CloseAll |
| 81 | +``` |
| 82 | + |
| 83 | +## Next steps |
| 84 | + |
| 85 | +* [Troubleshoot Azure Files in Windows](storage-troubleshoot-windows-file-connection-problems.md) |
| 86 | +* [Troubleshoot Azure Files in Linux](storage-troubleshoot-linux-file-connection-problems.md) |
| 87 | +* [Troubleshoot Azure File Sync](storage-sync-files-troubleshoot.md) |
0 commit comments