All Products
Search
Document Center

File Storage NAS:Migrate data by using Robocopy

Last Updated:Jan 30, 2026

This topic describes how to migrate data between Server Message Block (SMB) file systems of File Storage NAS by using Robocopy.


Overview

When to use this method

Scenario

Recommendation

Small to medium datasets (under 10 TB)

Robocopy (this topic)

Large datasets with millions of small files (over 10 TB)

Python parallel migration script (see FAQ)

Cross-region or cross-account migration

Robocopy with Cloud Enterprise Network (CEN) connectivity

How it works

Robocopy creates mirror copies of directory structures, preserving file attributes and timestamps. The tool skips duplicate files, making it efficient for incremental synchronization.

Billing

Data migration incurs the following costs:

Service

Description

ECS

Charges apply based on instance configuration. For more information, see Overview.

NAS

Storage usage fees apply for both file systems. For more information, see Billing overview.

CEN

If you connect VPCs through CEN, charges apply for transit routers. For more information, see Billing.


Prerequisites

Before you begin, make sure you have:

  • A source SMB file system that contains data to migrate

  • A destination SMB file system to receive the migrated data

  • A mount target of the Virtual Private Cloud (VPC) type for each SMB file system

  • Network connectivity between the source and destination file systems (same VPC, or VPCs connected through CEN)


Migrate data

Create an ECS instance, mount both SMB file systems, and run Robocopy to replicate data.

Step 1: Prepare the environment

Ensure the ECS instance can access both file systems.

  1. Get the mount target information of the source file system.

  2. Configure the destination file system based on your scenario:

    Scenario

    Action

    Same VPC

    Proceed to Step 2: Create an ECS instance.

    Different VPCs in the same region

    Create a mount target for the destination file system, then use CEN to connect the VPCs.

    Different accounts or regions

    Use CEN to connect the VPCs.

Step 2: Create an ECS instance

Important: Create a dedicated ECS instance for data migration. Using an existing instance may consume CPU and network bandwidth allocated to running workloads.
  1. Log on to the ECS console and click Create Instance.

  2. Configure the following parameters:

    Parameter

    Configuration

    Region

    Select the region where the source file system resides.

    Network and Zone

    Select the VPC, zone, and vSwitch of the source file system.

    Instance

    For migrations under 100 GB, select the minimum specification. For migrations over 1 TB, select at least 8 vCPUs and 16 GiB memory.

    Image

    Select Windows Server 2019 for optimal compatibility.

    Storage

    Click Elastic Ephemeral Disk | NAS File System | Dedicated Block Storage Cluster(Optional), then click Add File System.

    If you use Windows Server 2025, disable SMB signing before mounting NAS file systems. Run the following command in PowerShell as an administrator, then restart the instance:

    reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v RequireSecuritySignature /t REG_DWORD /d 0 /f

Step 3: Mount the file systems

  1. Mount both the source and destination file systems to the ECS instance.

  2. Verify the mount:

    net use

    Expected output:

    Status     Local      Remote                                                Network
    -------------------------------------------------------------------------------
    OK         Y:         \\29e9c24****-eab13.cn-hangzhou.nas.aliyuncs.com\myshare
                                                                               Microsoft Windows Network
    OK         Z:         \\29fe7f4****-txr31.cn-hangzhou.nas.aliyuncs.com\myshare
                                                                               Microsoft Windows Network

Step 4: Run Robocopy

Run the following command to migrate data from the source file system (Z:) to the destination file system (Y:):

robocopy Z:\ Y:\ /E /COPY:DAT /MT:8 /R:3 /W:5

Parameter

Description

/E

Copies subdirectories, including empty directories.

/COPY:DAT

Copies data, attributes, and timestamps.

/MT:8

Uses 8 threads for multi-threaded copying.

/R:3

Limits retry attempts to 3.

/W:5

Sets the wait time between retries to 5 seconds.

Warning: Do not use /COPYALL for NAS-to-NAS migration. NAS SMB does not support full NTFS security attributes. Using /COPYALL causes the error: A required privilege is not held by the client.

Step 5: Verify the migration

Run the following command to verify data consistency:

robocopy Z:\ Y:\ /E /L /NS /NJS /NJH /NDL /FP /LOG:reconcile.txt

Parameter

Description

/L

Lists differences without copying files.

/NS

Excludes file sizes from logs.

/NJS

Excludes job summary.

/NJH

Excludes job header.

/NDL

Excludes folder names from logs.

/FP

Includes full file paths in logs.

/LOG:reconcile.txt

Writes results to reconcile.txt.


Switch workloads to the new file system

After migration, unmount the original file system and mount the new file system on all ECS instances and containers.

ECS instances

  1. Run net use to obtain the mount information.

  2. Unmount the original file system:

    net use Z: /delete
  3. Mount the new file system to the original drive letter.

  4. Restart processes that access the file system.

  5. Update the auto_mount.bat file with the new mount target.

Windows containers

  1. Modify the YAML configuration file with the new mount target.

  2. Generate new pods with the modified configuration.

  3. Recycle all pods that use the original file system.

Important: Retain data in the original file system for at least one week after switching workloads. Immediate deletion may cause data loss from accidental deletion or synchronization.

FAQ

How do I accelerate large-scale data migration?

For migrations involving hundreds of millions of small files (over 10 TB), use the Python-based parallel migration script:

  1. Install the latest Python on the Windows ECS instance.

  2. Set the PATH environment variable:

    set PATH=%PATH%;C:\python27
  3. Copy the migration.py script to the ECS instance.

  4. Run the migration:

    python ./migration.py -s Z:\ -d Y:\

Parameter

Description

-s <source path>

Source directory, such as -s Z:\

-d <destination path>

Destination directory, such as -d Y:\

-r BeginIndex:EndIndex

Range of subdirectories to migrate

-f

Migrates only first-level files

-i ignoredFile

Files to exclude from migration

For multi-client parallel migration, assign different subdirectory ranges to each client:

  • Client 1: -r 0:9999

  • Client 2: -r 10000:19999


References