Migrate NAS data to on-premises storage
Download NAS data to on-premises storage with rsync, Robocopy, SFTP, or IIS FTP, or sync to OSS first and then download locally.
Downloading NAS data consumes ECS public bandwidth. Use a dedicated ECS instance to avoid impacting workloads. For more information, see Use a new ECS instance as a transit node.
Select a migration method
Select a method based on your scenario:
|
Scenario |
Recommended method |
Description |
|
Small number of files with cross-platform GUI |
SFTP client |
Graphical interface, supports Linux, macOS, and Windows. |
|
Large datasets with metadata preservation |
rsync |
Incremental sync, preserves permissions and ownership. |
|
Large datasets on Windows (SMB) |
Robocopy |
Windows built-in tool, creates mirror copies. |
|
Small number of files on Windows (SMB) |
IIS FTP |
Graphical interface for SMB file systems. |
|
Very large datasets or limited bandwidth |
OSS transit |
Sync to OSS first, then download from OSS. |
Use an SFTP client
Procedure
Install an SFTP client on your local operating system.
Various SFTP clients are available. This topic uses FileZilla as an example. Choose a version that is compatible with your local operating system and download and install the SFTP client.
Connect the SFTP client to the transit ECS instance.
Open the FileZilla client and configure the parameters as described in the following table. Click Quickconnect.
After you connect to the ECS server, the left pane displays your local file system, and the right pane displays the server's file system.
Parameter
Description
Host
The public IP address of the transit ECS instance. Example: 192.0.2.1.
Username
The username for the transit ECS instance. This user must have read and write permissions on the NAS file system directory. Example: root.
NoteThe default username for a Linux ECS instance is root or ecs-user.
The default username for a Windows ECS instance is administrator.
Password
The logon password for the transit ECS instance. For example, the logon password for the root user.
NoteIf you forget the password of the transit ECS instance, you can reset it and set a new password. For more information, see Reset the logon password of an instance.
Port
The SFTP port number. The default is 22.
In the right pane, set the path in the Remote site field to the mount path of the NAS file system, such as /mnt. Press Enter to view the files in the NAS file system.
-
Download data.
Drag and drop files or directories from the right pane to the left pane.
Use rsync
Benefits
-
Preserves file metadata, including ownership and permissions.
-
Supports incremental synchronization.
-
Supports crontab scheduling on Linux or macOS for automated backups.
Procedure
-
Install rsync.
Linux
Operating system
Command
CentOS
Install rsync with yum:
sudo yum install rsyncRedhat
Ubuntu
Install rsync with apt:
sudo apt-get install rsyncDebian
NoteFor other Linux distributions, use the corresponding package manager.
macOS
Install Homebrew, then run:
brew install rsyncWindows
-
Install the Cygwin environment and search for and select rsync during setup. Alternatively, download, compile, and install rsync manually.
NoteEnable TCP port 22 (SSH) in the security group of the associated VPC.
-
-
Download data.
Run the following command to download NAS data to a local directory:
rsync -avP root@192.0.2.0:/mnt/DirToSync/ DirToSync/Parameter
Description
192.0.2.0
The public IP address of the Linux or Windows ECS instance where the NAS file system is mounted.
/mnt/DirToSync
The directory to export from NAS.
DirToSync
The local directory.
NotePaths in the rsync command must end with a forward slash (/). Otherwise, the directory structure will not match after synchronization.
Use Robocopy
Benefits
Robocopy is a Windows directory copy command that creates mirror copies with identical file structures without duplicating unchanged files, and preserves attributes such as dates and timestamps.
For large-scale migration, install Python on a Windows ECS instance and use the migration.py script. How do I accelerate data migration to an SMB file system?
Procedure
Log on to the transit ECS instance.
Migrate data.
Run the following command to migrate data from the source file system (drive Z) to the destination file system (drive Y):
robocopy Z:\ Y:\ /e /w:5 /z /mt:32NoteThis command migrates only the data within the specified directory, not the directory itself.
The following table describes important parameters. Replace them with your actual values.
Parameter
Description
/mt
The number of concurrent threads. The default is 8.
Valid values: 1 to 128.
This example uses 32 threads for multi-threaded copying.
/w
Specifies the wait time in seconds between retries.
/z
Enables resumable transfer.
/e
Copies all subdirectories, including empty ones.
/copyall
Copies all file information. This includes:
Data
Attributes
Timestamps
Access Control List (ACL)
Owner information
Auditing information
NoteTo accelerate the migration of massive amounts of data, such as more than 100 million small files that exceed 10 TB in total size, you can install the latest Python program on the Windows ECS instance to perform the migration. For more information, see How to accelerate data migration to an SMB file system of Apsara File Storage NAS.
Verify the migration result.
After the migration is complete, run the following Robocopy command to verify that the data in the destination is consistent with the source:
ROBOCOPY Z:\ Y:\ /e /l /ns /njs /njh /ndl /fp /log:reconcile.txtThe following table describes important parameters. Replace them with your actual values.
Parameter
Description
/e
Lists only directories, including empty ones.
/l
Reports differences without modifying or copying files.
/fp
Includes the full paths of files in the log. This is necessary only when /ndl is omitted.
/ns
Specifies not to include file sizes in the log.
/ndl
Specifies not to include folders in the log.
/njs
Specifies not to include the job summary.
/njh
Specifies not to include the job header.
/log:reconcile.txt
Writes the migration result to the reconcile.txt log file. If the file already exists, it is overwritten.
Use IIS FTP
Procedure
For more information, see Configure the Windows IIS web service.
You must open the corresponding FTP TCP ports in the VPC security group.
You can also configure other FTP servers and clients to upload and download data over the public network.
Inbound traffic to an elastic IP address (EIP) is free, while outbound traffic is charged. Therefore, uploading data to File Storage NAS over the public network is free, but downloading data incurs charges. For more information about billing, see Pay-as-you-go EIPs.
Transfer via OSS
Sync data to OSS using ossutil or Data Transport, then download from OSS to local storage.
-
Migrate data to OSS.
-
Use ossutil to migrate data to OSS. For more information, see Migrate data by using ossutil.
-
Use Data Transport to migrate NAS data to OSS. Migrate data by using Data Transport.
-
-
Download the data from OSS to local files. For more information, see Simple download.