Data migration method, device and equipment

By dividing the disk into multiple subpartitions and determining the target data block, the problem of low data migration efficiency is solved, and efficient data migration is achieved in the case of a lot of invalid data on the disk.

CN119088289APending Publication Date: 2024-12-06XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411036645.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

During data migration, when there is a lot of invalid data on the disk, the time required to detect invalid data is greater, resulting in low data migration efficiency.

Method used

The target storage partition where the data to be migrated is located is divided into multiple sub-partitions, and the first sub-partition and the second sub-partition are determined in these sub-partitions, and the target in the second sub-partition is determined according to the valid data blocks in the first sub-partition. Data blocks are then migrated to reduce the time required for data migration.

Benefits of technology

This method reduces the time required for data migration and improves data migration efficiency, especially when there is a lot of invalid data on disk.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088289A_ABST
    Figure CN119088289A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data migration method, device and equipment. The method comprises the steps that a target storage partition where to-be-migrated data is located is divided into a plurality of sub-partitions; determining a first sub-partition and a second sub-partition in the plurality of sub-partitions; according to the valid data block in the first sub-partition, determining a target data block in the second sub-partition, the target data block being a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition; and carrying out cross-platform migration on the effective data blocks in the first sub-partition and the target data blocks in the second sub-partition. The method can improve the data migration efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of computing devices, and in particular, to a data migration method, apparatus, and device. Background Art

[0002] When you migrate data on a disk across platforms, you can migrate all the data on the disk or only migrate valid data on the disk.

[0003] At present, in order to improve the efficiency of data migration by reducing the amount of data migration, invalid data in the disk can be detected first, and the invalid data can be skipped and only valid data in the disk can be migrated. However, if there is a lot of invalid data in the disk, it takes a long time to detect the invalid data. It takes more time to migrate the data in the disk by the above method, resulting in low data migration efficiency. Summary of the invention

[0004] The embodiments of the present application provide a data migration method, apparatus and device for solving the technical problem of low data migration efficiency.

[0005] In a first aspect, an embodiment of the present application provides a data migration method, comprising: dividing a target storage partition where the data to be migrated is located into multiple sub-partitions; determining a first sub-partition and a second sub-partition among the multiple sub-partitions; determining a target data block in the second sub-partition based on valid data blocks in the first sub-partition, the target data block being a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition; migrating the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.

[0006] In the above scheme, the electronic device can divide the target storage partition where the data to be migrated is located into multiple sub-partitions; can determine the first sub-partition and the second sub-partition in the multiple sub-partitions; can determine the target data blocks in the second sub-partition according to the valid data blocks in the first sub-partition; and can migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition. Through the above method, the time required for data migration can be reduced and the data migration efficiency can be improved.

[0007] In a possible implementation manner, determining the first sub-partition and the second sub-partition from the multiple sub-partitions includes:

[0008] Determine valid data blocks in the multiple sub-partitions, and count the number of valid blocks of the valid data blocks and the total time taken to determine the valid data blocks, until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value;

[0009] Determine the sub-partition in which the valid data block has been determined among the multiple sub-partitions as the first sub-partition;

[0010] The sub-partitions other than the first sub-partition among the multiple sub-partitions are determined as the second sub-partitions.

[0011] In the above solution, the multiple sub-partitions may be divided into a first sub-partition and a second sub-partition, so as to respectively determine the data to be migrated in each sub-partition.

[0012] In a possible implementation, for any one of the sub-partitions, determining a valid data block in the sub-partition includes:

[0013] detecting invalid data blocks in the sub-partition;

[0014] The data between two adjacent invalid data blocks in the sub-partition are determined as the valid data block; and / or the data between the invalid data block closest to the starting address / ending address of the sub-partition and the starting address / ending address of the sub-partition are determined as the valid data block.

[0015] In the above scheme, invalid data blocks in the sub-partition can be detected, and valid data blocks in the sub-partition can be determined based on the invalid data blocks in the sub-partition, thereby achieving the purpose of determining valid data blocks in the sub-partition.

[0016] In a possible implementation, determining the target data block in the second sub-partition according to the valid data block in the first sub-partition includes:

[0017] determining a first capacity of the first sub-partition;

[0018] Determining a second capacity of the second sub-partition according to the total capacity of the target storage partition and the first capacity;

[0019] A target data block in the second sub-partition is determined according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity.

[0020] In the above scheme, the target data block in the second subpartition can be determined according to the number of valid blocks, the first capacity and the second capacity of the valid data blocks in the first subpartition, thereby achieving the purpose of determining the target data block in the second subpartition.

[0021] In a possible implementation, determining the target data block in the second sub-partition according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity includes:

[0022] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition;

[0023] Determine, according to the second capacity, a second migration duration corresponding to valid data blocks and invalid data blocks in the second sub-partition;

[0024] If the sum of the second migration duration and the preset threshold is less than the first migration duration, determining that the target data block is a valid data block and an invalid data block in the second sub-partition;

[0025] If the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, it is determined that the target data block is a valid data block in the second sub-partition.

[0026] In the above scheme, if the sum of the second migration duration and the preset threshold is less than the first migration duration, the target data block is determined to be a valid data block and an invalid data block in the second sub-partition; if the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, the target data block is determined to be a valid data block in the second sub-partition. Through the above scheme, the purpose of determining the target data block is achieved.

[0027] In a possible implementation, determining, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition includes:

[0028] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a detection duration corresponding to the second sub-partition, and determine a migration duration required to perform a migration operation on valid data blocks in the second sub-partition;

[0029] The sum of the detection duration and the migration duration is determined as the first migration duration.

[0030] In the above solution, the sum of the detection duration and the migration duration can be determined as the first migration duration, thereby achieving the purpose of determining the first migration duration.

[0031] In a possible implementation, determining the detection duration corresponding to the second sub-partition according to the number of valid blocks, the first capacity, and the second capacity includes:

[0032] Obtaining a total time taken to determine a valid data block in the first sub-partition;

[0033] Determining a first ratio of the number of valid blocks to the first capacity;

[0034] Determining a second ratio of the total duration to the number of valid blocks;

[0035] The product of the first ratio, the second ratio and the second capacity is determined as the detection duration.

[0036] In the above solution, the detection duration corresponding to the second sub-partition can be determined according to the number of valid blocks, the first capacity and the second capacity, thereby achieving the purpose of determining the detection duration.

[0037] In a possible implementation, determining the migration time required for migrating the valid data blocks in the second sub-partition according to the number of valid blocks, the first capacity, and the second capacity includes:

[0038] Get the migration rate of data;

[0039] Determining a first ratio of the number of valid blocks to the first capacity;

[0040] determining a first product of the second capacity and the first ratio;

[0041] The ratio of the first product to the migration rate is determined as the migration duration.

[0042] In the above solution, the migration time required for migrating the valid data blocks in the second sub-partition can be determined according to the number of valid blocks, the first capacity and the second capacity, thereby achieving the purpose of determining the migration time.

[0043] In a possible implementation, determining, according to the second capacity, second migration durations corresponding to valid data blocks and invalid data blocks in the second sub-partition includes:

[0044] Get the migration rate of data;

[0045] A ratio of the second capacity to the migration rate is determined as the second migration duration.

[0046] In the above solution, the ratio of the second capacity to the migration rate can be determined as the second migration duration, thereby achieving the purpose of determining the second migration duration.

[0047] In one possible implementation,

[0048] The first sub-partition is one or more consecutive sub-partitions among the multiple sub-partitions; or

[0049] The first sub-partition is one or more discontinuous sub-partitions among the multiple sub-partitions.

[0050] In the above scheme, if the first sub-partition is one or more continuous sub-partitions among multiple sub-partitions, the determination speed of the first sub-partition can be faster; if the first sub-partition is one or more discontinuous sub-partitions among multiple sub-partitions, the processing accuracy of the data migration method provided in the embodiment of the present application can be higher.

[0051] In a second aspect, an embodiment of the present application provides a data migration device, the data migration device comprising a partitioning module, a determination module and a migration module, wherein:

[0052] The partitioning module is used to divide the target storage partition where the data to be migrated is located into multiple sub-partitions;

[0053] The determining module is used to determine a first sub-partition and a second sub-partition among the multiple sub-partitions;

[0054] The determination module is further used to determine a target data block in the second sub-partition according to the valid data block in the first sub-partition, wherein the target data block is a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition;

[0055] The migration module is used to migrate valid data blocks in the first sub-partition and target data blocks in the second sub-partition.

[0056] In the above scheme, the data migration device can divide the target storage partition where the data to be migrated is located into multiple sub-partitions; can determine the first sub-partition and the second sub-partition in the multiple sub-partitions; can determine the target data blocks in the second sub-partition according to the valid data blocks in the first sub-partition; and can migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition. Through the above method, the time required for data migration can be reduced and the data migration efficiency can be improved.

[0057] In a possible implementation, the determining module is specifically configured to:

[0058] Determine valid data blocks in the multiple sub-partitions, and count the number of valid blocks of the valid data blocks and the total time taken to determine the valid data blocks, until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value;

[0059] Determine the sub-partition in which the valid data block has been determined among the multiple sub-partitions as the first sub-partition;

[0060] The sub-partitions other than the first sub-partition among the multiple sub-partitions are determined as the second sub-partitions.

[0061] In the above solution, the multiple sub-partitions may be divided into a first sub-partition and a second sub-partition, so as to respectively determine the data to be migrated in each sub-partition.

[0062] In a possible implementation, for any of the sub-partitions, the determining module is specifically configured to:

[0063] detecting invalid data blocks in the sub-partition;

[0064] The data between two adjacent invalid data blocks in the sub-partition are determined as the valid data block; and / or the data between the invalid data block closest to the starting address / ending address of the sub-partition and the starting address / ending address of the sub-partition are determined as the valid data block.

[0065] In the above scheme, invalid data blocks in the sub-partition can be detected, and valid data blocks in the sub-partition can be determined based on the invalid data blocks in the sub-partition, thereby achieving the purpose of determining valid data blocks in the sub-partition.

[0066] In a possible implementation, the determining module is specifically configured to:

[0067] determining a first capacity of the first sub-partition;

[0068] Determining a second capacity of the second sub-partition according to the total capacity of the target storage partition and the first capacity;

[0069] A target data block in the second sub-partition is determined according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity.

[0070] In the above scheme, the target data block in the second subpartition can be determined according to the number of valid blocks, the first capacity and the second capacity of the valid data blocks in the first subpartition, thereby achieving the purpose of determining the target data block in the second subpartition.

[0071] In a possible implementation, the determining module is specifically configured to:

[0072] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition;

[0073] Determine, according to the second capacity, a second migration duration corresponding to valid data blocks and invalid data blocks in the second sub-partition;

[0074] If the sum of the second migration duration and the preset threshold is less than the first migration duration, determining that the target data block is a valid data block and an invalid data block in the second sub-partition;

[0075] If the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, it is determined that the target data block is a valid data block in the second sub-partition.

[0076] In the above scheme, if the sum of the second migration duration and the preset threshold is less than the first migration duration, the target data block is determined to be a valid data block and an invalid data block in the second sub-partition; if the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, the target data block is determined to be a valid data block in the second sub-partition. Through the above scheme, the purpose of determining the target data block is achieved.

[0077] In a possible implementation, the determining module is specifically configured to:

[0078] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a detection duration corresponding to the second sub-partition, and determine a migration duration required to perform a migration operation on valid data blocks in the second sub-partition;

[0079] The sum of the detection duration and the migration duration is determined as the first migration duration.

[0080] In the above solution, the sum of the detection duration and the migration duration can be determined as the first migration duration, thereby achieving the purpose of determining the first migration duration.

[0081] In a possible implementation, the determining module is specifically configured to:

[0082] Obtaining a total time taken to determine a valid data block in the first sub-partition;

[0083] Determining a first ratio of the number of valid blocks to the first capacity;

[0084] Determining a second ratio of the total duration to the number of valid blocks;

[0085] The product of the first ratio, the second ratio and the second capacity is determined as the detection duration.

[0086] In the above solution, the detection duration corresponding to the second sub-partition can be determined according to the number of valid blocks, the first capacity and the second capacity, thereby achieving the purpose of determining the detection duration.

[0087] In a possible implementation, the determining module is specifically configured to:

[0088] Get the migration rate of data;

[0089] Determining a first ratio of the number of valid blocks to the first capacity;

[0090] determining a first product of the second capacity and the first ratio;

[0091] The ratio of the first product to the migration rate is determined as the migration duration.

[0092] In the above solution, the migration time required for migrating the valid data blocks in the second sub-partition can be determined according to the number of valid blocks, the first capacity and the second capacity, thereby achieving the purpose of determining the migration time.

[0093] In a possible implementation, the determining module is specifically configured to:

[0094] Get the migration rate of data;

[0095] A ratio of the second capacity to the migration rate is determined as the second migration duration.

[0096] In the above solution, the ratio of the second capacity to the migration rate can be determined as the second migration duration, thereby achieving the purpose of determining the second migration duration.

[0097] In one possible implementation,

[0098] The first sub-partition is one or more consecutive sub-partitions among the multiple sub-partitions; or

[0099] The first sub-partition is one or more discontinuous sub-partitions among the multiple sub-partitions.

[0100] In the above scheme, if the first sub-partition is one or more continuous sub-partitions among multiple sub-partitions, the determination speed of the first sub-partition can be faster; if the first sub-partition is one or more discontinuous sub-partitions among multiple sub-partitions, the processing accuracy of the data migration method provided in the embodiment of the present application can be higher.

[0101] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;

[0102] The memory stores computer-executable instructions;

[0103] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method described in any one of the first aspects.

[0104] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in any one of the first aspects.

[0105] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method shown in any one of the first aspects when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0106] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0107] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0108] Figure 2 A schematic diagram of data distribution in a disk provided in an embodiment of the present application;

[0109] Figure 3 A schematic diagram of cross-platform data migration provided in an embodiment of the present application;

[0110] Figure 4 A flowchart of a data migration method provided in an embodiment of the present application;

[0111] Figure 5 A schematic diagram of a target storage partition provided in an embodiment of the present application;

[0112] Figure 6 A flowchart of another data migration method provided in an embodiment of the present application;

[0113] Figure 7 A schematic diagram of a sub-partition provided in an embodiment of the present application;

[0114] Figure 8 A structural intention of a data migration device provided in an embodiment of the present application;

[0115] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0116] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0117] To facilitate understanding, the technical terms involved in the embodiments of the present application are first explained.

[0118] Virtual Machine (VM): refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment.

[0119] Cross-platform migration: refers to migrating data from a certain hardware or software platform to another hardware or software platform. For example, migrating data corresponding to a virtual machine running on a certain hardware or software platform to another hardware or software platform.

[0120] Disk data partition: refers to the logical division of disk data into multiple parts, each part contains a certain number of data blocks.

[0121] Hole detection: refers to the process of searching for invalid data (i.e., holes) with all binary bits set to zero during disk data migration, in order to reduce the amount of data migration and increase the migration speed.

[0122] Fragments: refers to small pieces of data that are non-contiguous and scattered on the disk.

[0123] Full migration: refers to the process of directly migrating all data (including valid data and holes) to the target location at once without any optimization (for example, hole detection) during the data migration process.

[0124] For ease of understanding, the following Figure 1 , the application scenarios involved in the embodiments of the present application are described.

[0125] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 , platform 1 can be communicatively connected with platform 2. Platform 1 can include source disk A and source disk B, and platform 2 can include target disk A and target disk B.

[0126] Platform 1 and platform 2 may be any two software platforms that can communicate. The technical solution provided in the embodiment of the present application does not limit the communication method between platform 1 and platform 2. For example, platform 1 and platform 2 may communicate via a network link.

[0127] The disk in the platform can be a disk of the physical machine or virtual machine where the platform is located. In other words, the disk in the platform can be a disk of the physical machine or virtual machine where the platform is deployed. For example, source disk A can be a disk of physical machine A where platform 1 is located, or source disk A can be a disk of virtual machine A where platform 1 is located.

[0128] In the above scenario, the data in the disk can be migrated across platforms. For example, the data in the source disk A can be migrated to the target disk A across platforms, and the data in the source disk B can be migrated to the target disk B across platforms.

[0129] Next, combine Figure 2 , describes the data distribution on the disk.

[0130] Figure 2 A schematic diagram of data distribution in a disk provided in an embodiment of the present application. Figure 2 , the data in the disk can include valid data blocks and invalid data blocks. Among them, valid data blocks can also be called fragments, and invalid data blocks can also be called holes. Figure 2 As shown, invalid data blocks and valid data blocks in the disk are distributed alternately.

[0131] A valid data block may be a data block with actual information carrying capacity, and an invalid data block may be a data block without actual information carrying capacity.

[0132] When data in a disk is migrated across platforms, both valid data blocks and invalid data blocks in the disk may be migrated, or only valid data blocks in the disk may be migrated.

[0133] At present, in order to reduce the amount of data migration and thus improve the efficiency of data migration, when performing cross-platform data migration, the disk can be first detected to determine invalid data blocks and valid data blocks in the disk, and then the valid data blocks in the disk can be migrated. For example, invalid data in the disk can be detected through a software development kit (SDK).

[0134] However, performing a detection process on the disk once can only determine one invalid data block. If there are many invalid data blocks in the disk, the disk needs to be detected more times. In this way, the time required for multiple detection processes is relatively long. The sum of the time required for multiple detection processes and the time required to migrate the valid data blocks determined after the detection process is greater than the time required to directly migrate all the data in the disk (that is, valid data blocks and invalid data blocks). In other words, migrating only the valid data blocks in the disk actually increases the time required for cross-platform migration of data in the disk, resulting in low data migration efficiency.

[0135] In view of this, an embodiment of the present application proposes a data migration method, in which a disk can be divided into multiple storage partitions, and the data in the disk can be migrated across platforms in units of storage partitions. When data in any storage partition is migrated across platforms, the storage partition can be divided into multiple sub-partitions, and valid data blocks in the first sub-partition and target data blocks in the second sub-partition can be migrated across platforms. The multiple sub-partitions include a first sub-partition and a second sub-partition.

[0136] It should be noted that the target data block may be a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition. In actual implementation, if the sum of the time required to migrate the valid data blocks and the invalid data blocks in the second sub-partition and the preset threshold is less than the time to migrate the valid data blocks in the second sub-partition, then the target data block may be a valid data block and an invalid data block in the second sub-partition; if the sum of the time required to migrate the valid data blocks and the invalid data blocks in the second sub-partition and the preset threshold is greater than or equal to the time to migrate the valid data blocks in the second sub-partition, then the target data block may be a valid data block in the second sub-partition. The preset threshold may be set according to actual needs. For example, the preset threshold may be 0, 3, or 5, etc.

[0137] In addition, in the above method, when the sum of the time required to migrate the valid data blocks and invalid data blocks in the second sub-partition and the preset threshold is equal to the time required to migrate the valid data blocks in the second sub-partition, the target data block can be the valid data block in the second sub-partition. That is, in this case, only the valid data blocks in the second sub-partition can be migrated, and there is no need to migrate the invalid data blocks in the second sub-partition. In this way, the storage space occupied by the data after migration can be reduced.

[0138] When the data in the disk is migrated across platforms by using the above method, the time required for migration can be reduced and the data migration efficiency can be improved.

[0139] Next, combine Figure 3 The data migration method provided in the embodiment of the present application is described.

[0140] Figure 3 A schematic diagram of cross-platform data migration provided by the embodiment of this application. Figure 3 , platform 1 may be deployed in host 1, and platform 1 may include source disk A. Platform 2 may be deployed in host 2, and platform 2 may include target disk A. A data migration system may also be run on host 2. For example, the data migration system may be run on a processing chip in host 2.

[0141] The host may be an electronic device such as a server, a laptop computer or a desktop computer. The server may be, for example, a graphics processing unit (GPU) server or an artificial intelligence (AI) server.

[0142] It should be noted that platform 1 can be deployed on one or more hosts, platform 2 can also be deployed on one or more hosts, and the number of disks in platform 1 and the number of disks in platform 2 can be one or more, wherein more means two or more than two. Figure 3The description is only given that platform 1 is deployed on one host, platform 2 is deployed on one host, and the number of disks in platform 1 and the number of disks in platform 2 are both 1, which does not constitute a limitation on the technical solution provided in the embodiment of the present application.

[0143] In the data migration method provided in the embodiment of the present application, the host 2 can migrate the data in the source disk A to the target disk A across platforms through the data migration system.

[0144] It should be noted that the data migration system can also be run on the host 1, or on an electronic device other than the host 1 and the host 2. If the data migration system is run on the host 1, the host 1 can migrate the data in the source disk A to the target disk A across platforms through the data migration system. If the data migration system is run on an electronic device other than the host 1 and the host 2, the electronic device can migrate the data in the source disk A to the target disk A across platforms through the data migration system. Figure 3 The data migration system is only described by taking the running of the data migration system on the host 2 as an example, which does not constitute a limitation on the technical solution provided in the embodiment of the present application.

[0145] The technical solutions of the embodiments of the present application are described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0146] Figure 4 The flowchart of a data migration method provided in an embodiment of the present application is shown in FIG. The execution subject of the method may be an electronic device or a data migration system set in the electronic device. The electronic device may be an electronic device running the data migration system, for example, the electronic device may be Figure 3 The data migration system can be implemented by software or by a combination of software and hardware. For ease of understanding, the following description is based on an example in which the execution subject is an electronic device. Figure 4 , the method may include:

[0147] S401: Divide the target storage partition where the data to be migrated is located into multiple sub-partitions.

[0148] The target storage partition may be a storage area on a storage medium in a source platform. The source platform may be the platform where the data to be migrated is located before migration; and the storage medium may be a disk, etc.

[0149] In this embodiment, the storage space storing the data to be migrated on the storage medium in the source platform can be divided into one or more storage partitions. The capacity of each storage partition in the multiple storage partitions can be the same, or the capacity of each storage partition in the multiple storage partitions can be different, which is not limited in this embodiment.

[0150] If the storage space storing the data to be migrated on the storage medium in the source platform is divided into a storage partition, the target storage partition is the storage partition. In other words, the target storage partition can be the storage space storing all the data to be migrated on the storage medium in the source platform.

[0151] If the storage space storing the data to be migrated on the storage medium in the source platform is divided into multiple storage partitions, the target storage partition is any one of the multiple storage partitions. In other words, the target storage partition can be the storage space storing part of the data to be migrated on the storage medium in the source platform.

[0152] After the storage space storing the data to be migrated on the storage medium in the source platform is divided into multiple storage partitions, data migration can be performed in units of storage partitions. In this way, the data migration task on the storage space storing the data to be migrated on the storage medium in the source platform can be split into multiple small-scale data migration tasks to facilitate the management and execution of data migration tasks.

[0153] It should be noted that the electronic device uses the same method to migrate data in each storage partition. In this embodiment, the method for performing data migration on the electronic device is described by taking the target storage partition as an example.

[0154] In this embodiment, the target storage partition may be divided into a plurality of sub-partitions of a preset size. That is, the size of each sub-partition in the plurality of sub-partitions is the same, and the size of each sub-partition may be equal to the preset size.

[0155] The preset size can be set according to actual needs.

[0156] Next, combine Figure 5 , describing multiple sub-regions within the target storage partition.

[0157] Figure 5 A schematic diagram of a target storage partition provided in an embodiment of the present application. Figure 5 , the target storage partition can include multiple sub-partitions. The sizes of each sub-partition are equal.

[0158] S402: Determine a first sub-partition and a second sub-partition in a plurality of sub-partitions.

[0159] In this embodiment, the electronic device may select some sub-partitions from a plurality of sub-partitions, and determine valid data blocks in the some sub-partitions. The some sub-partitions may be one or more sub-partitions. When the electronic device determines valid data blocks in the some sub-partitions, it may count the number of valid blocks of the determined valid data blocks, and count the total time taken to determine the valid data blocks. When the number of valid data blocks is greater than a first preset value and / or the total time is greater than a second preset value, the electronic device may stop determining the valid data blocks, and may determine some sub-partitions in the plurality of sub-partitions in which valid data blocks have been determined as first sub-partitions, and determine sub-partitions in the plurality of sub-partitions in which valid data blocks have not been determined as second sub-partitions.

[0160] This embodiment does not limit the sizes of the first preset value and the second preset value, and they can be set according to actual needs during the specific implementation process.

[0161] In one example, when the number of valid data blocks is greater than a first preset value or the total duration is greater than a second preset value, the electronic device may stop determining valid data blocks, so that the duration used to determine valid data blocks can be reduced.

[0162] In another example, when the number of valid data blocks is greater than a first preset value and the total duration is greater than a second preset value, the electronic device may stop determining valid data blocks. In this way, the determination result of valid data blocks can be made more accurate, thereby making the processing accuracy of the data migration method provided in the embodiment of the present application higher.

[0163] In this embodiment, the first sub-partition has at least the following two situations:

[0164] Case 1: the first sub-partition may be a continuous part of the multiple sub-partitions.

[0165] In this case, the electronic device may determine the continuous partial sub-partitions as the first sub-partition in sequence, so that the first sub-partition can be determined faster.

[0166] Case 2: the first sub-partition may be a discontinuous part of the multiple sub-partitions.

[0167] In this case, the electronic device can randomly select some sub-partitions from the multiple sub-partitions as the first sub-partition. It should be noted that the invalid data blocks and valid data blocks in the target storage partition are irregularly distributed. If the electronic device randomly selects some sub-partitions from the multiple sub-partitions as the first sub-partition, the processing accuracy of the data migration method provided in the embodiment of the present application can be higher.

[0168] S403: Determine a target data block in the second sub-partition according to the valid data block in the first sub-partition.

[0169] The valid data blocks in the first sub-partition may be the valid data blocks determined in S402.

[0170] The target data block is a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition.

[0171] In a possible implementation, the electronic device may predict the time required to migrate the valid data blocks in the second subpartition based on the number of valid blocks in the first subpartition, the first capacity of the first subpartition and the second capacity of the second subpartition. If the sum of the time required to migrate the valid data blocks and the invalid data blocks in the second subpartition and a preset threshold value is less than the time required to migrate the valid data blocks in the second subpartition, it may be determined that the target data blocks may be the valid data blocks and the invalid data blocks in the second subpartition; if the sum of the time required to migrate the valid data blocks and the invalid data blocks in the second subpartition and the preset threshold value is greater than or equal to the time required to migrate the valid data blocks in the second subpartition, the target data blocks may be the valid data blocks in the second subpartition.

[0172] It should be noted that the time required to migrate the valid data blocks in the second sub-partition may be the sum of the time required to determine the valid data blocks in the second sub-partition and the time required to perform the migration operation on the valid data blocks in the second sub-partition. The time required to migrate the valid data blocks and invalid data blocks in the second sub-partition may be the time required to perform the migration operation on the valid data blocks and invalid data blocks in the second sub-partition.

[0173] The first capacity of the first sub-partition may be the sum of the capacities of all first sub-partitions. In other words, the first capacity may be the sum of the capacities of some sub-partitions of the multiple sub-partitions for which valid data blocks have been determined.

[0174] The second capacity of the second sub-partition may be the difference between the total capacity of the target storage partition and the first capacity. In other words, the second capacity may be the sum of the capacities of some sub-partitions in the plurality of sub-partitions for which valid data blocks have not been determined.

[0175] It should be noted that the method for the electronic device to predict the time required to migrate the valid data blocks in the second sub-partition according to the number of valid blocks in the first sub-partition, the first capacity and the second capacity, and the description of the preset threshold value can be found in Figure 6 The embodiments are not described in detail here.

[0176] In this embodiment, the target data blocks in the second sub-partition can be dynamically determined according to the determination result of the valid data blocks in the first sub-partition. Specifically, if it is predicted that the time required to continue to determine the valid data blocks in the second sub-partition is long according to the determination result of the valid data blocks in the first sub-partition, the determination of the valid data blocks in the second sub-partition can be stopped in time, and the valid data blocks and invalid data blocks in the second sub-partition can be determined as the target data blocks. In this way, it is possible to avoid wasting time in determining the valid data blocks, reduce the data migration time in the second sub-partition, make the data migration efficiency in the second sub-partition higher, and further improve the data migration efficiency in the target storage partition and the storage medium. In addition, the dynamic determination of the target data blocks in the second sub-partition can make the flexibility of data migration in the target storage partition higher.

[0177] S404: Migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.

[0178] In this embodiment, the electronic device can migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition from the storage medium of the source platform to the storage medium of the destination platform to achieve cross-platform data migration. The destination platform can be the platform where the data to be migrated is located after migration.

[0179] In the data migration method provided in this embodiment, the electronic device can divide the target storage partition where the data to be migrated is located into multiple sub-partitions; can determine a first sub-partition and a second sub-partition in the multiple sub-partitions; can determine the target data blocks in the second sub-partition according to the valid data blocks in the first sub-partition; and can migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition. Through the above method, the time required for data migration can be reduced and the data migration efficiency can be improved.

[0180] Based on the above embodiments, Figure 6 , further describes the data migration method provided in an embodiment of the present application, and describes a method for an electronic device to predict the time required to migrate valid data blocks in a second sub-partition based on the number of valid blocks of valid data blocks in the first sub-partition, the first capacity, and the second capacity.

[0181] Figure 6 1 is a flow chart of another data migration method provided in an embodiment of the present application. The execution subject of the method may be an electronic device, or a data migration system set in the electronic device. The electronic device may be an electronic device running the data migration system, for example, the electronic device may be Figure 3The data migration system can be implemented by software or by a combination of software and hardware. For ease of understanding, the following description is based on an example in which the execution subject is an electronic device. Figure 6 , the method may include:

[0182] S601: Divide the target storage partition where the data to be migrated is located into multiple sub-partitions.

[0183] It should be noted that the implementation method of S601 can refer to S401 and will not be repeated here.

[0184] S602, determining valid data blocks in multiple sub-partitions, and counting the number of valid blocks of the valid data blocks, and counting the total time taken to determine the valid data blocks, until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value.

[0185] It should be noted that the method for determining valid data blocks in each sub-partition is the same. Below, taking any sub-partition as an example, the method for determining valid data blocks in a sub-partition is described.

[0186] For any sub-partition, when determining a valid data block in the sub-partition, the electronic device may perform detection processing on the sub-partition to detect an invalid data block in the sub-partition; and determine a valid data block in the sub-partition based on the invalid data block.

[0187] The detection process may be hole detection. It should be understood that the electronic device may determine invalid data blocks in the sub-partition through hole detection.

[0188] Specifically, the electronic device can detect and process the sub-partitions through the SDK.

[0189] When determining valid data blocks in a sub-partition based on invalid data blocks, the electronic device may determine the data between two adjacent invalid data blocks in the sub-partition as valid data blocks; and / or determine the data between the invalid data block closest to the start address / end address of the sub-partition and the start address / end address of the sub-partition as valid data blocks.

[0190] Combine the following Figure 7 , describing the invalid data blocks and valid data blocks in the subpartition.

[0191] Figure 7 A schematic diagram of a sub-partition provided in an embodiment of the present application. Figure 7 , data blocks 1 and data blocks 3 in the sub-partition are invalid data blocks, and data blocks 2 and data blocks 4 are valid data blocks.

[0192] During the actual implementation process, the electronic device can determine through detection processing that data block 1 and data block 3 are two adjacent invalid data blocks, and can determine the data between data block 1 and invalid data block 3 (i.e., data block 2) as a valid data block, and can determine the data between data block 3 and the sub-partition end address (i.e., data block 4) as a valid data block.

[0193] S603: Determine a sub-partition in which valid data blocks have been determined among the multiple sub-partitions as the first sub-partition.

[0194] S604: Determine the sub-partitions other than the first sub-partition among the multiple sub-partitions as the second sub-partition.

[0195] S605: Determine valid data blocks in the first sub-partition.

[0196] It should be noted that the specific implementation method of S603-S605 can refer to S402-S403 and will not be repeated here.

[0197] S606: Determine a first capacity of the first sub-partition.

[0198] In this embodiment, the sizes of the sub-partitions are the same and are equal to the preset size.

[0199] The electronic device may determine the product of the number of first sub-partitions and a preset size as the first capacity.

[0200] S607: Determine a second capacity of the second sub-partition according to the total capacity of the target storage partition and the first capacity.

[0201] It should be understood that when the electronic device divides the storage space storing the data to be migrated on the storage medium in the source platform into one or more storage partitions, the total capacity of the target storage partition can be determined.

[0202] In this embodiment, the electronic device may determine the difference between the total capacity and the first capacity as the second capacity.

[0203] S608: Determine a target data block in the second sub-partition according to the number of valid blocks of valid data blocks in the first sub-partition, the first capacity, and the second capacity.

[0204] In this embodiment, the electronic device can determine the first migration duration corresponding to the valid data blocks in the second sub-partition based on the number of valid blocks, the first capacity, and the second capacity; determine the second migration duration corresponding to the valid data blocks and invalid data blocks in the second sub-partition based on the second capacity; if the sum of the second migration duration and the preset threshold is less than the first migration duration, determine that the target data block is the valid data block and the invalid data block in the second sub-partition; if the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, determine that the target data block is a valid data block in the second sub-partition.

[0205] The first migration duration may be the duration required to migrate the valid data blocks in the second sub-partition. In other words, the first migration duration may be the sum of the duration for determining the valid data blocks in the second sub-partition and the duration required to perform the migration operation on the valid data blocks in the second sub-partition.

[0206] The second migration duration may be the duration required to migrate the valid data blocks and the invalid data blocks in the second sub-partition. In other words, the second migration duration may be the duration required to perform the migration operation on the valid data blocks and the invalid data blocks in the second sub-partition.

[0207] The preset threshold may be the time saved by directly performing the migration operation on all data blocks in the second subpartition when migrating data in the second subpartition, compared with first determining valid data blocks in the second subpartition and then performing the migration operation on the valid data blocks in the second subpartition.

[0208] It should be noted that the preset threshold value can be set according to actual needs. In addition, compared with the method of first determining the valid data blocks in the second sub-partition and then performing the migration operation on the valid data blocks in the second sub-partition, the method of directly performing the migration operation on all the data blocks in the second sub-partition requires more data to be migrated, and more storage space is required after the data is migrated. Therefore, the preset threshold value can be an optimization parameter that exchanges space for time, and the specific size of the optimization parameter can be set according to actual needs.

[0209] In this embodiment, when the electronic device determines the first migration duration corresponding to the valid data blocks in the second sub-partition based on the number of valid blocks, the first capacity, and the second capacity, it can determine the detection duration corresponding to the second sub-partition based on the number of valid blocks, the first capacity, and the second capacity, and determine the migration duration required to perform the migration operation on the valid data blocks in the second sub-partition; and determine the sum of the detection duration and the migration duration as the first migration duration.

[0210] The detection duration corresponding to the second sub-partition may be the duration required to determine the valid data blocks in the second sub-partition.

[0211] In a specific implementation process, the total time taken to determine the valid data blocks in the first sub-partition can be obtained; a first ratio of the number of valid blocks to the first capacity can be determined; a second ratio of the total time to the number of valid blocks can be determined; and the product of the first ratio, the second ratio and the second capacity can be determined as the detection time. In other words, the detection time can be determined by the following formula:

[0212]

[0213] In the specific implementation process, the migration rate of data can be obtained; the first ratio of the number of valid blocks to the first capacity can be determined; the first product of the second capacity and the first ratio can be determined; and the ratio of the first product to the migration rate can be determined as the migration duration. In other words, the migration duration can be determined by the following formula:

[0214]

[0215] The migration rate may be a rate at which the electronic device migrates data. The migration rate may be stored in the electronic device. During the specific implementation, the electronic device may obtain the migration rate locally.

[0216] In this embodiment, when the electronic device determines the second migration duration corresponding to the valid data blocks and invalid data blocks in the second sub-partition according to the second capacity, the data migration rate can be obtained; and the ratio of the second capacity to the migration rate is determined as the second migration duration. In other words, the second migration duration can be determined by the following formula:

[0217]

[0218] S609: Migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.

[0219] In the data migration method provided in the present embodiment, the electronic device can divide the target storage partition where the data to be migrated is located into multiple sub-partitions; valid data blocks can be determined in the multiple sub-partitions, and the number of valid blocks of the valid data blocks and the total time occupied in determining the valid data blocks can be counted until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value; a sub-partition in which valid data blocks have been determined in the multiple sub-partitions can be determined as a first sub-partition; a sub-partition other than the first sub-partition in the multiple sub-partitions can be determined as a second sub-partition; a first capacity of the first sub-partition can be determined; a second capacity of the second sub-partition can be determined based on the total capacity and the first capacity of the target storage partition; a target data block in the second sub-partition can be determined based on the number of valid blocks, the first capacity and the second capacity of the valid data blocks in the first sub-partition; and the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition can be migrated. In the above method, the target data block of the second sub-partition can be determined according to the detection result of the first sub-partition, and when the time required to migrate the valid data block in the second sub-partition is short, the valid data block in the second sub-partition is determined as the target data block, and when the time required to migrate the valid data block and the invalid data block in the second sub-partition is short, the valid data block and the invalid data block in the second sub-partition are determined as the target data block. Through the above method, the time required for data migration can be reduced, and the data migration efficiency can be improved.

[0220] Figure 8 This is a structural intention of a data migration device provided in an embodiment of the present application. Figure 8 The data migration device 10 may include a partitioning module 11, a determination module 12 and a migration module 13, wherein:

[0221] The partitioning module 11 is used to divide the target storage partition where the data to be migrated is located into multiple sub-partitions;

[0222] The determination module 12 is used to determine a first sub-partition and a second sub-partition among the multiple sub-partitions;

[0223] The determining module 12 is further configured to determine a target data block in the second sub-partition according to the valid data block in the first sub-partition, wherein the target data block is a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition;

[0224] The migration module 13 is used to migrate valid data blocks in the first sub-partition and target data blocks in the second sub-partition.

[0225] The data migration device provided in this embodiment can be used to execute the data migration method shown in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0226] In a possible implementation, the determining module 12 is specifically configured to:

[0227] Determine valid data blocks in the multiple sub-partitions, and count the number of valid blocks of the valid data blocks and the total time taken to determine the valid data blocks, until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value;

[0228] Determine the sub-partition in which the valid data block has been determined among the multiple sub-partitions as the first sub-partition;

[0229] The sub-partitions other than the first sub-partition among the multiple sub-partitions are determined as the second sub-partitions.

[0230] In a possible implementation, for any of the sub-partitions, the determining module 12 is specifically configured to:

[0231] detecting invalid data blocks in the sub-partition;

[0232] The data between two adjacent invalid data blocks in the sub-partition are determined as the valid data block; and / or the data between the invalid data block closest to the starting address / ending address of the sub-partition and the starting address / ending address of the sub-partition are determined as the valid data block.

[0233] In a possible implementation, the determining module 12 is specifically configured to:

[0234] determining a first capacity of the first sub-partition;

[0235] Determining a second capacity of the second sub-partition according to the total capacity of the target storage partition and the first capacity;

[0236] A target data block in the second sub-partition is determined according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity.

[0237] In a possible implementation, the determining module 12 is specifically configured to:

[0238] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition;

[0239] Determine, according to the second capacity, a second migration duration corresponding to valid data blocks and invalid data blocks in the second sub-partition;

[0240] If the sum of the second migration duration and the preset threshold is less than the first migration duration, determining that the target data block is a valid data block and an invalid data block in the second sub-partition;

[0241] If the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, it is determined that the target data block is a valid data block in the second sub-partition.

[0242] In a possible implementation, the determining module 12 is specifically configured to:

[0243] Determine, according to the number of valid blocks, the first capacity, and the second capacity, a detection duration corresponding to the second sub-partition, and determine a migration duration required to perform a migration operation on valid data blocks in the second sub-partition;

[0244] The sum of the detection duration and the migration duration is determined as the first migration duration.

[0245] In a possible implementation, the determining module 12 is specifically configured to:

[0246] Obtaining a total time taken to determine a valid data block in the first sub-partition;

[0247] Determining a first ratio of the number of valid blocks to the first capacity;

[0248] Determining a second ratio of the total duration to the number of valid blocks;

[0249] The product of the first ratio, the second ratio and the second capacity is determined as the detection duration.

[0250] In a possible implementation, the determining module 12 is specifically configured to:

[0251] Get the migration rate of data;

[0252] Determining a first ratio of the number of valid blocks to the first capacity;

[0253] determining a first product of the second capacity and the first ratio;

[0254] The ratio of the first product to the migration rate is determined as the migration duration.

[0255] In a possible implementation, the determining module 12 is specifically configured to:

[0256] Get the migration rate of data;

[0257] A ratio of the second capacity to the migration rate is determined as the second migration duration.

[0258] In one possible implementation,

[0259] The first sub-partition is one or more consecutive sub-partitions among the multiple sub-partitions; or

[0260] The first sub-partition is one or more discontinuous sub-partitions among the multiple sub-partitions.

[0261] The data migration device provided in this embodiment can be used to execute the data migration method shown in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0262] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 20 may include: a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; exemplarily, the processor 21 and the memory 22 communicate via a communication bus 23, the memory 22 is used to store computer execution instructions, and the processor 21 is used to call the computer execution instructions in the memory to execute the data migration method shown in any of the above method embodiments.

[0263] Optionally, the electronic device 20 may further include a communication interface, which may include a transmitter and / or a receiver.

[0264] The electronic device 20 may be the electronic device shown in any of the above method embodiments.

[0265] Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU), other general-purpose processors, a digital signal processor (DSP), or an application-specific integrated circuit (ASIC). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0266] An embodiment of the present application provides a computer-readable storage medium, on which computer-executable instructions are stored; the computer-executable instructions are used to implement the data migration method as described in any of the above embodiments.

[0267] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above-mentioned data migration method.

[0268] All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviated: ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), optical disc (English: optical disc) and any combination thereof.

[0269] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0270] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0271] These computer program instructions can also be loaded onto a computer or other programmable terminal device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0272] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the embodiments of the present application are also intended to include these modifications and variations.

[0273] In the embodiments of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the element. The term "or" and its variations may refer to "and / or". In the embodiments of the present application, the terms "first", "second", etc. are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. In the embodiments of the present application, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, A and / or B, which may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0274] After considering the invention disclosed in the specification and practice, those skilled in the art will easily think of other embodiments of the present application. The embodiments of the present application are intended to cover any variation, use or adaptive change of the embodiments of the present application, which follows the general principles of the embodiments of the present application and includes common knowledge or conventional technical means in the technical field that are not disclosed in the embodiments of the present application.

Claims

1. A data migration method, characterized in that: include: Divide the target storage partition where the data to be migrated is located into multiple sub-partitions; determining a first sub-partition and a second sub-partition among the plurality of sub-partitions; Determine a target data block in the second sub-partition according to the valid data block in the first sub-partition, wherein the target data block is a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition; The valid data blocks in the first sub-partition and the target data blocks in the second sub-partition are migrated.

2. The method according to claim 1, characterized in that The determining of the first sub-partition and the second sub-partition among the plurality of sub-partitions comprises: Determine valid data blocks in the multiple sub-partitions, and count the number of valid blocks of the valid data blocks and the total time taken to determine the valid data blocks, until the number of valid blocks is greater than a first preset value and / or the total time is greater than a second preset value; Determine the sub-partition in which the valid data block has been determined among the multiple sub-partitions as the first sub-partition; The sub-partitions other than the first sub-partition among the multiple sub-partitions are determined as the second sub-partitions.

3. The method according to claim 2, characterized in that For any one of the sub-partitions, determining a valid data block in the sub-partition includes: detecting invalid data blocks in the sub-partition; The data between two adjacent invalid data blocks in the sub-partition are determined as the valid data block; and / or the data between the invalid data block closest to the starting address / ending address of the sub-partition and the starting address / ending address of the sub-partition are determined as the valid data block.

4. The method according to any one of claims 1 to 3, characterized in that: The determining, according to the valid data blocks in the first sub-partition, the target data blocks in the second sub-partition comprises: determining a first capacity of the first sub-partition; Determining a second capacity of the second sub-partition according to the total capacity of the target storage partition and the first capacity; A target data block in the second sub-partition is determined according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity.

5. The method according to claim 4, characterized in that The determining the target data block in the second sub-partition according to the number of valid blocks of the valid data blocks in the first sub-partition, the first capacity, and the second capacity includes: Determine, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition; Determine, according to the second capacity, a second migration duration corresponding to valid data blocks and invalid data blocks in the second sub-partition; If the sum of the second migration duration and the preset threshold is less than the first migration duration, determining that the target data block is a valid data block and an invalid data block in the second sub-partition; If the sum of the second migration duration and the preset threshold is greater than or equal to the first migration duration, it is determined that the target data block is a valid data block in the second sub-partition.

6. The method according to claim 5, characterized in that The determining, according to the number of valid blocks, the first capacity, and the second capacity, a first migration duration corresponding to the valid data blocks in the second sub-partition includes: Determine, according to the number of valid blocks, the first capacity, and the second capacity, a detection duration corresponding to the second sub-partition, and determine a migration duration required to perform a migration operation on valid data blocks in the second sub-partition; The sum of the detection duration and the migration duration is determined as the first migration duration.

7. The method according to claim 6, characterized in that The determining, according to the number of valid blocks, the first capacity, and the second capacity, a detection duration corresponding to the second sub-partition includes: Obtaining a total time taken to determine a valid data block in the first sub-partition; Determining a first ratio of the number of valid blocks to the first capacity; Determining a second ratio of the total duration to the number of valid blocks; The product of the first ratio, the second ratio and the second capacity is determined as the detection duration.

8. The method according to any one of claims 5 to 7, characterized in that: Determining, according to the second capacity, second migration durations corresponding to valid data blocks and invalid data blocks in the second sub-partition includes: Get the migration rate of data; A ratio of the second capacity to the migration rate is determined as the second migration duration.

9. A data migration device, characterized in that: The data migration device includes a partitioning module, a determination module and a migration module, wherein: The partitioning module is used to divide the target storage partition where the data to be migrated is located into multiple sub-partitions; The determining module is used to determine a first sub-partition and a second sub-partition among the multiple sub-partitions; The determination module is further used to determine a target data block in the second sub-partition according to the valid data block in the first sub-partition, wherein the target data block is a valid data block in the second sub-partition, or a valid data block and an invalid data block in the second sub-partition; The migration module is used to migrate valid data blocks in the first sub-partition and target data blocks in the second sub-partition.

10. An electronic device, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Data migration method and apparatus, and device

    WO2026026002A1