Scalable File Service

Migrating a CIFS File System Using the Robocopy Tool

2024-09-11 06:52:26

Application Scenarios

This section applies to the data migration between different file systems in the same region and the same VPC. Robocopy is a directory copy command that is provided by Windows. You can create two mirror copies that have the same file structure without copying any unnecessary duplicate files. You can also retain all relevant file information, such as the date and timestamp.

Prerequisites

You already have two CIFS protocol file systems and prepare a Windows ECS under the same VPC network as the source file system. The two file systems are used as the source file system and the destination file system respectively. The source file system refers to the old file system containing service data, and the destination file system refers to the new file system to be put into use.

Making Preparations

1.       Register an account on the official website of eSurfing Cloud and complete the real-name authentication. For specific operations, see Registering an eSurfing Cloud Account.

2.       Log in to the official website page of eSurfing Cloud and find the Console. For specific operations, see eSurfing Cloud - Console.

3.       Create a file system and an ECS respectively. For specific operations, see Creating an SFS and Creating an ECS.

4.       For details about how to mount the file system to the ECS, see Using the ECSs to Mount a File System.

Procedure

Here are the key steps for migrating data between two CIFS file systems: Mount the file system > Migrate the data > Migrate the application. The specific operation steps are as follows:

1. Mount the destination file system to the cloud server.

Mount the destination file system to the Windows cloud server. For the convenience of distinction, mount the source file system on the Y disk and the destination file system on the Z disk.

After the mount is complete, click Windows+R, enter cmd, and run the following command to confirm the mount result.

net use

If the echo interface displays the following information, it means that the mount is successful. That is, the source file system is mounted on disk Y and the destination file system is mounted on disk Z.

2. Migrate the data.

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

robocopy Y:\ Z:\ /e /w:5 /z /mt:16

Note:

Only migrate data in the specified directory, excluding the specified directory.

Important fields are described below. You can replace them based on actual needs.

Parameter

Description

Y:\

Specify the path of the source directory. You can   replace it with the actual path.

Z:\

Specify the path of the destination directory. You can   replace it with the actual path.

/w

Set the number of seconds between two consecutive   retries caused by each error.

/z

Enable resumable upload.

/e

Copy all subdirectories, including empty directories.

/mt

Set the number of concurrent threads. The default value   is 8 and the value range is 1~128. In this example, the value is 16.

/copyall

Copy all file information, including: Data, attributes,   timestamps, access control lists (ACLs), owner information, and audit   information.

The running result is as follows:

3. Check the migration result.

After the migration is complete, use the following Robocopy command to whether the data stored in the destination file system is consistent with the data stored in the source file system.

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

Important fields are described below. You can replace them based on actual needs.

Parameter

Description

Y:\

Specify the path of the source directory. You can   replace it with the actual path.

Z:\

Specify the path of the destination directory. You can   replace it with the actual path.

/e

List only directories, including empty directories.

/l

Record the differences only without modifying or   copying files.

/fp

Include the full paths of files in logs (This parameter   is required only if /ndl is omitted).

/ns

Do   not include the file size in logs.

/ndl

Do   not include folders in the logs.

/njs

Do   not include the job summary.

/njh

Do   not include the job header.

/log:reconcile.txt

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

Check the running result. If the data of the two files are consistent, the written file path must be written. Run type file name to check the contents of the file.

4. Switch applications to a new file system

If you need to switch the services on the source file system to the destination file system after the data migration if complete, unmount the source file system on all cloud server clients and then mount the new file system to the cloud server used by your services.

a) Run the net use command in the cloud server used by the service and check the local mount path of the source file system mount, that is, to obtain the local drive letter.

b) Run the net use local drive letter/delete command to unmount the source file system. You can obtain the local drive letter from the previous query.

c) Mount the new file system to the disk letter used by the business. For the mount method, see Using the ECS to Mount a File System.

d) Start the service that accesses the file system and confirm that the read and write operations are normal.

Note:

The cloud server in this operation is only used as a transfer station for data migration, not for actual businesses. After the data migration and switching are completed on the new file system, the new file system should be mounted on the cloud server used by the actual service.


Sgfv2kyiGS_z