Data migration method and apparatus, and device
By dividing the storage partition into multiple sub-partitions and determining the target data block for migration, the inefficiency caused by excessive time spent probing invalid data in cross-platform data migration is solved, achieving more efficient data migration.
Patent Information
- Application Number
- PCT/CN2025/087522
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-30
- Filing Date
- 2025-04-07
- Publication Date
- 2026-02-05
AI Technical Summary
Existing technologies require a long time to detect invalid data during cross-platform data migration, resulting in low data migration efficiency.
The storage partition containing the data to be migrated is divided into multiple sub-partitions. The first sub-partition and the second sub-partition are determined among these sub-partitions. The target data blocks in the second sub-partition are determined based on the valid data blocks in the first sub-partition and then migrated.
This method reduces the time required for data migration and improves data migration efficiency.
Smart Images

Figure CN2025087522_05022026_PF_FP_ABST
Abstract
Description
Data migration methods, apparatus and equipment
[0001] This application claims priority to Chinese Patent Application No. CN202411036645.0, filed with the Chinese Patent Office on July 30, 2024, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of computing device technology, and in particular to a data migration method, apparatus, and device. Background Technology
[0003] When migrating data across platforms, you can migrate all data on the disk or only the valid data on the disk.
[0004] Currently, to improve data migration efficiency by reducing the amount of data to be migrated, invalid data on the disk can be detected first, and then skipped, migrating only the valid data on the disk. However, if there is a large amount of invalid data on the disk, the time required to detect invalid data is long, and migrating the data on the disk using the above method actually takes more time, resulting in low data migration efficiency. Summary of the Invention
[0005] This application provides a data migration method, apparatus, and device to solve the technical problem of low data migration efficiency.
[0006] In a first aspect, embodiments of this application provide a data migration method, comprising: dividing a target storage partition containing data to be migrated 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 a 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; and migrating the valid data block in the first sub-partition and the target data block in the second sub-partition.
[0007] In the above scheme, the electronic device can divide the target storage partition containing the data to be migrated into multiple sub-partitions; it can determine the first and second sub-partitions among these sub-partitions; it can determine the target data block in the second sub-partition based on the valid data blocks in the first sub-partition; and it can migrate the valid data blocks in the first sub-partition and the target data block in the second sub-partition. This method reduces the time required for data migration and improves data migration efficiency.
[0008] In one possible implementation, determining the first sub-partition and the second sub-partition among the plurality of sub-partitions includes:
[0009] Valid data blocks are determined in the plurality of sub-partitions, and the number of valid data blocks and the total time taken to determine the valid data blocks are counted until 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.
[0010] The sub-partition that has identified the valid data block among the plurality of sub-partitions is determined as the first sub-partition;
[0011] The sub-partitions other than the first sub-partition among the plurality of sub-partitions are determined as the second sub-partition.
[0012] In the above scheme, multiple sub-partitions can be divided into first sub-partitions and second sub-partitions to facilitate the determination of the data to be migrated in each sub-partition.
[0013] In one possible implementation, for any one of the sub-partitions, determining a valid data block within the sub-partition includes:
[0014] Detect invalid data blocks in the sub-partition;
[0015] The data between two adjacent invalid data blocks in the sub-partition is determined as the valid data block; and / or, 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 is determined as the valid data block.
[0016] The above scheme can detect invalid data blocks in sub-partitions and determine valid data blocks in sub-partitions based on invalid data blocks, thus achieving the goal of determining valid data blocks in sub-partitions.
[0017] In one possible implementation, determining the target data block in the second sub-partition based on the valid data blocks in the first sub-partition includes:
[0018] Determine the first capacity of the first sub-partition;
[0019] The second capacity of the second sub-partition is determined based on the total capacity of the target storage partition and the first capacity;
[0020] The target data block in the second sub-partition is determined based on the number of valid data blocks in the first sub-partition, the first capacity, and the second capacity.
[0021] In the above scheme, the target data block in the second sub-partition can be determined based on the number of valid data blocks, the first capacity, and the second capacity in the first sub-partition, thus achieving the purpose of determining the target data block in the second sub-partition.
[0022] In one possible implementation, determining the target data block in the second sub-partition based on the number of valid data blocks in the first sub-partition, the first capacity, and the second capacity includes:
[0023] Based on the number of valid blocks, the first capacity, and the second capacity, determine the first migration duration corresponding to the valid data blocks in the second sub-partition;
[0024] Based on the second capacity, determine the second migration duration corresponding to the valid data blocks and invalid data blocks in the second sub-partition;
[0025] If the sum of the second migration time and the preset threshold is less than the first migration time, the target data block is determined to be a valid data block and an invalid data block in the second sub-partition;
[0026] 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.
[0027] In the above scheme, if the sum of the second migration time and the preset threshold is less than the first migration time, the target data block is determined to be either a valid data block or an invalid data block in the second sub-partition; if the sum of the second migration time and the preset threshold is greater than or equal to the first migration time, the target data block is determined to be a valid data block in the second sub-partition. This scheme achieves the goal of determining the target data block.
[0028] In one possible implementation, determining 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 includes:
[0029] Based on the number of valid blocks, the first capacity, and the second capacity, determine the probe duration corresponding to the second sub-partition, and determine the migration duration required to perform migration operations on the valid data blocks in the second sub-partition;
[0030] The sum of the detection duration and the migration duration is determined to be the first migration duration.
[0031] In the above scheme, the sum of the detection time and the migration time can be determined as the first migration time, thus achieving the purpose of determining the first migration time.
[0032] In one possible implementation, determining the probe duration corresponding to the second sub-partition based on the number of valid blocks, the first capacity, and the second capacity includes:
[0033] The total time taken to determine the valid data blocks in the first sub-partition;
[0034] Determine a first ratio between the number of valid blocks and the first capacity;
[0035] Determine a second ratio of the total duration to the number of valid blocks;
[0036] The product of the first ratio, the second ratio, and the second capacity is determined as the detection duration.
[0037] In the above scheme, the detection duration corresponding to the second sub-partition can be determined based on the number of effective blocks, the first capacity, and the second capacity, thus achieving the purpose of determining the detection duration.
[0038] In one possible implementation, determining the migration time required to migrate valid data blocks in the second sub-partition based on the number of valid blocks, the first capacity, and the second capacity includes:
[0039] Acquire the data migration rate;
[0040] Determine a first ratio between the number of valid blocks and the first capacity;
[0041] Determine the first product of the second capacity and the first ratio;
[0042] The ratio of the first product to the migration rate is determined as the migration duration.
[0043] In the above scheme, the migration time required to migrate the valid data blocks in the second sub-partition can be determined based on the number of valid blocks, the first capacity, and the second capacity, thus achieving the purpose of determining the migration time.
[0044] In one possible implementation, determining the second migration duration corresponding to valid and invalid data blocks in the second sub-partition based on the second capacity includes:
[0045] Acquire the data migration rate;
[0046] The ratio of the second capacity to the migration rate is determined as the second migration duration.
[0047] In the above scheme, the ratio of the second capacity to the migration rate can be determined as the second migration duration, thus achieving the purpose of determining the second migration duration.
[0048] In one possible implementation,
[0049] The first sub-partition is one or more consecutive sub-partitions among the plurality of sub-partitions; or,
[0050] The first sub-partition is one or more non-contiguous sub-partitions among the plurality of sub-partitions.
[0051] In the above scheme, if the first sub-partition is one or more consecutive 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 non-consecutive sub-partitions among multiple sub-partitions, the processing accuracy of the data migration method provided in this application embodiment can be higher.
[0052] Secondly, embodiments of this application provide a data migration apparatus, which includes a partitioning module, a determining module, and a migration module, wherein...
[0053] The partitioning module is used to divide the target storage partition containing the data to be migrated into multiple sub-partitions;
[0054] The determining module is used to determine a first sub-partition and a second sub-partition among the plurality of sub-partitions;
[0055] The determining module is further configured to determine a target data block in the second sub-partition based on 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;
[0056] The migration module is used to migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.
[0057] In the above scheme, the data migration device can divide the target storage partition containing the data to be migrated into multiple sub-partitions; it can determine the first sub-partition and the second sub-partition among the multiple sub-partitions; it can determine the target data block in the second sub-partition based on the valid data block in the first sub-partition; and it can migrate the valid data block in the first sub-partition and the target data block in the second sub-partition. This method reduces the time required for data migration and improves data migration efficiency.
[0058] In one possible implementation, the determining module is specifically used for,
[0059] Valid data blocks are determined in the plurality of sub-partitions, and the number of valid data blocks and the total time taken to determine the valid data blocks are counted until 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.
[0060] The sub-partition that has identified the valid data block among the plurality of sub-partitions is determined as the first sub-partition;
[0061] The sub-partitions other than the first sub-partition among the plurality of sub-partitions are determined as the second sub-partition.
[0062] In the above scheme, multiple sub-partitions can be divided into first sub-partitions and second sub-partitions to facilitate the determination of the data to be migrated in each sub-partition.
[0063] In one possible implementation, for any one of the sub-partitions, the determining module is specifically used to:
[0064] Detect invalid data blocks in the sub-partition;
[0065] The data between two adjacent invalid data blocks in the sub-partition is determined as the valid data block; and / or, 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 is determined as the valid data block.
[0066] The above scheme can detect invalid data blocks in sub-partitions and determine valid data blocks in sub-partitions based on invalid data blocks, thus achieving the goal of determining valid data blocks in sub-partitions.
[0067] In one possible implementation, the determining module is specifically used for,
[0068] Determine the first capacity of the first sub-partition;
[0069] The second capacity of the second sub-partition is determined based on the total capacity of the target storage partition and the first capacity;
[0070] The target data block in the second sub-partition is determined based on the number of valid data blocks in the first sub-partition, the first capacity, and the second capacity.
[0071] In the above scheme, the target data block in the second sub-partition can be determined based on the number of valid data blocks, the first capacity, and the second capacity in the first sub-partition, thus achieving the purpose of determining the target data block in the second sub-partition.
[0072] In one possible implementation, the determining module is specifically used for,
[0073] Based on the number of valid blocks, the first capacity, and the second capacity, determine the first migration duration corresponding to the valid data blocks in the second sub-partition;
[0074] Based on the second capacity, determine the second migration duration corresponding to the valid data blocks and invalid data blocks in the second sub-partition;
[0075] If the sum of the second migration time and the preset threshold is less than the first migration time, the target data block is determined to be a valid data block and an invalid data block in the second sub-partition;
[0076] 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.
[0077] In the above scheme, if the sum of the second migration time and the preset threshold is less than the first migration time, the target data block is determined to be either a valid data block or an invalid data block in the second sub-partition; if the sum of the second migration time and the preset threshold is greater than or equal to the first migration time, the target data block is determined to be a valid data block in the second sub-partition. This scheme achieves the goal of determining the target data block.
[0078] In one possible implementation, the determining module is specifically used for,
[0079] Based on the number of valid blocks, the first capacity, and the second capacity, determine the probe duration corresponding to the second sub-partition, and determine the migration duration required to perform migration operations on the valid data blocks in the second sub-partition;
[0080] The sum of the detection duration and the migration duration is determined to be the first migration duration.
[0081] In the above scheme, the sum of the detection time and the migration time can be determined as the first migration time, thus achieving the purpose of determining the first migration time.
[0082] In one possible implementation, the determining module is specifically used for,
[0083] The total time taken to determine the valid data blocks in the first sub-partition;
[0084] Determine a first ratio between the number of valid blocks and the first capacity;
[0085] Determine a second ratio of the total duration to the number of valid blocks;
[0086] The product of the first ratio, the second ratio, and the second capacity is determined as the detection duration.
[0087] In the above scheme, the detection duration corresponding to the second sub-partition can be determined based on the number of effective blocks, the first capacity, and the second capacity, thus achieving the purpose of determining the detection duration.
[0088] In one possible implementation, the determining module is specifically used for,
[0089] Acquire the data migration rate;
[0090] Determine a first ratio between the number of valid blocks and the first capacity;
[0091] Determine the first product of the second capacity and the first ratio;
[0092] The ratio of the first product to the migration rate is determined as the migration duration.
[0093] In the above scheme, the migration time required to migrate the valid data blocks in the second sub-partition can be determined based on the number of valid blocks, the first capacity, and the second capacity, thus achieving the purpose of determining the migration time.
[0094] In one possible implementation, the determining module is specifically used for,
[0095] Acquire the data migration rate;
[0096] The ratio of the second capacity to the migration rate is determined as the second migration duration.
[0097] In the above scheme, the ratio of the second capacity to the migration rate can be determined as the second migration duration, thus achieving the purpose of determining the second migration duration.
[0098] In one possible implementation,
[0099] The first sub-partition is one or more consecutive sub-partitions among the plurality of sub-partitions; or,
[0100] The first sub-partition is one or more non-contiguous sub-partitions among the plurality of sub-partitions.
[0101] In the above scheme, if the first sub-partition is one or more consecutive 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 non-consecutive sub-partitions among multiple sub-partitions, the processing accuracy of the data migration method provided in this application embodiment can be higher.
[0102] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0103] The memory stores computer-executed instructions;
[0104] The processor executes computer execution instructions stored in the memory, causing the processor to perform the method described in any of the first aspects.
[0105] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any of the first aspects.
[0106] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method shown in any of the first aspects. Attached Figure Description
[0107] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0108] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application;
[0109] Figure 2 is a schematic diagram of data distribution in a disk according to an embodiment of this application;
[0110] Figure 3 is a schematic diagram of cross-platform data migration provided in an embodiment of this application;
[0111] Figure 4 is a flowchart illustrating a data migration method provided in an embodiment of this application;
[0112] Figure 5 is a schematic diagram of a target storage partition provided in an embodiment of this application;
[0113] Figure 6 is a flowchart illustrating another data migration method provided in an embodiment of this application;
[0114] Figure 7 is a schematic diagram of a sub-partition provided in an embodiment of this application;
[0115] Figure 8 is a structural schematic diagram of a data migration device provided in an embodiment of this application;
[0116] Figure 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0117] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates 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 those of this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0118] To facilitate understanding, the technical terms involved in the embodiments of this application will be explained first.
[0119] Virtual Machine (VM): A complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment.
[0120] Cross-platform migration refers to migrating data from one hardware or software platform to another. For example, migrating data corresponding to virtual machines running on one hardware or software platform to another.
[0121] Disk data partitioning: refers to logically dividing disk data into multiple parts, each containing a certain number of data blocks.
[0122] Hole detection: refers to the process of finding invalid data (i.e., holes) with all zeros in binary during disk data migration, in order to reduce the amount of data to be migrated and improve the migration speed.
[0123] Fragments: refer to small, scattered blocks of data stored on a disk that are not contiguous.
[0124] Full migration: refers to migrating all data (including valid data and holes) to the target location all at once without any optimization (e.g., hole detection) during the data migration process.
[0125] For ease of understanding, the application scenarios involved in the embodiments of this application will be described below with reference to Figure 1.
[0126] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application. Referring to Figure 1, platform 1 and platform 2 can be communicatively connected. Platform 1 may include source disk A and source disk B, and platform 2 may include target disk A and target disk B.
[0127] Platform 1 and Platform 2 can be any two software platforms that can communicate. The technical solutions provided in this application do not limit the communication method between Platform 1 and Platform 2. For example, Platform 1 and Platform 2 can communicate through a network link.
[0128] The disks in the platform can be the disks of the physical machine or virtual machine where the platform resides. In other words, the disks in the platform can be the disks of the physical machine or virtual machine where the platform is deployed. For example, source disk A can be the disk of physical machine A where platform 1 resides, or source disk A can be the disk of virtual machine A where platform 1 resides.
[0129] In the above scenario, data on the disks can be migrated across platforms. For example, data on source disk A can be migrated to target disk A across platforms, and data on source disk B can be migrated to target disk B across platforms.
[0130] The data distribution on the disk will be explained below with reference to Figure 2.
[0131] Figure 2 is a schematic diagram of data distribution in a disk according to an embodiment of this application. Referring to Figure 2, the data in the disk may include valid data blocks and invalid data blocks. Valid data blocks can also be referred to as fragments, and invalid data blocks can also be referred to as voids. As shown in Figure 2, invalid data blocks and valid data blocks are distributed alternately in the disk.
[0132] A valid data block can be a data block with actual information content. An invalid data block can be a data block with no actual information content.
[0133] When migrating data across platforms, you can migrate both valid and invalid data blocks on the disk, or you can migrate only the valid data blocks on the disk.
[0134] Currently, to reduce the amount of data migration and thus improve its efficiency, cross-platform data migration can begin by probing the disk to identify invalid and valid data blocks; then, the valid data blocks are migrated. For example, a Software Development Kit (SDK) can be used to probe for invalid data on the disk.
[0135] However, a single disk probe can only identify one invalid data block. If there are many invalid data blocks on the disk, more probes are required. This results in a significant increase in the time required for multiple probes, and the sum of the time spent on multiple probes and the time required to migrate the valid data blocks identified after the probes exceeds the time required to directly migrate all data on the disk (i.e., both valid and invalid data blocks). In other words, migrating only the valid data blocks on the disk actually increases the time required for cross-platform data migration, leading to lower data migration efficiency.
[0136] In view of this, this application proposes a data migration method in which a disk can be divided into multiple storage partitions, and data in the disk can be migrated across platforms on a per-partition basis. When migrating data in any storage partition across platforms, the storage partition can be divided into multiple sub-partitions, and the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition can be migrated across platforms. The multiple sub-partitions include the first sub-partition and the second sub-partition.
[0137] It should be noted that the target data block can be a valid data block in the second sub-partition, or a valid and invalid data block in the second sub-partition. In actual implementation, if the sum of the time required to migrate the valid and invalid data blocks in the second sub-partition and the preset threshold is less than the time required to migrate the valid data blocks in the second sub-partition, then the target data block can be a valid and invalid data block in the second sub-partition; if the sum of the time required to migrate the valid and invalid data blocks in the second sub-partition and the preset threshold is greater than or equal to the time required to migrate the valid data blocks in the second sub-partition, then the target data block can be a valid data block in the second sub-partition. The preset threshold can be set according to actual needs. For example, the preset threshold can be 0, 3, or 5, etc.
[0138] Furthermore, in the above method, if the sum of the time required to migrate valid and invalid data blocks in the second sub-partition and a preset threshold equals the time required to migrate valid data blocks in the second sub-partition, the target data block can be a valid data block in the second sub-partition. In other words, in this case, only valid data blocks in the second sub-partition need to be migrated, without needing to migrate invalid data blocks. This results in less storage space being occupied after data migration.
[0139] When migrating data from disk across platforms using the methods described above, the time required for migration can be reduced, thus improving data migration efficiency.
[0140] The data migration method provided in the embodiments of this application will now be described with reference to Figure 3.
[0141] Figure 3 is a schematic diagram of cross-platform data migration provided in an embodiment of this application. Referring to Figure 3, platform 1 can be deployed in host 1, and platform 1 may include source disk A. Platform 2 can be deployed in host 2, and platform 2 may include target disk A. A data migration system can also run on host 2. For example, the data migration system can run on the processing chip in host 2.
[0142] The host can be an electronic device such as a server, laptop computer, or desktop computer. A server can be, for example, a graphics processing unit (GPU) server or an artificial intelligence (AI) server.
[0143] It should be noted that platform 1 can be deployed on one or more hosts, and platform 2 can also be deployed on one or more hosts. The number of disks in platform 1 and platform 2 can be one or more. Among them, "more" means two or more. Figure 3 is only used to illustrate platform 1 deployed on one host, platform 2 deployed on one host, and the number of disks in platform 1 and platform 2 is one each, and does not constitute a limitation on the technical solution provided in the embodiments of this application.
[0144] In the data migration method provided in this application embodiment, host 2 can use a data migration system to migrate data from source disk A to target disk A across platforms.
[0145] It should be noted that the data migration system can also run on host 1 or on electronic devices other than host 1 and host 2. If the data migration system runs on host 1, host 1 can use the data migration system to migrate data from source disk A to target disk A across platforms. If the data migration system runs on electronic devices other than host 1 and host 2, that electronic device can use the data migration system to migrate data from source disk A to target disk A across platforms. Figure 3 is only used as an example of the data migration system running on host 2 and does not constitute a limitation on the technical solutions provided in the embodiments of this application.
[0146] The technical solutions of the embodiments of this application will be described in detail below with specific examples. These specific examples can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0147] Figure 4 is a flowchart illustrating a data migration method provided in an embodiment of this application. The execution subject of this method can be an electronic device or a data migration system installed in an electronic device. The electronic device can be an electronic device running a data migration system, for example, the electronic device can be host 1 or host 2 as shown in 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 uses an electronic device as the execution subject. Referring to Figure 4, the method may include:
[0148] S401. Divide the target storage partition containing the data to be migrated into multiple sub-partitions.
[0149] The target storage partition can be a storage area on the storage medium of the source platform. The source platform can be the platform where the data to be migrated resided before the migration; the storage medium can be a disk, etc.
[0150] In this embodiment, the storage space on the storage medium of the source platform storing the data to be migrated 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; this embodiment does not limit this.
[0151] If the storage space on the source platform's storage medium containing the data to be migrated is divided into a storage partition, then the target storage partition is that single storage partition. In other words, the target storage partition can be the storage space on the source platform's storage medium that contains all the data to be migrated.
[0152] If the storage space on the source platform's storage medium containing the data to be migrated is divided into multiple storage partitions, then the target storage partition can be any one of these partitions. In other words, the target storage partition can be any storage space on the source platform's storage medium that contains a portion of the data to be migrated.
[0153] After dividing the storage space on the source platform's storage media containing the data to be migrated into multiple storage partitions, data migration can be performed on a partition-by-partition basis. This breaks down the data migration task on the storage space containing the data to be migrated on the source platform's storage media into multiple smaller data migration tasks, facilitating the management and execution of these tasks.
[0154] It should be noted that the method for migrating data in each storage partition is the same for all electronic devices. In this embodiment, the method for data migration performed by the electronic device is described using the target storage partition as an example.
[0155] In this embodiment, the target storage partition can be divided into multiple sub-partitions of a preset size. That is, each sub-partition in the multiple sub-partitions has the same size, and the size of each sub-partition can be equal to the preset size.
[0156] The preset size can be set according to actual needs.
[0157] The following section, with reference to Figure 5, explains the multiple sub-regions within the target storage partition.
[0158] Figure 5 is a schematic diagram of a target storage partition provided in an embodiment of this application. Referring to Figure 5, the target storage partition may include multiple sub-partitions. All sub-partitions are of equal size.
[0159] S402. Determine the first and second sub-partitions among multiple sub-partitions.
[0160] In this embodiment, the electronic device can select a portion of sub-partitions from multiple sub-partitions and determine the valid data blocks within those sub-partitions. The portion of sub-partitions can be one or more sub-partitions. When determining valid data blocks within the portion of sub-partitions, the electronic device can count the number of valid data blocks and the total time spent determining valid data blocks. When the number of valid data blocks exceeds a first preset value and / or the total time exceeds a second preset value, the electronic device can stop determining valid data blocks and can designate the sub-partitions from the multiple sub-partitions where valid data blocks have been determined as the first sub-partition, and the sub-partitions from the multiple sub-partitions where no valid data blocks have been determined as the second sub-partition.
[0161] This embodiment does not limit the size of the first preset value and the second preset value, and they can be set according to actual needs during the specific implementation process.
[0162] In one example, the electronic device can stop determining valid data blocks when the number of valid data blocks exceeds a first preset value or the total duration exceeds a second preset value. This reduces the time required to determine valid data blocks.
[0163] In another example, when the number of valid data blocks exceeds a first preset value and the total duration exceeds a second preset value, the electronic device can stop determining valid data blocks. This ensures more accurate determination of valid data blocks, thereby improving the processing accuracy of the data migration method provided in this application embodiment.
[0164] In this embodiment, the first sub-partition has at least two of the following cases:
[0165] Case 1: The first subpartition can be a contiguous portion of multiple subpartitions.
[0166] In this case, the electronic device can sequentially identify consecutive sub-partitions as the first sub-partition, making the identification of the first sub-partition faster.
[0167] Case 2: The first subpartition can be a non-contiguous part of multiple subpartitions.
[0168] In this case, the electronic device can randomly select some sub-partitions from multiple sub-partitions as the first sub-partition. It should be noted that invalid and valid data blocks in the target storage partition are irregularly distributed. If the electronic device randomly selects some sub-partitions from multiple sub-partitions as the first sub-partition, the processing accuracy of the data migration method provided in this application embodiment can be improved.
[0169] S403. Based on the valid data blocks in the first sub-partition, determine the target data block in the second sub-partition.
[0170] The valid data blocks in the first sub-partition can be the valid data blocks determined in S402.
[0171] 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.
[0172] In one possible implementation, the electronic device can predict the time required to migrate valid data blocks in the second sub-partition based on the number of valid data blocks in the first sub-partition, the first capacity of the first sub-partition, and the second capacity of the second sub-partition. If the sum of the time required to migrate valid and invalid data blocks in the second sub-partition and a preset threshold is less than the time required to migrate valid data blocks in the second sub-partition, then the target data block can be determined to be both a valid and invalid data block in the second sub-partition; if the sum of the time required to migrate valid and invalid data blocks in the second sub-partition and the preset threshold is greater than or equal to the time required to migrate valid data blocks in the second sub-partition, then the target data block can be a valid data block in the second sub-partition.
[0173] It should be noted that the time required to migrate valid data blocks in the second sub-partition can 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 both valid and invalid data blocks in the second sub-partition can be the sum of the time required to perform the migration operation on both valid and invalid data blocks in the second sub-partition.
[0174] The first capacity of the first subpartition can be the sum of the capacities of all first subpartitions. In other words, the first capacity can be the sum of the capacities of the subpartitions from which valid data blocks have been identified.
[0175] The second capacity of the second sub-partition can be the difference between the total capacity of the target storage partition and the first capacity. In other words, the second capacity can be the sum of the capacities of the sub-partitions among the multiple sub-partitions for which no valid data blocks have been determined.
[0176] It should be noted that the method by which the electronic device predicts the time required to migrate valid data blocks in the second sub-partition based on the number of valid data blocks, the first capacity, and the second capacity in the first sub-partition, as well as the explanation of the preset threshold, can be found in the embodiment shown in Figure 6, and will not be repeated here.
[0177] In this embodiment, the target data block in the second sub-partition can be dynamically determined based on the determination result of the valid data blocks in the first sub-partition. Specifically, if, based on the determination result of the valid data blocks in the first sub-partition, it is predicted that the time required to continue determining the valid data blocks in the second sub-partition will be long, the determination of the valid data blocks in the second sub-partition can be stopped in a timely manner, and the valid and invalid data blocks in the second sub-partition can be determined as the target data blocks. In this way, the time spent determining the valid data blocks can be avoided, the data migration time in the second sub-partition can be reduced, and the data migration efficiency in the second sub-partition can be improved, thereby improving the data migration efficiency in the target storage partition and storage medium. In addition, dynamically determining the target data block in the second sub-partition can make the data migration in the target storage partition more flexible.
[0178] S404. Migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.
[0179] In this embodiment, the electronic device can migrate valid data blocks in the first sub-partition and target data blocks in the second sub-partition from the storage medium of the source platform to the storage medium of the destination platform, thereby achieving cross-platform data migration. The destination platform can be the platform where the migrated data will reside after the migration.
[0180] 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; it can determine the first sub-partition and the second sub-partition among the multiple sub-partitions; it can determine the target data block in the second sub-partition based on the valid data block in the first sub-partition; and it can migrate the valid data block in the first sub-partition and the target data block in the second sub-partition. This method reduces the time required for data migration and improves data migration efficiency.
[0181] Based on the above embodiments, the data migration method provided in this application embodiment will be further described below with reference to FIG6, and the method for the electronic device to predict the time required to migrate the valid data blocks in the second sub-partition based on the number of valid blocks, the first capacity and the second capacity of the valid data blocks in the first sub-partition will be described.
[0182] Figure 6 is a flowchart illustrating another data migration method provided in an embodiment of this application. The execution subject of this method can be an electronic device or a data migration system installed in an electronic device. The electronic device can be an electronic device running a data migration system, for example, the electronic device can be host 1 or host 2 as shown in 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 uses an electronic device as the execution subject. Referring to Figure 6, the method may include:
[0183] S601. Divide the target storage partition containing the data to be migrated into multiple sub-partitions.
[0184] It should be noted that the implementation of S601 can be found in S401, and will not be repeated here.
[0185] S602. Determine valid data blocks in multiple sub-partitions, and count the number of valid data blocks and the total time taken to determine 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.
[0186] It should be noted that the method for determining valid data blocks is the same in each subpartition. Below, we will use any one subpartition as an example to explain the method for determining valid data blocks in a subpartition.
[0187] When determining valid data blocks in any subpartition, the electronic device can perform probing on the subpartition to detect invalid data blocks; and determine valid data blocks in the subpartition based on the invalid data blocks.
[0188] The detection process can be used for hole detection. It should be understood that electronic devices can identify invalid data blocks in sub-partitions through hole detection.
[0189] Specifically, electronic devices can use the SDK to probe and process sub-partitions.
[0190] When determining valid data blocks in a subpartition based on invalid data blocks, the electronic device may determine the data between two adjacent invalid data blocks in the subpartition as valid data blocks; and / or, determine the data between the invalid data block closest to the start / end address of the subpartition and the start / end address of the subpartition as valid data blocks.
[0191] The following section, with reference to Figure 7, explains the invalid and valid data blocks in the sub-partition.
[0192] Figure 7 is a schematic diagram of a sub-partition provided in an embodiment of this application. Referring to Figure 7, data blocks 1 and 3 in the sub-partition are invalid data blocks, while data blocks 2 and 4 are valid data blocks.
[0193] In actual implementation, electronic devices can determine that data block 1 and data block 3 are two adjacent invalid data blocks through detection processing. The data between data block 1 and invalid data block 3 (i.e., data block 2) can be determined as a valid data block, and the data between data block 3 and the sub-partition termination address (i.e., data block 4) can be determined as a valid data block.
[0194] S603. Among multiple sub-partitions, the sub-partition that has been identified as having valid data blocks is designated as the first sub-partition.
[0195] S604. Select the sub-partitions other than the first sub-partition from the multiple sub-partitions as the second sub-partition.
[0196] S605. Determine the valid data blocks in the first sub-partition.
[0197] It should be noted that the specific implementation methods of S603-S605 can be found in S402-S403, and will not be repeated here.
[0198] S606. Determine the first capacity of the first sub-partition.
[0199] In this embodiment, each sub-partition is the same size, which is equal to the preset size.
[0200] The electronic device can determine the first capacity by multiplying the number of the first sub-partitions by a preset size.
[0201] S607. Determine the second capacity of the second sub-partition based on the total capacity and the first capacity of the target storage partition.
[0202] It should be understood that when an electronic device divides the storage space on the storage medium of the source platform where the data to be migrated is stored into one or more storage partitions, the total capacity of the target storage partition can be determined.
[0203] In this embodiment, the electronic device can determine the second capacity as the difference between the total capacity and the first capacity.
[0204] S608. Determine the target data block in the second sub-partition based on the number of valid data blocks, the first capacity, and the second capacity in the first sub-partition.
[0205] 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 a 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.
[0206] The first migration duration can be the time required to migrate the valid data blocks in the second sub-partition. In other words, the first migration duration can 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.
[0207] The second migration duration can be the time required to migrate the valid and invalid data blocks in the second sub-partition. In other words, the second migration duration can be the time required to perform the migration operation on the valid and invalid data blocks in the second sub-partition.
[0208] The preset threshold can be the time saved when migrating data in the second sub-partition, compared to first determining the valid data blocks in the second sub-partition and then performing migration operations on the valid data blocks in the second sub-partition. Instead, it can be the time saved by directly performing migration operations on all data blocks in the second sub-partition.
[0209] It should be noted that the preset threshold can be set according to actual needs. Furthermore, compared to first identifying the valid data blocks in the second sub-partition and then performing migration operations on those valid data blocks, directly performing migration operations on all data blocks in the second sub-partition requires migrating more data and occupies more storage space after data migration. Therefore, the preset threshold can be an optimization parameter that trades space for time, and the specific value of this optimization parameter can be set according to actual needs.
[0210] 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 probe 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; the sum of the probe duration and the migration duration is determined to be the first migration duration.
[0211] The probe duration for the second sub-partition can be the time required to determine the valid data blocks in the second sub-partition.
[0212] In the 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 probe time. In other words, the probe time can be determined using the following formula:
[0213] Detection duration = (Number of valid blocks) / (First capacity) × (Total duration) / (Number of valid blocks) × (Second capacity)
[0214] In the specific implementation process, the data migration rate 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 time. In other words, the migration time can be determined using the following formula:
[0215] Migration time = ("Number of valid blocks" / "First capacity" × "Second capacity") / "Migration rate"
[0216] The migration rate can be the rate at which an electronic device migrates data. The migration rate can be stored within the electronic device. In practice, the electronic device can obtain the migration rate locally.
[0217] In this embodiment, when the electronic device determines the second migration duration corresponding to the valid and invalid data blocks in the second sub-partition based on the second capacity, it can obtain the data migration rate; the ratio of the second capacity to the migration rate is then determined as the second migration duration. That is, the second migration duration can be determined using the following formula:
[0218] Second migration duration = "Second capacity" / "Migration rate"
[0219] S609. Migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.
[0220] 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; it can determine valid data blocks in the multiple sub-partitions, and count the number of valid data blocks and the total time occupied when determining 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; it can determine the sub-partitions in the multiple sub-partitions where valid data blocks have been determined as the first sub-partition; it can determine the sub-partitions in the multiple sub-partitions other than the first sub-partition as the second sub-partitions; it can determine the first capacity of the first sub-partition; it can determine the second capacity of the second sub-partition based on the total capacity and the first capacity of the target storage partition; it can determine the target data blocks in the second sub-partition based on the number of valid data blocks, the first capacity and the second capacity of the valid data blocks in the first sub-partition; and it can migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition. In the above method, the target data block of the second sub-partition can be determined based on the detection results of the first sub-partition. When the time required to migrate the valid data blocks in the second sub-partition is short, the valid data blocks in the second sub-partition are identified as the target data blocks. Conversely, when the time required to migrate both valid and invalid data blocks in the second sub-partition is short, both valid and invalid data blocks in the second sub-partition are identified as the target data blocks. This method reduces the time required for data migration and improves data migration efficiency.
[0221] Figure 8 is a structural schematic diagram of a data migration apparatus provided in an embodiment of this application. Referring to Figure 8, the data migration apparatus 10 may include a partitioning module 11, a determining module 12, and a migration module 13, wherein...
[0222] The partitioning module 11 is used to divide the target storage partition where the data to be migrated is located into multiple sub-partitions;
[0223] The determining module 12 is used to determine the first sub-partition and the second sub-partition among the plurality of sub-partitions;
[0224] The determining module 12 is further configured to determine a target data block in the second sub-partition based on 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;
[0225] The migration module 13 is used to migrate the valid data blocks in the first sub-partition and the target data blocks in the second sub-partition.
[0226] The data migration apparatus provided in this embodiment can be used to execute the data migration method shown in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0227] In one possible implementation, the determining module 12 is specifically used for,
[0228] Valid data blocks are determined in the plurality of sub-partitions, and the number of valid data blocks and the total time taken to determine the valid data blocks are counted until 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.
[0229] The sub-partition that has identified the valid data block among the plurality of sub-partitions is determined as the first sub-partition;
[0230] The sub-partitions other than the first sub-partition among the plurality of sub-partitions are determined as the second sub-partition.
[0231] In one possible implementation, for any one of the sub-partitions, the determining module 12 is specifically used to:
[0232] Detect invalid data blocks in the sub-partition;
[0233] The data between two adjacent invalid data blocks in the sub-partition is determined as the valid data block; and / or, 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 is determined as the valid data block.
[0234] In one possible implementation, the determining module 12 is specifically used for,
[0235] Determine the first capacity of the first sub-partition;
[0236] The second capacity of the second sub-partition is determined based on the total capacity of the target storage partition and the first capacity;
[0237] The target data block in the second sub-partition is determined based on the number of valid data blocks in the first sub-partition, the first capacity, and the second capacity.
[0238] In one possible implementation, the determining module 12 is specifically used for,
[0239] Based on the number of valid blocks, the first capacity, and the second capacity, determine the first migration duration corresponding to the valid data blocks in the second sub-partition;
[0240] Based on the second capacity, determine the second migration duration corresponding to the valid data blocks and invalid data blocks in the second sub-partition;
[0241] If the sum of the second migration time and the preset threshold is less than the first migration time, the target data block is determined to be a valid data block and an invalid data block in the second sub-partition;
[0242] 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.
[0243] In one possible implementation, the determining module 12 is specifically used for,
[0244] Based on the number of valid blocks, the first capacity, and the second capacity, determine the probe duration corresponding to the second sub-partition, and determine the migration duration required to perform migration operations on the valid data blocks in the second sub-partition;
[0245] The sum of the detection duration and the migration duration is determined to be the first migration duration.
[0246] In one possible implementation, the determining module 12 is specifically used for,
[0247] The total time taken to determine the valid data blocks in the first sub-partition;
[0248] Determine a first ratio between the number of valid blocks and the first capacity;
[0249] Determine a second ratio of the total duration to the number of valid blocks;
[0250] The product of the first ratio, the second ratio, and the second capacity is determined as the detection duration.
[0251] In one possible implementation, the determining module 12 is specifically used for,
[0252] Acquire the data migration rate;
[0253] Determine a first ratio between the number of valid blocks and the first capacity;
[0254] Determine the first product of the second capacity and the first ratio;
[0255] The ratio of the first product to the migration rate is determined as the migration duration.
[0256] In one possible implementation, the determining module 12 is specifically used for,
[0257] Acquire the data migration rate;
[0258] The ratio of the second capacity to the migration rate is determined as the second migration duration.
[0259] In one possible implementation,
[0260] The first sub-partition is one or more consecutive sub-partitions among the plurality of sub-partitions; or,
[0261] The first sub-partition is one or more non-contiguous sub-partitions among the plurality of sub-partitions.
[0262] The data migration apparatus provided in this embodiment can be used to execute the data migration method shown in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0263] Figure 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. As shown in Figure 9, the electronic device 20 may include a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can communicate; for example, the processor 21 and the memory 22 communicate through 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.
[0264] Optionally, the electronic device 20 may also include a communication interface, which may include a transmitter and / or a receiver.
[0265] The electronic device 20 can be any of the electronic devices shown in the above method embodiments.
[0266] Optionally, the aforementioned processor can be a central processing unit (CPU), a graphics processing unit (GPU), other general-purpose processors, digital signal processors (DSPs), or application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0267] This application provides a computer-readable storage medium storing computer-executable instructions; the computer-executable instructions are used to implement the data migration method as described in any of the above embodiments.
[0268] This application provides a computer program product, which includes a computer program that, when executed, causes a computer to perform the data migration method described above.
[0269] All or part of the steps in the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-described method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.
[0270] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable terminal device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable terminal device, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.
[0271] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0272] These computer program instructions may also be loaded onto a computer or other programmable terminal equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable equipment, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0273] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of the claims of this application and their equivalents, the embodiments of this application are also intended to include these modifications and variations.
[0274] In the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. The term "or" and its variations can mean "and / or." In the embodiments of this application, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In the embodiments of this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0275] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the invention disclosed in the specification and in practice. The embodiments of this application are intended to cover any variations, uses, or adaptations of the embodiments of this application that follow the general principles of the embodiments of this application and include common knowledge or customary technical means in the art not disclosed in the embodiments of this application.
Claims
1. A data migration method, characterized by, The method comprises the following steps: dividing a target storage partition where data to be migrated is located into a plurality of sub-partitions; determining a first sub-partition and a second sub-partition in the plurality of sub-partitions; determining a target data block in the second sub-partition according to valid data blocks in the first sub-partition, the target data block being valid data blocks in the second sub-partition or valid data blocks and invalid data blocks in the second sub-partition; migrating valid data blocks in the first sub-partition and the target data block in the second sub-partition.
2. The method of claim 1, wherein, The step of determining the first sub-partition and the second sub-partition in the plurality of sub-partitions comprises the following steps: determining valid data blocks in the plurality of sub-partitions, and counting a valid block quantity of the valid data blocks and counting a total time length occupied when the valid data blocks are determined, until the valid block quantity is greater than a first preset value and / or the total time length is greater than a second preset value; determining a sub-partition in which the valid data blocks are determined in the plurality of sub-partitions as the first sub-partition; determining sub-partitions other than the first sub-partition in the plurality of sub-partitions as the second sub-partition.
3. The method of claim 2, wherein, For any one of the sub-partitions, the step of determining valid data blocks in the sub-partition comprises the following steps: detecting invalid data blocks in the sub-partition; determining data between two adjacent invalid data blocks in the sub-partition as the valid data blocks; and / or, determining data between the invalid data block closest to the start address / terminal address of the sub-partition and the start address / terminal address of the sub-partition as the valid data blocks.
4. The method according to any one of claims 1 to 3, characterized in that, The step of determining the target data block in the second sub-partition according to the valid data blocks in the first sub-partition comprises the following steps: determining a first capacity of the first sub-partition; determining a second capacity of the second sub-partition according to a total capacity of the target storage partition and the first capacity; determining the target data block in the second sub-partition according to the valid block quantity of the valid data blocks in the first sub-partition, the first capacity and the second capacity.
5. The method of claim 4, wherein, The step of determining the target data block in the second sub-partition according to the valid block quantity of the valid data blocks in the first sub-partition, the first capacity and the second capacity comprises the following steps: determining a first migration time length corresponding to valid data blocks in the second sub-partition according to the valid block quantity, the first capacity and the second capacity; determining a second migration time length corresponding to valid data blocks and invalid data blocks in the second sub-partition according to the second capacity; if a sum of the second migration time length and a preset threshold value is less than the first migration time length, determining that the target data block is the valid data blocks and the invalid data blocks in the second sub-partition; if the sum of the second migration time length and the preset threshold value is greater than or equal to the first migration time length, determining that the target data block is the valid data blocks in the second sub-partition.
6. The method of claim 5, wherein, The step of determining the first migration time length corresponding to the valid data blocks in the second sub-partition according to the valid block quantity, the first capacity and the second capacity comprises the following steps: determine a detection time length corresponding to the second sub-partition according to the effective block quantity, the first capacity and the second capacity, and determine a migration time length required for performing a migration operation on the effective data blocks in the second sub-partition; determine a sum of the detection time length and the migration time length as the first migration time length.
7. The method of claim 6, wherein, The determining of the detection time length corresponding to the second sub-partition according to the effective block quantity, the first capacity and the second capacity comprises: obtaining a total time length occupied when the effective data blocks in the first sub-partition are determined; determining a first ratio of the effective block quantity to the first capacity; determining a second ratio of the total time length to the effective block quantity; determining a product of the first ratio, the second ratio and the second capacity as the detection time length.
8. The method according to any one of claims 5-7, characterized in that, The determining of the second migration time length corresponding to the effective data blocks and the invalid data blocks in the second sub-partition according to the second capacity comprises: obtaining a migration rate of data; determining a ratio of the second capacity to the migration rate as the second migration time length.
9. A data migration apparatus, characterized by comprising: The data migration apparatus comprises a division module, a determination module and a migration module, wherein, the division module is configured to divide a target storage partition where the data to be migrated is located into a plurality of sub-partitions; the determination module is configured to determine a first sub-partition and a second sub-partition from the plurality of sub-partitions; the determination module is further configured to determine a target data block in the second sub-partition according to the effective data blocks in the first sub-partition, the target data block being the effective data blocks in the second sub-partition or the effective data blocks and the invalid data blocks in the second sub-partition; the migration module is configured to migrate the effective data blocks in the first sub-partition and the target data blocks in the second sub-partition.
10. An electronic device, comprising: comprise: a memory and a processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the method in any one of claims 1-8.
Citation Information
Patent Citations
Cloud host online migration method and device, equipment and storage medium
CN115357194A
Adaptive container thermal migration method based on application features
CN117573274A
Automatic virtual host migration method oriented to cloud computing environment
CN118152071A
Data migration method, device and equipment
CN119088289A