Migrate files from one SMB Azure file share to another

This article describes how to migrate files between SMB Azure file shares. One common reason to do this is if you need to migrate from a standard file share to a premium file share to get increased performance for your application workload.

Warning

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.

Applies to

File share type SMB NFS
Standard file shares (GPv2), LRS/ZRS Yes No
Standard file shares (GPv2), GRS/GZRS Yes No
Premium file shares (FileStorage), LRS/ZRS Yes No

Migrate using Robocopy

Follow these steps to migrate using Robocopy, a command-line file copy utility that's built into Windows.

  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 will be fast and avoid 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.

  2. Mount both the source and target file shares to the VM. Be sure to mount them using the storage account key to make sure the VM has access to all the files. Don't use a domain identity.

  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).

    robocopy <source> <target> /MIR /COPYALL /MT:16 /R:2 /W:1 /B /IT /DCOPY:DAT
    

    If your source share was mounted as s:\ and target was t:\ the command looks like this:

    robocopy s:\ t:\ /MIR /COPYALL /MT:16 /R:2 /W:1 /B /IT /DCOPY:DAT
    

    You can run the command while your source is still online, but be aware that any I/O will work against the throttle limits on your existing share.

  4. After the initial run completes, disconnect your application from the existing share and run the same robocopy command again. This will copy over all the changes that happened since the initial run, skipping any file data that has already copied over.

  5. After the command completes for the second time, you can redirect your application to the new share.

See also