|
1 | 1 | --- |
2 | | -title: Migrate Files Between SMB Azure file shares |
3 | | -description: Learn how to migrate files from one SMB Azure file share to another using Robocopy, a common migration tool. |
| 2 | +title: Copy Files Between Azure File Shares |
| 3 | +description: Learn how to copy files from one Azure file share to another using common copy tools such as AzCopy and RoboCopy. |
4 | 4 | ms.service: azure-file-storage |
5 | 5 | ms.topic: how-to |
6 | | -ms.date: 12/19/2025 |
| 6 | +ms.date: 01/27/2026 |
7 | 7 | ms.author: kendownie |
8 | 8 | author: khdownie |
9 | | -# Customer intent: As a cloud administrator, I want to migrate files between SMB Azure file shares using Robocopy, so that I can efficiently transition data with minimal downtime and optimize storage performance. |
| 9 | +# Customer intent: As a cloud administrator, I want to copy files between Azure file shares so that I can efficiently transition data with minimal downtime and optimize storage performance. |
10 | 10 | --- |
11 | 11 |
|
12 | | -# Migrate files from one SMB Azure file share to another |
| 12 | +# Copy files from one Azure file share to another |
13 | 13 |
|
14 | | -This article describes how to migrate files between SMB Azure file shares using Robocopy, a common migration tool. You can use this method to migrate between HDD and SSD file shares, file shares using a different billing model, or file shares in different Azure regions. |
| 14 | +This article describes how to copy files between Azure file shares using common copy tools. You can copy files between HDD and SSD file shares, file shares using a different billing model, or file shares in different Azure regions. |
15 | 15 |
|
16 | 16 | > [!WARNING] |
17 | | -> If you're using Azure File Sync, the migration process is different than described in this article. Instead, see [Migrate files from one Azure file share to another when using Azure File Sync](../file-sync/file-sync-share-to-share-migration.md). |
18 | | -
|
19 | | -## Applies to |
20 | | -| Management model | Billing model | Media tier | Redundancy | SMB | NFS | |
21 | | -|-|-|-|-|:-:|:-:| |
22 | | -| Microsoft.Storage | Provisioned v2 | HDD (standard) | Local (LRS) |  |  | |
23 | | -| Microsoft.Storage | Provisioned v2 | HDD (standard) | Zone (ZRS) |  |  | |
24 | | -| Microsoft.Storage | Provisioned v2 | HDD (standard) | Geo (GRS) |  |  | |
25 | | -| Microsoft.Storage | Provisioned v2 | HDD (standard) | GeoZone (GZRS) |  |  | |
26 | | -| Microsoft.Storage | Provisioned v1 | SSD (premium) | Local (LRS) |  |  | |
27 | | -| Microsoft.Storage | Provisioned v1 | SSD (premium) | Zone (ZRS) |  |  | |
28 | | -| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Local (LRS) |  |  | |
29 | | -| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Zone (ZRS) |  |  | |
30 | | -| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Geo (GRS) |  |  | |
31 | | -| Microsoft.Storage | Pay-as-you-go | HDD (standard) | GeoZone (GZRS) |  |  | |
32 | | - |
33 | | -## Migrate using Robocopy |
34 | | - |
35 | | -Follow these steps to migrate using Robocopy, a command-line file copy utility included with Windows. |
| 17 | +> If you're using Azure File Sync, the copy process is different than described in this article. See [Copy files from one Azure file share to another when using Azure File Sync](../file-sync/file-sync-share-to-share-migration.md). |
| 18 | +
|
| 19 | +## Choose a copy tool |
| 20 | + |
| 21 | +This article covers two tools for copying files between Azure file shares: AzCopy and RoboCopy. |
| 22 | + |
| 23 | +**AzCopy** is generally recommended because it uses server-to-server APIs, meaning data is copied directly between storage servers without passing through a local machine. This provides better performance and avoids the need to provision a VM. AzCopy also works with both SMB and NFS file shares and can be run from Windows, Linux, or macOS. If you need to copy files between NFS shares, choose AzCopy. |
| 24 | + |
| 25 | +**RoboCopy** is a Windows command-line utility that uses the SMB protocol for file copy operations. It requires mounting both file shares to a Windows VM. While this adds overhead and cost, you might choose RoboCopy if you need advanced options such as mirroring, granular retry control, or real-time logging. |
| 26 | + |
| 27 | +## Copy files using AzCopy |
| 28 | + |
| 29 | +You can use AzCopy, a command-line utility, to copy files between Azure file shares. AzCopy uses server-to-server APIs, so data is copied directly between storage servers. The instructions are different depending on whether you're using SMB or NFS file shares. |
| 30 | + |
| 31 | +### Properties preserved when copying files with AzCopy |
| 32 | + |
| 33 | +When you use the `--preserve-info` and `--preserve-permissions` flags, AzCopy preserves the following file attributes and permissions: |
| 34 | + |
| 35 | +| Type | Properties (--preserve-info) | Permissions (--preserve-permissions) | |
| 36 | +|------|------------------------------|--------------------------------------| |
| 37 | +| **SMB file shares** | File attributes (ReadOnly, Hidden, System, Directory, Archive, None, Temporary, Offline, NotContentIndexed, NoScrubData), creation time, last write time | ACLs | |
| 38 | +| **NFS file shares** | Creation time, last write time | Owner, group, file mode | |
| 39 | + |
| 40 | +### Copy files between SMB file shares |
| 41 | + |
| 42 | +To copy files between SMB file shares, use the [azcopy copy](/azure/storage/common/storage-use-azcopy-files#copy-files-between-storage-accounts) command. You can authorize access using a SAS token or Microsoft Entra ID. |
| 43 | + |
| 44 | +> [!TIP] |
| 45 | +> These examples enclose path arguments with single quotes (''). Use single quotes in all command shells except for the Windows Command Shell (cmd.exe). If you're using a Windows Command Shell (cmd.exe), enclose path arguments with double quotes ("") instead of single quotes (''). |
| 46 | +
|
| 47 | +#### Copy a single file between SMB file shares |
| 48 | + |
| 49 | +Use the following command to copy a single file from one SMB file share to another. |
| 50 | + |
| 51 | +```azcopy |
| 52 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path><SAS-token>' --preserve-permissions=true --preserve-info=true |
| 53 | +``` |
| 54 | + |
| 55 | +#### Copy a directory between SMB file shares |
| 56 | + |
| 57 | +Use the following command to copy a directory and all of its files from one SMB file share to another. The result is a directory in the destination file share with the same name. |
| 58 | + |
| 59 | +```azcopy |
| 60 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name>/<directory-path><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' --recursive --preserve-permissions=true --preserve-info=true |
| 61 | +``` |
| 62 | + |
| 63 | +#### Copy an entire SMB file share to another storage account |
| 64 | + |
| 65 | +Use the following command to copy an entire SMB file share to another storage account. |
| 66 | + |
| 67 | +```azcopy |
| 68 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' --recursive --preserve-permissions=true --preserve-info=true |
| 69 | +``` |
| 70 | + |
| 71 | +#### Copy all SMB file shares, directories, and files to another storage account |
| 72 | + |
| 73 | +Use the following command to copy all SMB file shares, directories, and files from one storage account to another. |
| 74 | + |
| 75 | +```azcopy |
| 76 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<SAS-token>' --recursive --preserve-permissions=true --preserve-info=true |
| 77 | +``` |
| 78 | + |
| 79 | +### Copy files between NFS file shares |
| 80 | + |
| 81 | +To copy files between NFS Azure file shares, use the [azcopy copy](/azure/storage/common/storage-use-azcopy-files#copy-files-between-storage-accounts) command with the `--from-to=FileNFSFileNFS` flag. The `FileNFSFileNFS` scenario uses the server-to-server copy API. Alternatively, you can use open source file copy tools such as [fpsync and rsync](storage-files-migration-nfs.md#using-fpsync-vs-rsync). |
| 82 | + |
| 83 | +> [!TIP] |
| 84 | +> These examples enclose path arguments with single quotes (''). Use single quotes in all command shells except for the Windows Command Shell (cmd.exe). If you're using a Windows Command Shell (cmd.exe), enclose path arguments with double quotes ("") instead of single quotes (''). |
| 85 | +
|
| 86 | +#### Copy a single file between NFS file shares |
| 87 | + |
| 88 | +Use the following command to copy a single file from one NFS file share to another. |
| 89 | + |
| 90 | +```azcopy |
| 91 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name>/<file-path><SAS-token>' --preserve-permissions=true --preserve-info=true --from-to=FileNFSFileNFS |
| 92 | +``` |
| 93 | + |
| 94 | +#### Copy a directory between NFS file shares |
| 95 | + |
| 96 | +Use the following command to copy a directory and all of its files from one NFS file share to another. The result is a directory in the destination file share with the same name. |
| 97 | + |
| 98 | +```azcopy |
| 99 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name>/<directory-path><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' --recursive --preserve-permissions=true --preserve-info=true --from-to=FileNFSFileNFS |
| 100 | +``` |
| 101 | + |
| 102 | +#### Copy an entire NFS file share to another storage account |
| 103 | + |
| 104 | +Use the following command to copy an entire NFS file share to another storage account. |
| 105 | + |
| 106 | +```azcopy |
| 107 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<file-share-name><SAS-token>' --recursive --preserve-permissions=true --preserve-info=true --from-to=FileNFSFileNFS |
| 108 | +``` |
| 109 | + |
| 110 | +#### Copy all NFS file shares, directories, and files to another storage account |
| 111 | + |
| 112 | +Use the following command to copy all NFS file shares, directories, and files from one storage account to another. |
| 113 | + |
| 114 | +```azcopy |
| 115 | +azcopy copy 'https://<source-storage-account-name>.file.core.windows.net/<SAS-token>' 'https://<destination-storage-account-name>.file.core.windows.net/<SAS-token>' --recursive --preserve-permissions=true --preserve-info=true --from-to=FileNFSFileNFS |
| 116 | +``` |
| 117 | + |
| 118 | +## Copy files using Robocopy |
| 119 | + |
| 120 | +Follow these steps to copy files using Robocopy, a command-line utility included with Windows. You can only use this method with Windows and SMB file shares. |
36 | 121 |
|
37 | 122 | 1. Deploy a Windows virtual machine (VM) in Azure in the same region as your source file share. Keeping the data and networking in Azure is faster and avoids outbound data transfer charges. For optimal performance, we recommend a multi-core VM type with at least 56 GiB of memory, for example **Standard_DS5_v2**. |
38 | 123 |
|
39 | | -2. Mount both the source and target file shares to the VM. To make sure the VM has access to all the files, mount the Azure file share with [admin-level access](storage-files-identity-configure-file-level-permissions.md#mount-the-file-share-with-admin-level-access): either with identity-based access with admin-level Azure RBAC roles (recommended) or with storage account key (less secure). |
| 124 | +1. Mount both the source and target file shares to the VM. To make sure the VM has access to all the files, mount the Azure file share with [admin-level access](storage-files-identity-configure-file-level-permissions.md#mount-the-file-share-with-admin-level-access): either with identity-based access with admin-level Azure RBAC roles (recommended) or with storage account key (less secure). |
40 | 125 |
|
41 | | -3. Run this command at the Windows command prompt. Optionally, you can include flags for logging features as a best practice (/NP, /NFL, /NDL, /UNILOG). Remember to replace `s:\` and `t:\` with the paths to the mounted source and target shares as appropriate. |
| 126 | +1. Run this command at the Windows command prompt. Optionally, you can include flags for logging features as a best practice (/NP, /NFL, /NDL, /UNILOG). Remember to replace `s:\` and `t:\` with the paths to the mounted source and target shares as appropriate. |
42 | 127 |
|
43 | 128 | ```console |
44 | 129 | robocopy s:\ t:\ /MIR /COPYALL /MT:16 /R:2 /W:1 /B /IT /DCOPY:DAT |
45 | 130 | ``` |
46 | 131 |
|
47 | 132 | You can run the command while your source is still online, but IOPS and throughput used for the Robocopy job counts against your file share limits. |
48 | 133 |
|
49 | | -4. After the initial run completes, run the same robocopy command again to copy over all the changes that happened since the initial run. Any data unchanged since the last copy job is skipped. |
| 134 | +1. After the initial run completes, run the same Robocopy command again to copy over all the changes that happened since the initial run. Any data unchanged since the last copy job is skipped. |
50 | 135 |
|
51 | | -5. You can repeat step 4 as many times as you would like before cutting over to the new file share. |
| 136 | +1. You can repeat step 4 as many times as you would like before cutting over to the new file share. |
52 | 137 |
|
53 | 138 | ## See also |
54 | 139 |
|
55 | 140 | - [Transfer data with AzCopy and file storage](/azure/storage/common/storage-use-azcopy-files) |
56 | | -- [Migrate to Azure file shares using RoboCopy](storage-files-migration-robocopy.md) |
57 | | -- [Migrate files from one Azure file share to another when using Azure File Sync](../file-sync/file-sync-share-to-share-migration.md) |
| 141 | +- [Copy files from one Azure file share to another when using Azure File Sync](../file-sync/file-sync-share-to-share-migration.md) |
0 commit comments