Migrate NAS data to on-premises storage

Updated at:

Download NAS data to on-premises storage with rsync, Robocopy, SFTP, or IIS FTP, or sync to OSS first and then download locally.

Important

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

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

  2. Connect the SFTP client to the transit ECS instance.

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

      Note
      • The 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.

      Note

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

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

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

  1. Install rsync.

    Linux

    Operating system

    Command

    CentOS

    Install rsync with yum:

    sudo yum install rsync

    Redhat

    Ubuntu

    Install rsync with apt:

    sudo apt-get install rsync

    Debian

    Note

    For other Linux distributions, use the corresponding package manager.

    macOS

    Install Homebrew, then run:

    brew install rsync

    Windows

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

    Note

    Paths 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

  1. Log on to the transit ECS instance.

  2. 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:32
    Note

    This 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

    Note

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

  3. 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.txt

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

Note
  • 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.

  1. Migrate data to OSS.

  2. Download the data from OSS to local files. For more information, see Simple download.