All Products
Search
Document Center

Apsara File Storage NAS:Migrate data from a NAS file system to an on-premises storage system

Last Updated:Dec 12, 2023

Apsara File Storage NAS (NAS) allows you to use the rsync command-line tool or Robocopy to download data to local files. You can also synchronize data to Object Storage Service (OSS) and then download the data from OSS to local files.

Important

Downloading data from a NAS file system consumes the public bandwidth of an Elastic Compute Service (ECS) instance. We recommend that you purchase a new ECS instance and use it to download data. For more information, see Use a newly purchased ECS instance as the intermediate node for data transfer.

Migrate data by using an SFTP client

If you need to download a small number of files, we recommend that you install and use an SSH File Transfer Protocol (SFTP) client on your on-premises computer.

Benefits

  • Supports multiple operating systems.

  • Provides a graphical user interface (GUI).

Procedure

  1. Install an SFTP client on your on-premises computer.

    Download and install an SFTP client based on your on-premises operating system. Multiple SFTP versions are available. In this example, FileZilla is used.

  2. Establish a connection between the SFTP client and the ECS instance.

    1. Open and configure the FileZilla client. The following table describes the parameters. Click Quickconnect to establish a connection.

      After the on-premises client and the ECS instance are connected, the on-premises file system is displayed in the left pane. The file system that is mounted on the ECS instance is displayed in the right pane.U-D NFS0201

      Parameter

      Description

      Host

      The public IP address of the ECS instance. For example, you can enter 192.0.2.1.

      Username

      The username of the ECS instance. The user has the read and write permissions on the NAS file system. For example, you can enter root.

      Note
      • The default username of a Linux ECS instance is root or ecs-user.

      • The default username of a Windows ECS instance is administrator.

      Password

      The logon password of the ECS instance. For example, you can enter the logon password of the root user.

      Note

      If you forget the logon password of the ECS instance, you can reset the password. For more information, see Reset the logon password of an instance.

      Port

      The port number used by SFTP. Default value: 22.

    2. In the Remote site field in the right pane, enter the path to the directory where the NAS file system is mounted, for example, /mnt. Press Enter to view the list of files in the NAS file system.

      UD-NFS0202

  3. Download data.

    Drag and drop one or more files or directories from the right pane to the left pane to download the data.

Migrate data by using the rsync command-line tool

If you need to frequently download a large number of files, we recommend that you install the rsync command-line tool on your on-premises computer.

Benefits

  • After a file is downloaded, the metadata of the file remains unchanged, including the owner and permission information.

  • You can synchronize incremental data.

  • You can configure crontab for your on-premises Linux or macOS system to automatically back up data to the NAS file system.

Procedure

  1. Install the rsync tool.

    Linux

    Operating system

    Command

    CentOS

    Use the yum package manager to install rsync.

    sudo yum install rsync

    Redhat

    Ubuntu

    Use the apt package manager to install rsync.

    sudo apt-get install rsync

    Debian

    Note

    If you are using a different version of Linux, use the corresponding package manager to install rsync.

    macOS

    Download and install the Homebrew package manager, and then run the following command to install rsync:

    brew install rsync

    Windows

  2. Download data.

    Run the following command to download data from the NAS file system 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 on which the NAS file system is mounted.

    /mnt/DirToSync

    The data and data directory to be exported from NAS.

    DirToSync

    The local directory.

    Note

    The path in the rsync command must end with a forward slash (/). Otherwise, the paths do not match after the data is synchronized.

Migrate data by using the Robocopy tool

Benefits

Robocopy is a directory copy command that is provided by Windows. You can create two image copies that have the same file structure without the need to copy any unnecessary duplicate files. You can retain all relevant file information, such as the date and timestamp.

To migrate large amounts of data, you can install the latest Python program on a Windows ECS instance and configure the migration.py script. For more information, see How do I accelerate data migration to an SMB file system?

Procedure

  1. Log on to the ECS instance that is used to migrate data.

  2. Migrate data.

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

    robocopy Z:\ Y:\ /e /w:5 /z /mt:32
    Note

    Only the data in the specified directory is migrated. The directory is not migrated.

    The following table describes the parameters. Replace the values of the parameters with the actual values.

    Parameter

    Description

    /mt

    Specifies the number of concurrent threads. Default value: 8.

    Valid values: 1 to 128.

    In this example, 32 threads are used for multi-thread replication.

    /w

    Specifies the number of seconds between two consecutive retries caused by errors.

    /z

    Enables resumable upload.

    /e

    Copies all subdirectories, including empty directories.

    /copyall

    Copies all file information. The information includes the following items:

    • Data

    • Attributes

    • Timestamp

    • Access control list (ACL)

    • Owner information

    • Audit information

    Note

    If you want to accelerate the migration of large amounts of data, for example, hundreds of millions of small files larger than 10 TB, you can install the latest Python program on a Windows ECS instance. For more information, see How do I accelerate data migration to an SMB file system?

  3. Check the migration result.

    After you complete data migration, run the following command to check whether the data that is stored in the destination file system is consistent with the data that is stored in the source file system.

    ROBOCOPY Z:\ Y:\ /e /l /ns /njs /njh /ndl /fp /log:reconcile.txt

    The following table describes the parameters. Replace the values of the parameters with the actual values.

    Parameter

    Description

    /e

    Lists only directories, including empty directories.

    /l

    Records the differences without modifying or copying files.

    /fp

    Includes the full paths of files in logs. This parameter is required only if the /ndl parameter is not specified.

    /ns

    Does not include the file size in logs.

    /ndl

    Does not include folders in logs.

    /njs

    Does not include the job summary.

    /njh

    Does not include the job header.

    /log:reconcile.txt

    Writes the migration result to the reconcile.txt log file. If the migration result already exists in the log file, the existing content is overwritten.

Migrate data by using IIS FTP

If you need to download a small number of files, we recommend that you install and configure an FTP client on your on-premises computer.

Benefits

  • Supports multiple operating systems.

  • Provides a GUI.

Procedure

For more information, see Set up the Windows IIS web service.

Note
  • You must enable the FTP TCP port for the security group of the associated VPC.

  • You can also configure other FTP servers and clients to upload and download data over the Internet.

  • You are not charged for the inbound traffic of an elastic IP address (EIP). However, you are charged for the outbound traffic of an EIP. Therefore, you are not charged for the traffic that is generated when you upload data to the NAS file system over the Internet. However, you are charged for the traffic that is generated when you download data from the NAS file system. For more information about the billing of EIP, see Pay-as-you-go.

Migrate data to OSS and then download the data from OSS

You can use ossutil or the Data Transport service to synchronize data to OSS, and then download the data from OSS to local files.

  1. Migrate data to OSS.

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