How to migrate lightning fast from on-premise file server to Azure Fileshare with AZCopy
Posted On November 24, 2023
When you want to migrate from an on-prem file server to an Azure File Share, you want to do it as fast as possible. There are multiple ways to achieve such an migration. This could be with Azure Storage Explorer, mount the SMB share and go for a traditional migration like xcopy, or we can use AzCopy to perform the migration. In this manual I will be showing you how to copy the files, but also to run a delta copy.
On of the advantages of AzCopy is that there is no bandwidth limit to ingest the copied data. As you can see above I reached the full 1Gbit of my ISP connection. By default, the sync command compares file names and last modified timestamps, making it critical to have your system time synced with the internet time zone. Before we can start, let’s make sure to have the following requirements:
AzCopy uses a lot of memory, make sure to have at least 8Gb of RAM in your system to reach high performance.
STEP 1:Get Shared Access Signature
Before we are going to copy the data, we will need to create a Shared Access Signature to get access to the file shares. From the target Storage Account go to Shared access signature, and make sure to check the boxes under Allowed resource types. For security purposes provide an end data for the key to be valid. Ideally give it an end date just past your intended migration date.
Last, make sure to add the Public IP adres of the fileservers internet provider.
Now copy the File service SAS URL.
STEP 2: Create the script:
Now copy the AzCopy file that you downloaded to your on-prem file server. For this manual I saved it on the D: drive.
Now we are going to create the the command to synchronize the data. To following syntax can be used:
azcopy sync '<local-directory-path>/' 'https://<storage-account-name>.blob.core.windows.net/<File Share>/<File service SAS URL>' --recursive
To give you an example, the command should look like this, I copied my State of Trance music files for this manual 😉 . Make sure to end your URL with a backslash, and your target URL with a forward slash.