|
| 1 | +--- |
| 2 | +title: On-premises NAS migration to Azure File Sync |
| 3 | +description: Learn how to migrate files from an on-premises Network Attached Storage (NAS) location to a hybrid cloud deployment with Azure File Sync and Azure file shares. |
| 4 | +author: fauhse |
| 5 | +ms.service: storage |
| 6 | +ms.topic: conceptual |
| 7 | +ms.date: 03/19/2020 |
| 8 | +ms.author: fauhse |
| 9 | +ms.subservice: files |
| 10 | +--- |
| 11 | + |
| 12 | +# Migrate from Network Attached Storage (NAS) to a hybrid cloud deployment with Azure File Sync |
| 13 | + |
| 14 | +Azure File Sync works on Direct Attached Storage (DAS) locations and does not support sync to Network Attached Storage (NAS) locations. |
| 15 | +This fact makes a migration of your files necessary and this article guides you through the planning and execution of such a migration. |
| 16 | + |
| 17 | +## Migration goals |
| 18 | + |
| 19 | +The goal is to move the shares that you have on your NAS appliance to a Windows Server. Then utilize Azure File Sync for a hybrid cloud deployment. This migration needs to be done in a way that guarantees the integrity of the production data as well as availability during the migration. The latter requires keeping downtime to a minimum, so that it can fit into or only slightly exceed regular maintenance windows. |
| 20 | + |
| 21 | +## Migration overview |
| 22 | + |
| 23 | +As mentioned in the Azure Files migration overview article, using the correct copy tool and approach is important. Your NAS appliance is exposing SMB shares directly on your local network. RoboCopy, built-into Windows Server, is the best way to move your files in this migration scenario. |
| 24 | + |
| 25 | +- Phase 1: [Identify how many Azure file shares you need](#phase-1-identify-how-many-azure-file-shares-you-need) |
| 26 | +- Phase 2: [Provision a suitable Windows Server on-premises](#phase-2-provision-a-suitable-windows-server-on-premises) |
| 27 | +- Phase 3: [Deploy the Azure File Sync cloud resource](#phase-3-deploy-the-azure-file-sync-cloud-resource) |
| 28 | +- Phase 4: [Deploy Azure storage resources](#phase-4-deploy-azure-storage-resources) |
| 29 | +- Phase 5: [Deploy the Azure File Sync agent](#phase-5-deploy-the-azure-file-sync-agent) |
| 30 | +- Phase 6: [Configure Azure File Sync on the Windows Server](#phase-6-configure-azure-file-sync-on-the-windows-server) |
| 31 | +- Phase 7: [RoboCopy](#phase-7-robocopy) |
| 32 | +- Phase 8: [User cut-over](#phase-8-user-cut-over) |
| 33 | + |
| 34 | +## Phase 1: Identify how many Azure file shares you need |
| 35 | + |
| 36 | +[!INCLUDE [storage-files-migration-namespace-mapping](../../../includes/storage-files-migration-namespace-mapping.md)] |
| 37 | + |
| 38 | +## Phase 2: Provision a suitable Windows Server on-premises |
| 39 | + |
| 40 | +* Create a Windows Server 2019 - at a minimum 2012R2 - as a virtual machine or physical server. A Windows Server fail-over cluster is also supported. |
| 41 | +* Provision or add Direct Attached Storage (DAS as compared to NAS, which is not supported). |
| 42 | + |
| 43 | + The amount of storage you provision can be smaller than what you are currently using on your NAS appliance, if you use Azure File Syncs [cloud tiering](storage-sync-cloud-tiering.md) feature. |
| 44 | + However, when you copy your files from the larger NAS space to the smaller Windows Server volume in a later phase, you will need to work in batches: |
| 45 | + |
| 46 | + 1. Move a set of files that fits onto the disk |
| 47 | + 2. let file sync and cloud tiering engage |
| 48 | + 3. when more free space is created on the volume, proceed with the next batch of files. |
| 49 | + |
| 50 | + You can avoid this batching approach by provisioning the equivalent space on the Windows Server that your files occupy on the NAS appliance. Consider deduplication on NAS / Windows. If you don't want to permanently commit this high amount of storage to your Windows Server, you can reduce the volume size after the migration and before adjusting the cloud tiering policies. That creates a smaller on-premises cache of your Azure file shares. |
| 51 | + |
| 52 | +The resource configuration (compute and RAM) of the Windows Server you deploy depends mostly on the number of items (files and folders) you will be syncing. We recommend going with a higher performance configuration if you have any concerns. |
| 53 | + |
| 54 | +[Learn how to size a Windows Server based on the number of items (files and folders) you need to sync.](storage-sync-files-planning.md#recommended-system-resources) |
| 55 | + |
| 56 | +> [!NOTE] |
| 57 | +> The previously linked article presents a table with a range for server memory (RAM). You can orient towards the smaller number for your server but expect that initial sync can take significantly more time. |
| 58 | +
|
| 59 | +## Phase 3: Deploy the Azure File Sync cloud resource |
| 60 | + |
| 61 | +[!INCLUDE [storage-files-migration-deploy-afs-sss](../../../includes/storage-files-migration-deploy-azure-file-sync-storage-sync-service.md)] |
| 62 | + |
| 63 | +## Phase 4: Deploy Azure storage resources |
| 64 | + |
| 65 | +In this phase, consult the mapping table from Phase 1 and use it to provision the correct number of Azure storage accounts and file shares within them. |
| 66 | + |
| 67 | +[!INCLUDE [storage-files-migration-provision-azfs](../../../includes/storage-files-migration-provision-azure-file-share.md)] |
| 68 | + |
| 69 | +## Phase 5: Deploy the Azure File Sync agent |
| 70 | + |
| 71 | +[!INCLUDE [storage-files-migration-deploy-afs-agent](../../../includes/storage-files-migration-deploy-azure-file-sync-agent.md)] |
| 72 | + |
| 73 | +## Phase 6: Configure Azure File Sync on the Windows Server |
| 74 | + |
| 75 | +Your registered on-premises Windows Server must be ready and connected to the internet for this process. |
| 76 | + |
| 77 | +[!INCLUDE [storage-files-migration-configure-sync](../../../includes/storage-files-migration-configure-sync.md)] |
| 78 | + |
| 79 | +> [!IMPORTANT] |
| 80 | +> Cloud tiering is the AFS feature that allows the local server to have less storage capacity than is stored in the cloud, yet have the full namespace available. Locally interesting data is also cached locally for fast access performance. Cloud tiering is an optional feature per Azure File Sync "server endpoint". |
| 81 | +
|
| 82 | +> [!WARNING] |
| 83 | +> If you provisioned less storage on your Windows server volume(s) than your data used on the NAS appliance, then cloud tiering is mandatory. If you do not turn on cloud tiering, your server will not free up space to store all files. Set your tiering policy, temporarily for the migration, to 99% volume free space. Be sure to return to your cloud tiering settings after the migration is complete, and set it to a more long-term useful level. |
| 84 | +
|
| 85 | +Repeat the steps of sync group creation and addition of the matching server folder as a server endpoint for all Azure file shares / server locations, that need to be configured for sync. |
| 86 | + |
| 87 | +After the creation of all server endpoints, sync is working. You can create a test file and see it sync up from your server location to the connected Azure file share (as described by the cloud endpoint in the sync group). |
| 88 | + |
| 89 | +Both locations, the server folders and the Azure file shares are otherwise empty and awaiting data in either location. In the next step, you will begin to copy files into the Windows Server for Azure File Sync to move them up to the cloud. In case you've enabled cloud tiering, the server will then begin to tier files, should you run out of capacity on the local volume(s). |
| 90 | + |
| 91 | +## Phase 7: RoboCopy |
| 92 | + |
| 93 | +The basic migration approach is a RoboCopy from your NAS appliance to your Windows Server, and Azure File Sync to Azure file shares. |
| 94 | + |
| 95 | +Run the first local copy to your Windows Server target folder: |
| 96 | + |
| 97 | +* Identify the first location on your NAS appliance. |
| 98 | +* Identify the matching folder on the Windows Server, that already has Azure File Sync configured on it. |
| 99 | +* Start the copy using RoboCopy |
| 100 | + |
| 101 | +The following RoboCopy command will copy files from your NAS storage to your Windows Server target folder. The Windows Server will sync it to the Azure file share(s). |
| 102 | + |
| 103 | +If you provisioned less storage on your Windows Server than your files take up on the NAS appliance, then you have configured cloud tiering. As the local Windows Server volume gets full, [cloud tiering](storage-sync-cloud-tiering.md) will kick in and tier files that have successfully synced already. Cloud tiering will generate enough space to continue the copy from the NAS appliance. Cloud tiering checks once an hour to see what has synced and to free up disk space to reach the 99% volume free space. |
| 104 | +It is possible, that RoboCopy moves files faster than you can sync to the cloud and tier locally, thus running out of local disk space. RoboCopy will fail. It is recommended that you work through the shares in a sequence that prevents that. For example, not starting RoboCopy jobs for all shares at the same time, or only moving shares that fit on the current amount of free space on the Windows Server, to mention a few. |
| 105 | + |
| 106 | +```console |
| 107 | +Robocopy /MT:32 /UNILOG:<file name> /TEE /B /MIR /COPYALL /DCOPY:DAT <SourcePath> <Dest.Path> |
| 108 | +``` |
| 109 | + |
| 110 | +Background: |
| 111 | + |
| 112 | +:::row::: |
| 113 | + :::column span="1"::: |
| 114 | + /MT |
| 115 | + :::column-end::: |
| 116 | + :::column span="1"::: |
| 117 | + Allows for RoboCopy to run multi-threaded. Default is 8, max is 128. |
| 118 | + :::column-end::: |
| 119 | +:::row-end::: |
| 120 | +:::row::: |
| 121 | + :::column span="1"::: |
| 122 | + /UNILOG:\<file name\> |
| 123 | + :::column-end::: |
| 124 | + :::column span="1"::: |
| 125 | + Outputs status to LOG file as UNICODE (overwrites existing log). |
| 126 | + :::column-end::: |
| 127 | +:::row-end::: |
| 128 | +:::row::: |
| 129 | + :::column span="1"::: |
| 130 | + /TEE |
| 131 | + :::column-end::: |
| 132 | + :::column span="1"::: |
| 133 | + Outputs to console window. Used in conjunction with output to a log file. |
| 134 | + :::column-end::: |
| 135 | +:::row-end::: |
| 136 | +:::row::: |
| 137 | + :::column span="1"::: |
| 138 | + /B |
| 139 | + :::column-end::: |
| 140 | + :::column span="1"::: |
| 141 | + Runs RoboCopy in the same mode a backup application would use. It allows RoboCopy to move files that the current user does not have permissions to. |
| 142 | + :::column-end::: |
| 143 | +:::row-end::: |
| 144 | +:::row::: |
| 145 | + :::column span="1"::: |
| 146 | + /MIR |
| 147 | + :::column-end::: |
| 148 | + :::column span="1"::: |
| 149 | + Allows to run this RoboCopy command several times, sequentially on the same target / destination. It identifies what has been copied before and omits it. Only changes, additions and "*deletes*" will be processed, that occurred since the last run. If the command wasn't run before, nothing is omitted. The */MIR* flag is an excellent option for source locations that are still actively used and changing. |
| 150 | + :::column-end::: |
| 151 | +:::row-end::: |
| 152 | +:::row::: |
| 153 | + :::column span="1"::: |
| 154 | + /COPY:copyflag[s] |
| 155 | + :::column-end::: |
| 156 | + :::column span="1"::: |
| 157 | + fidelity of the file copy (default is /COPY:DAT), copy flags: D=Data, A=Attributes, T=Timestamps, S=Security=NTFS ACLs, O=Owner info, U=aUditing info |
| 158 | + :::column-end::: |
| 159 | +:::row-end::: |
| 160 | +:::row::: |
| 161 | + :::column span="1"::: |
| 162 | + /COPYALL |
| 163 | + :::column-end::: |
| 164 | + :::column span="1"::: |
| 165 | + COPY ALL file info (equivalent to /COPY:DATSOU) |
| 166 | + :::column-end::: |
| 167 | +:::row-end::: |
| 168 | +:::row::: |
| 169 | + :::column span="1"::: |
| 170 | + /DCOPY:copyflag[s] |
| 171 | + :::column-end::: |
| 172 | + :::column span="1"::: |
| 173 | + fidelity for the copy of directories (default is /DCOPY:DA), copy flags: D=Data, A=Attributes, T=Timestamps |
| 174 | + :::column-end::: |
| 175 | +:::row-end::: |
| 176 | + |
| 177 | +## Phase 8: User cut-over |
| 178 | + |
| 179 | +When you run the RoboCopy command for the first time, your users and applications are still accessing files on the NAS and potentially change them. It is possible, that RoboCopy has processed a directory, moves on to the next and then a user on the source location (NAS) adds, changes, or deletes a file that will now not be processed in this current RoboCopy run. That is expected. |
| 180 | + |
| 181 | +The first run is about moving the bulk of the data to your Windows Server and into the cloud via Azure File Sync. This first copy can take a long time, depending on: |
| 182 | + |
| 183 | +* your download bandwidth |
| 184 | +* the upload bandwidth |
| 185 | +* the local network speed and number of how optimally the number of RoboCopy threads matches it |
| 186 | +* the number of items (files and folders), that need to be processed by RoboCopy and Azure File Sync |
| 187 | + |
| 188 | +Once the initial run is complete, run the command again. |
| 189 | + |
| 190 | +The second time it will finish faster, because it only needs to transport changes that happened since the last run. During this second run, still, new changes can accumulate. |
| 191 | + |
| 192 | +Repeat this process until you are satisfied that the amount of time it takes to complete a RoboCopy for a specific location is within an acceptable window for downtime. |
| 193 | + |
| 194 | +When you consider the downtime acceptable and you are prepared to take the NAS location offline: In order to take user access offline, you have the option to change ACLs on the share root such that users can no longer access the location or take any other appropriate step that prevents content to change in this folder on your NAS. |
| 195 | + |
| 196 | +Run one last RoboCopy round. It will pick up any changes, that might have been missed. |
| 197 | +How long this final step takes, is dependent on the speed of the RoboCopy scan. You can estimate the time (which is equal to your downtime) by measuring how long the previous run took. |
| 198 | + |
| 199 | +Create a share on the Windows Server folder and possibly adjust your DFS-N deployment to point to it. Be sure to set the same share-level permissions as on your NAS SMB share. If you had an enterprise-class domain-joined NAS, then the user SIDs will automatically match as the users exist in Active Directory and RoboCopy copies files and metadata at full fidelity. If you have used local users on your NAS, you need to re-create these users as Windows Server local users and map the existing SIDs RoboCopy moved over to your Windows Server to the SIDs of your new, Windows Server local users. |
| 200 | + |
| 201 | +You have finished migrating a share / group of shares into a common root or volume. (Depending on your mapping from Phase 1) |
| 202 | + |
| 203 | +You can try to run a few of these copies in parallel. We recommend processing the scope of one Azure file share at a time. |
| 204 | + |
| 205 | +> [!WARNING] |
| 206 | +> Once you have moved all the data from you NAS to the Windows Server, and your migration is complete: Return to ***all*** sync groups in the Azure portal and adjust the cloud tiering volume free space percent value to something better suited for cache utilization, say 20%. |
| 207 | +
|
| 208 | +The cloud tiering volume free space policy acts on a volume level with potentially multiple server endpoints syncing from it. If you forget to adjust the free space on even one server endpoint, sync will continue to apply the most restrictive rule and attempt to keep 99% free disk space, making the local cache not performing as you might expect. Unless it is your goal to only have the namespace for a volume that only contains rarely accessed, archival data and you are reserving the rest of the storage space for another scenario. |
| 209 | + |
| 210 | +## Troubleshoot |
| 211 | + |
| 212 | +The most likely issue you can run into, is that the RoboCopy command fails with *"Volume full"* on the Windows Server side. Cloud tiering acts once every hour to evacuate content from the local Windows Server disk, that has synced. Its goal is to reach your 99% free space on the volume. |
| 213 | + |
| 214 | +Let sync progress and cloud tiering free up disk space. You can observe that in File Explorer on your Windows Server. |
| 215 | + |
| 216 | +When your Windows Server has sufficient available capacity, rerunning the command will resolve the problem. Nothing breaks when you get into this situation and you can move forward with confidence. Inconvenience of running the command again is the only consequence. |
| 217 | + |
| 218 | +Check the link in the following section for troubleshooting Azure File Sync issues. |
| 219 | + |
| 220 | +## Next steps |
| 221 | + |
| 222 | +There is more to discover about Azure file shares and Azure File Sync. The following articles help understand advanced options, best practices and also contain troubleshooting help. These articles link to [Azure file share documentation](storage-files-introduction.md) as appropriate. |
| 223 | + |
| 224 | +* [AFS overview](https://aka.ms/AFS) |
| 225 | +* [AFS deployment guide](storage-files-deployment-guide.md) |
| 226 | +* [AFS troubleshooting](storage-sync-files-troubleshoot.md) |
0 commit comments