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.
Get the mount target information of the source file system.
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.
Log on to the ECS console and click Create Instance.
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
Mount both the source and destination file systems to the ECS instance.
Verify the mount:
net useExpected 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:5Parameter | Description |
| Copies subdirectories, including empty directories. |
| Copies data, attributes, and timestamps. |
| Uses 8 threads for multi-threaded copying. |
| Limits retry attempts to 3. |
| Sets the wait time between retries to 5 seconds. |
Warning: Do not use/COPYALLfor NAS-to-NAS migration. NAS SMB does not support full NTFS security attributes. Using/COPYALLcauses 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.txtParameter | Description |
| Lists differences without copying files. |
| Excludes file sizes from logs. |
| Excludes job summary. |
| Excludes job header. |
| Excludes folder names from logs. |
| Includes full file paths in logs. |
| 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
Run
net useto obtain the mount information.Unmount the original file system:
net use Z: /deleteMount the new file system to the original drive letter.
Restart processes that access the file system.
Update the
auto_mount.batfile with the new mount target.
Windows containers
Modify the YAML configuration file with the new mount target.
Generate new pods with the modified configuration.
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:
Install the latest Python on the Windows ECS instance.
Set the PATH environment variable:
set PATH=%PATH%;C:\python27Copy the
migration.pyscript to the ECS instance.Run the migration:
python ./migration.py -s Z:\ -d Y:\
Parameter | Description |
| Source directory, such as |
| Destination directory, such as |
| Range of subdirectories to migrate |
| Migrates only first-level files |
| Files to exclude from migration |
For multi-client parallel migration, assign different subdirectory ranges to each client:
Client 1:
-r 0:9999Client 2:
-r 10000:19999