Data migration method and device and electronic equipment
By establishing multiple data migration links in data migration and using segmentation algorithms, mutex locks and hashing algorithms, problems of low data migration efficiency and difficult to guarantee data security in the prior art are solved, and efficient and secure data migration is achieved.
Patent Information
- Application Number
- CN202411998373.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
AI Technical Summary
Existing data migration methods are inefficient and data security and integrity are difficult to guarantee during the migration process.
By establishing multiple data migration links between at least two cache disks and two hard disk drives, the data is divided into load-balanced segmented data blocks using a segmented algorithm, and parallel migration and verification are performed using mutex and hash algorithms.
It significantly improves the efficiency of data migration and enhances data security and integrity during data migration.
Smart Images

Figure CN119987658A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a data migration method, device and electronic device. Background Art
[0002] The current data migration method is to copy the data in the cache disk to the mounted hard disk drive. There are fewer data transmission paths between the cache disk and the hard disk drive, which leads to a slow data migration process and the inability to guarantee the security and integrity of the data migration process. Therefore, the current data migration method has the problems of low data migration efficiency and low data security and integrity during the data migration process. Summary of the invention
[0003] Embodiments of the present application provide a data migration method, device, and electronic device.
[0004] According to a first aspect of the present application, a data migration method is provided, the method comprising: obtaining at least two cache disks and at least two hard disk drives where data to be migrated is located;
[0005] Establishing a first data migration link between a first cache disk and a data temporary storage area of a first hard disk drive; mounting the first hard disk drive on the first cache disk;
[0006] Based on the second hard disk drive mounted on the second cache disk, a second data migration link is established between the first cache disk and the data temporary storage area of the second hard disk drive; the data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
[0007] According to an embodiment of the present application, the method further includes:
[0008] Based on a segmentation algorithm, the data in the first cache disk is divided into a plurality of load-balanced segmented data blocks;
[0009] Migrating the segmented data blocks to the first hard disk drive and the second hard disk drive in parallel based on the first data migration link and the second data migration link;
[0010] The hard disk drive at least comprises a temporary data storage area and a main data storage area. The temporary data storage area is used to temporarily store data in the cache disk. The storage space of the main data storage area is larger than the storage space of the temporary data storage area.
[0011] According to an embodiment of the present application, the method further includes:
[0012] The data transmission process of the first data migration link and the second data migration link is controlled by a mutex lock.
[0013] According to an embodiment of the present application, the method further includes:
[0014] Based on a segmentation algorithm, the data in the first cache disk is divided into a plurality of load-balanced segmented data blocks;
[0015] Based on the first data migration link and the second data migration link, the segmented data blocks are migrated to the first hard disk drive and the second hard disk drive in a mutually exclusive and parallel manner.
[0016] According to an embodiment of the present application, the method further includes:
[0017] Based on the first data migration link and the second data migration link, the data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in parallel.
[0018] According to an embodiment of the present application, after migrating the data in the first hard disk drive and the second hard disk drive to the first cache disk in parallel, the method further includes:
[0019] Deleting data in the data temporary storage area of the first hard disk drive;
[0020] deleting data in the data temporary storage area of the second hard disk drive;
[0021] The second data migration link is deleted.
[0022] According to an embodiment of the present application, the method further includes:
[0023] Based on the first data migration link and the second data migration link, the data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in the mutually exclusive and parallel manner.
[0024] According to an embodiment of the present application, the method further includes:
[0025] After completing the data migration through the first data migration link and the second data migration link, data verification is performed on the data after the data migration through a hash algorithm.
[0026] According to a second aspect of the present application, a data migration device is provided, the data migration device comprising:
[0027] An acquisition module, used for acquiring at least two cache disks and at least two hard disk drives where the data to be migrated is located;
[0028] A first establishing module is used to establish a first data migration link between a first cache disk and a data temporary storage area of a first hard disk drive; the first hard disk drive is mounted on the first cache disk;
[0029] The second establishment module is used to establish a second data migration link between the first cache disk and the data temporary storage area of the second hard disk drive based on the second hard disk drive mounted on the second cache disk; the data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
[0030] According to a third aspect of the present application, an electronic device is provided, including:
[0031] at least one processor; and
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present application.
[0034] According to a fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become readily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, wherein:
[0036] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0037] Figure 1 The following is a schematic diagram showing the processing flow of the data migration method provided in the embodiment of the present application. Figure 1 ;
[0038] Figure 2 The following is a schematic diagram showing the processing flow of the data migration method provided in the embodiment of the present application. Figure 2 ;
[0039] Figure 3 The following is a schematic diagram showing the processing flow of the data migration method provided in the embodiment of the present application. Figure 3 ;
[0040] Figure 4The following is a schematic diagram showing the processing flow of the data migration method provided in the embodiment of the present application. Figure 4 ;
[0041] Figure 5 The following is a schematic diagram showing the processing flow of the data migration method provided in the embodiment of the present application. Figure 5 ;
[0042] Figure 6 An application scenario diagram of the data migration method provided in an embodiment of the present application is shown;
[0043] Figure 7 An optional schematic diagram of a data migration device provided in an embodiment of the present application is shown;
[0044] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0045] In order to make the purpose, features, and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0046] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0047] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0049] The processing flow of the data migration method provided in the embodiment of the present application is described. Figure 1 , Figure 1 The processing flow diagram of the data migration method provided in the embodiment of the present application is as follows: Figure 1 , will combine Figure 1 Steps S101-S103 are shown for explanation.
[0050] Step S101, obtaining at least two cache disks and at least two hard disk drives where data to be migrated is located.
[0051] In some embodiments, the cache disk can be a high-speed storage device for temporarily storing data. The cache disk can be a solid-state drive (SSD). The transfer rate of the cache disk is greater than that of a hard disk drive (HDD). The hard disk drive can be used for long-term storage of data.
[0052] Step S102, establishing a first data migration link between a first cache disk and a data temporary storage area of a first hard disk drive; the first hard disk drive is mounted on the first cache disk.
[0053] In some embodiments, the hard disk drive may include a data temporary storage area and a main data storage area, the data temporary storage area is used to temporarily store data in the cache disk, and the main data storage area is used to store data for a long time. The storage space of the main data storage area is larger than the storage space of the data temporary storage area. The hard disk drive mounted on the cache disk may include: the cache disk is set as a cache of multiple hard disk drives. The cache disk can store copies of data in the main data storage area of the hard disk drive, and when data on the hard disk drive is requested, the data copy in the cache disk is read preferentially. The data temporary storage area of the first hard disk drive is enabled when the first data migration link transmits data. In the system creation partition, the first hard disk drive is divided into a data temporary storage area and a main data storage area, and the internal data of the data temporary storage area is empty when no data migration is performed.
[0054] Step S103, based on the second hard disk drive mounted on the second cache disk, establish a second data migration link between the first cache disk and the data temporary storage area of the second hard disk drive; the data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
[0055] In some embodiments, there may be other hard disk drives that do not use temporary data storage areas in the electronic device. Based on the hardware environment of the electronic device, determine the hard disk drives that do not use temporary data storage areas, and add a data link mapping relationship between the cache disk and the data temporary storage area of the hard disk drive that does not use temporary data storage areas to form a second data migration link. In the system creation partition, the second hard disk drive is divided into a temporary data storage area and a main data storage area, and the internal data of the temporary data storage area is empty when no data migration is performed. Establishing the second data migration link between the first cache disk and the temporary data storage area of the second hard disk drive may include establishing a mapping relationship between the first cache disk and the second hard disk drive. The second cache disk may be set as a cache of the second hard disk drive. The second cache disk may store a copy of the data in the main data storage area of the second hard disk drive, and when the data on the second hard disk drive is requested, the copy of the data in the second cache disk is read preferentially. Parallel data transmission may include: at least two data migration links work simultaneously and transmit data independently. The first data migration link may include: a data migration path connecting the first cache disk and the temporary data storage area of the first hard disk drive, used to migrate the data to be migrated from the first cache disk to the first hard disk drive, or used to migrate the data to be migrated from the first hard disk drive to the first cache disk. The second data migration link may include: a data migration path connecting the data temporary storage area of the first cache disk and the second hard disk drive, used to migrate the data to be migrated from the first cache disk to the second hard disk drive, or used to migrate the data to be migrated from the second hard disk drive to the first cache disk. The second data migration link can be completed by writing a script to change the disk definition. The second data migration link can be stored as a map (data transfer link) file.
[0056] The method of the embodiment of the present application establishes multiple data migration links through at least two cache disks and a hard disk drive, realizes bidirectional parallel data migration, significantly improves the efficiency of data migration, and at the same time enhances the data security and integrity during the data migration process through the parallel transmission capability of multiple links.
[0057] In some embodiments, the processing flow of the data migration method is shown as follows: Figure 2 ,like Figure 2 As shown, the data migration method may specifically include:
[0058] Step S201: based on a segmentation algorithm, divide the data in the first cache disk into a plurality of load-balanced segmented data blocks.
[0059] Step S202: Migrate the segmented data blocks to the first hard disk drive and the second hard disk drive in parallel based on the first data migration link and the second data migration link.
[0060] In this embodiment, the segmentation algorithm may include: a method for dividing the data in the first cache disk into smaller data blocks. The segmented data blocks may include: smaller data units divided according to the segmentation algorithm. The segmented data blocks may be processed or transmitted independently. The first data migration link and the second data migration link may transmit multiple segmented data blocks in parallel. Each data migration link may be responsible for transmitting a portion of the segmented data blocks.
[0061] As an example, take an electronic device as an example. The electronic device is equipped with a total of 2 NVMe cache disks, of which NVMe1 mounts three hard disk drives HDD1, HDD2 and HDD3, and NVMe2 cache disk mounts three hard disk drives HDD4, HDD5 and HDD6. NVMe1 cache disk can be divided into three parts: NVMe1-part1, NVMe1-part2 and NVMe1-part3. NVMe2 cache disk can be divided into three parts: NVMe2-part1, NVMe2-part2 and NVMe2-part3. HDD can be divided into HDD*-part1 (data temporary storage area) and HDD*-part2 (main data storage area). Among them, * represents the number of HDDs. In this example, * can be 1, 2, 3, 4, 5, 6. For example, when the data on NVMe1part1 is migrated, a first data migration link is established between NVMe1part1 and HDD1-part1, and a second data migration link is established between NVMe1part1 and HDD4-part1. Based on the segmentation algorithm, the data in NVMe1part1 is divided into multiple load-balanced segmented data blocks. Based on the first data migration link and the second data migration link, the segmented data blocks are migrated to HDD1-part1 and HDD4-part1 in parallel. The data segments on NVMe1part2 are migrated to HDD2-part1 and HDD5-part1. NVMe1part3 is analogous and will not be described here.
[0062] The method of the embodiment of the present application introduces a segmentation algorithm to evenly distribute data to multiple data blocks, and uses multiple data migration links to migrate these data blocks in parallel, thereby optimizing data load distribution and improving the efficiency of data migration. At the same time, it ensures load balancing during data migration and enhances data security and integrity during data migration.
[0063] In some embodiments, the data migration method may further include: controlling the data transmission process of the first data migration link and the second data migration link by using a mutex lock.
[0064] As an example, the data on NVMe1-part1 is first evenly segmented to obtain segmented data segments, and then the segmented data segments are migrated to HDD1-part1 and HDD4-part1 respectively through two parallel links, namely the first data migration link and the second data migration link. During the data transmission process, when a data segment is being transferred from NVMe1-part1 to HDD1-part1 or HDD4-part1, the mutex lock will prevent other data segments from accessing HDD1-part1 or HDD4-part1 until the current data segment is transferred. When transferring the data on HDD1-part1 and HDD4-part1 to NVMe1-part1, the mutex lock is also used to control the data transmission process, which will not be repeated here.
[0065] In some embodiments, the processing flow of the data migration method is shown as follows: Figure 3 ,like Figure 3 As shown, the data migration method may further include:
[0066] Step S301: based on a segmentation algorithm, divide the data in the first cache disk into a plurality of load-balanced segmented data blocks.
[0067] Step S302 : Based on the first data migration link and the second data migration link, the segmented data blocks are migrated to the first hard disk drive and the second hard disk drive in a mutually exclusive and parallel manner.
[0068] In this embodiment, the segmentation algorithm can divide the data in the first cache disk into multiple load-balanced segmented data blocks according to the size of the data in the first cache disk, and the segmented data blocks can be transmitted simultaneously on multiple data migration links. The mutex lock may include: when a thread holds a mutex lock, no other thread can enter the code area protected by the lock until the mutex lock is released, and the mutex lock can be used to ensure the consistency of the transmitted data.
[0069] As an example, the data on NVMe1-part1 is first evenly segmented to obtain segmented data segments, and then the segmented data segments are migrated to HDD1-part1 and HDD4-part1 respectively through two parallel links, the first data migration link and the second data migration link. During the data transmission process, the transmission thread must request a mutex lock before starting to write to HDD1-part1 or HDD4-part1. The transmission thread successfully obtains the mutex lock, and the transmission thread can transfer data from NVMe1-part1 to HDD1-part1 or HDD4-part1. After the data transmission is completed, the transmission thread releases the mutex lock, allowing other threads to obtain the mutex lock and perform the corresponding data transmission.
[0070] The method of the embodiment of the present application ensures the consistency and integrity of data during parallel migration by applying a mutex mechanism during the data migration process, prevents data conflicts, and ensures load balancing during the data migration process, thereby enhancing data security and integrity during the data migration process.
[0071] In some embodiments, the processing flow of the data migration method is shown as follows: Figure 4 ,like Figure 4 As shown, the data migration method may further include:
[0072] Step S401 : Based on the first data migration link and the second data migration link, data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in parallel.
[0073] Step S402, deleting data in the data temporary storage area of the first hard disk drive.
[0074] Step S403, deleting the data in the data temporary storage area of the second hard disk drive.
[0075] Step S404: delete the second data migration link.
[0076] As an example, take the migration of data in HDD1-part1 and HDD4-part1 to NVMe1-part1. After the segmented data blocks are migrated to HDD1-part1 and HDD4-part1 in parallel, the data in HDD1-part1 and HDD4-part1 are migrated to NVMe1-part1 in parallel through the first data migration link and the second data migration link. After all the data in HDD1-part1 and HDD4-part1 are migrated to NVMe1-part1, the data in HDD1-part1 and HDD4-part1 are deleted, and the map file where the second data migration link is located is deleted.
[0077] As an example, take the migration of data in HDD1 and HDD4 to NVMe1. After the segmented data blocks are migrated to HDD1-part1 and HDD4-part1 in parallel, the NVMe1 cache disk is replaced with an NVMe_NEW cache disk, and the data in HDD1-part1 and HDD4-part1 are migrated to NVMe1-part1 of the NVMe_NEW cache disk in parallel through the first data migration link and the second data migration link. After all the data in HDD1-part1 and HDD4-part1 are migrated to the NVMe_NEW cache disk NVMe1-part1, the data in HDD1-part1 and HDD4-part1 are deleted, and the map file where the second data migration link is located is deleted. By analogy, the data on HDD2-part1 and HDD5-part1 are migrated to NVMe1-part2 of the NVMe_NEW cache disk, and the data on HDD3-part1 and HDD6-part1 are migrated to NVMe1-part3 of the NVMe_NEW cache disk.
[0078] The method of the embodiment of the present application, during the data migration process, only establishes a new link mapping at the beginning of the data migration, and during the bidirectional data transmission process, the data migration link remains unchanged. After the completion of the bidirectional data transmission, the data in the temporary storage area of the second hard disk drive will be automatically cleared, and the second data migration link will be deleted at the same time. Therefore, the link created during the data migration process and the data temporary storage area used are temporary, and can be deleted immediately after use, without affecting the normal use of storage services, accelerating the bidirectional copy speed of the system, improving the replacement efficiency of the cache disk, further improving the stability of the system, and reducing the risk of data loss. Compared with the existing data migration method, the data migration method of the present application doubles the data copy path in the context of the cache disk being exhausted and needing to be replaced, which not only ensures data integrity but also reduces the time required for the replacement process, thereby improving the efficiency of data migration.
[0079] In some embodiments, the data migration method may further include: after completing the data migration through the first data migration link and the second data migration link, performing data verification on the data after the data migration through a hash algorithm.
[0080] As an example, taking the migration of data in NVMe1 to HDD1 and HDD4 as an example, all data in NVMe1 has been migrated to HDD1 and HDD4 through the first data migration link and the second data migration link, and the data after data migration is verified by a hash algorithm for data consistency. Taking the migration of data in HDD1 and HDD4 to NVMe1 as an example, all data in HDD1 and HDD4 has been migrated to NVMe1 through the first data migration link and the second data migration link, and the data after data migration is verified by a hash algorithm for data consistency.
[0081] In some embodiments, the processing flow of the data migration method is shown as follows: Figure 5 ,like Figure 5 As shown, the data migration method may further include:
[0082] Step S501 : Based on the first data migration link and the second data migration link, data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in a mutually exclusive and parallel manner.
[0083] As an example, the data in HDD1-part1 and HDD4-part1 are migrated to NVMe1-part1 through two parallel links, the first data migration link and the second data migration link. During the data transmission process, the transmission thread must request a mutex lock before starting to write to NVMe1-part1. The transmission thread successfully obtains the mutex lock, and the transmission thread can transfer data from HDD1-part1 or HDD4-part1 to NVMe1-part1. After the data transmission is completed, the transmission thread releases the mutex lock, allowing other threads to obtain the mutex lock and perform the corresponding data transmission.
[0084] Step S502: after completing data migration through the first data migration link and the second data migration link, verify the data after the data migration through a hash algorithm.
[0085] In this embodiment, verifying the data after data migration through a hash algorithm may include: hashing the data using a hash algorithm to obtain a first hash value corresponding to the data before transmitting the data, and then sending the first hash value and the data together through a first data migration link and a second data migration link; after completing the data migration, hashing the data using the same hash algorithm and key to obtain a second hash value, and verifying whether the first hash value and the second hash value are the same.
[0086] The method of the embodiment of the present application quickly migrates data from the hard disk drive back to the cache disk through a parallel migration link, thereby improving the data migration efficiency. After the data migration is completed, the migrated data is verified through a hash algorithm to ensure the integrity of the data, improve the reliability of data migration, and reduce the risk of errors during the data migration process.
[0087] refer to Figure 6 , an application scenario diagram of the data migration method provided in an embodiment of the present application, which is applied to data migration in a cache disk replacement process.
[0088] The electronic device may include two NVMe cache disks, a first cache disk and a second cache disk, wherein NVMe1 mounts three hard disk drives hdd1, hdd2 and hdd3, and NVMe2 cache disk mounts three hard disk drives hdd4, hdd5 and hdd6. Among them, the cache disk is NVMe1-NVMe2, and the hard disk drive is hdd1-hdd6. NVMe1-part1, NVMe1-part2 and NVMe1-part3 divide the data of the first cache disk into three parts, and the same is true for NVMe2-part1, NVMe2-part2 and NVMe2-part3. hdd*-part1 and hdd*-part2 are divided into two areas, part1 and part2, in the system creation partition of the electronic device by compiling a script (* represents the number of hdd, as shown in the figure, * can be 1, 2, 3, 4, 5, 6). hdd*-part1 is not used during normal use, and is only used as a data temporary storage area during the replacement of the cache disk. That is, when not in use, the internal data of hdd*-part1 is empty. hdd*-part2 serves as the main data storage area and is used for data storage during normal use.
[0089] The specific conditions used in the data migration method of the cache disk replacement process are as follows: (1) the hardware environment of the electronic device includes at least two NVMe cache disks; (2) the sizes of all hdd*-part1 partitions of the electronic device need to be consistent; (3) the number of HDDs mounted on each NVMe cache disk is the same; (4) the replacement process only replaces a single cache disk.
[0090] Taking the replacement of NVMe1 as an example, the specific data migration method of the cache disk replacement process may include:
[0091] Before replacing the cache disk, NVMe1-part1 and hdd1-part1 are bundled together in correspondence, and there is a first data migration link between NVMe1-part1 and hdd1-part1. Similarly, there are three first data migration links between NVMe1 and hdd, corresponding to the three mounted hdds.
[0092] When the old cache disk (NVMe1) reaches the end of its life, it needs to be replaced with a new NVMe cache disk. The replacement process is as follows:
[0093] Establish a mapping relationship between NVMe1 and hdd. Taking NVMe-part1 as an example, the mapping relationship may include: the mapping relationship between NVMe-part1 and hdd1-part1, and the mapping relationship between NVMe-part1 and hdd4-part1. By writing a script to change the disk definition, establish a second data migration link between NVMe-part1 and hdd4-part1, and form a corresponding map file. As a result, NVMe1 establishes a data transmission link with the hdd mounted by NVMe2. Divide the data in NVMe1-part1 into multiple load-balanced segmented data blocks, and migrate the segmented data blocks to hdd1-part1 and hdd4-part1 in a mutually exclusive and parallel manner based on the first data migration link and the second data migration link. Similarly, the data on NVMe1-part2 is migrated to hdd2-part1 and hdd5-part1, and the data on NVMe1-part3 is migrated to hdd3-part1 and hdd6-part1.
[0094] Replace the old NVMe1 cache disk with a new NVMe cache disk.
[0095] After replacing the disk, a new cache disk (NVMe_NEW) is obtained, and the data in the hdd data temporary storage area is migrated to the new cache disk. Based on the first data migration link and the second data migration link, the data in hdd1-part1 and hdd4-part1 are migrated to NVMe1-part1 of NVMe_NEW in a mutually exclusive and parallel manner. Similarly, the data in hdd2-part1 and hdd5-part1 are migrated to NVMe1-part2 of NVMe_NEW, and the data in hdd3-part1 and hdd6-part1 are migrated to NVMe1-part3 of NVMe_NEW.
[0096] When data is transferred to NVMe_NEW, the corresponding hdd4-part1, hdd5-part1 and hdd6-part1 only include the data in the old cache disk NVMe1, and do not involve NVMe2 related data.
[0097] After the data migration is completed, clear the map file, restore the mapping relationship before replacing the cache disk (that is, clear the dotted double arrow path), and delete the data in the data temporary storage area of the hdd mounted by NVMe2, thus completing the cache disk replacement.
[0098] The following is a description of an exemplary structure of the data migration device 90 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example, Figure 7 As shown, the data migration device 90 may include: an acquisition module 901, used to obtain at least two cache disks and at least two hard disk drives where the data to be migrated is located; a first establishment module 902, used to establish a first data migration link between the first cache disk and the data temporary storage area of the first hard disk drive; the first hard disk drive is mounted on the first cache disk; a second establishment module 903, used to establish a second data migration link between the first cache disk and the data temporary storage area of the second hard disk drive based on the second hard disk drive mounted on the second cache disk; the data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
[0099] In some embodiments, the data migration device may further include a migration module, which may be used to: divide the data in the first cache disk into multiple load-balanced segmented data blocks based on a segmentation algorithm; migrate the segmented data blocks to the first hard disk drive and the second hard disk drive in parallel based on the first data migration link and the second data migration link; the hard disk drive includes at least a data temporary storage area and a main data storage area, the data temporary storage area is used to temporarily store the data in the cache disk, and the storage space of the main data storage area is larger than the storage space of the data temporary storage area.
[0100] In some embodiments, the data migration device may further include a control module, and the control module is used to control the data transmission process of the first data migration link and the second data migration link through a mutex lock.
[0101] In some embodiments, the migration module can also be used to: divide the data in the first cache disk into multiple load-balanced segmented data blocks based on a segmentation algorithm; and migrate the segmented data blocks to the first hard disk drive and the second hard disk drive in a mutually exclusive and parallel manner based on the first data migration link and the second data migration link.
[0102] In some embodiments, the migration module may also be used to: migrate data in the first hard disk drive and the second hard disk drive to the first cache disk in parallel based on the first data migration link and the second data migration link.
[0103] In some embodiments, the migration module may also be used to: delete data in the data temporary storage area of the first hard disk drive; delete data in the data temporary storage area of the second hard disk drive; and delete the second data migration link.
[0104] In some embodiments, the data migration device may further include a verification module, which may be used to: after completing the data migration through the first data migration link and the second data migration link, perform data verification on the data after the data migration through a hash algorithm.
[0105] It should be noted that the description of the device in the embodiment of the present application is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, so it will not be repeated. Figures 1 to 6 The present invention can be understood by referring to the description of any one of the accompanying drawings.
[0106] According to an embodiment of the present application, the present application also provides an electronic device and a non-transitory computer-readable storage medium.
[0107] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0108] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0109] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0110] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the data migration method. For example, in some embodiments, the data migration method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the data migration method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the data migration method in any other appropriate manner (e.g., by means of firmware).
[0111] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0112] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data migration device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0113] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0114] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0115] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0116] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0118] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0119] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data migration method, comprising: Obtain at least two cache disks and at least two hard disk drives where the data to be migrated is located; Establishing a first data migration link between the first cache disk and the data temporary storage area of the first hard disk drive; The first hard disk drive is mounted on the first cache disk; Based on the second hard disk drive mounted on the second cache disk, a second data migration link is established between the first cache disk and the data temporary storage area of the second hard disk drive; The data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
2. The method according to claim 1, further comprising: Based on a segmentation algorithm, the data in the first cache disk is divided into a plurality of load-balanced segmented data blocks; Migrating the segmented data blocks to the first hard disk drive and the second hard disk drive in parallel based on the first data migration link and the second data migration link; The hard disk drive at least comprises a temporary data storage area and a main data storage area. The temporary data storage area is used to temporarily store data in the cache disk. The storage space of the main data storage area is larger than the storage space of the temporary data storage area.
3. The method according to claim 1, further comprising: The data transmission process of the first data migration link and the second data migration link is controlled by a mutex lock.
4. The method according to claim 3, further comprising: Based on a segmentation algorithm, the data in the first cache disk is divided into a plurality of load-balanced segmented data blocks; Based on the first data migration link and the second data migration link, the segmented data blocks are migrated to the first hard disk drive and the second hard disk drive in a mutually exclusive and parallel manner.
5. The method according to claim 1, further comprising: Based on the first data migration link and the second data migration link, the data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in parallel.
6. The method according to claim 5, after migrating the data in the first hard disk drive and the second hard disk drive to the first cache disk in parallel, the method further comprises: Deleting data in the data temporary storage area of the first hard disk drive; deleting data in the data temporary storage area of the second hard disk drive; The second data migration link is deleted.
7. The method according to claim 3, further comprising: Based on the first data migration link and the second data migration link, the data in the first hard disk drive and the second hard disk drive are migrated to the first cache disk in the mutually exclusive and parallel manner.
8. The method according to claim 1, further comprising: After completing the data migration through the first data migration link and the second data migration link, data verification is performed on the data after the data migration through a hash algorithm.
9. A data migration device, comprising: An acquisition module, used for acquiring at least two cache disks and at least two hard disk drives where the data to be migrated is located; A first establishing module, used to establish a first data migration link between the first cache disk and the data temporary storage area of the first hard disk drive; The first hard disk drive is mounted on the first cache disk; A second establishing module, configured to establish a second data migration link between the first cache disk and the data temporary storage area of the second hard disk drive based on the second hard disk drive mounted on the second cache disk; The data temporary storage area of the second hard disk drive is enabled when the second data migration link transmits data; the second data migration link and the first data migration link can transmit data in parallel.
10. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.