System migration method and device based on virtual storage, equipment and storage medium
By creating virtual storage space during system migration, migrating the original data to the virtual storage space and then migrating to the target host, the loss, corruption or inconsistency that may occur in data migration in the prior art is solved, and migration efficiency and storage space utilization are improved.
Patent Information
- Application Number
- CN202411964137.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-29
AI Technical Summary
Data loss, corruption or inconsistency may occur during existing systems migration, and additional physical storage resources are required for auxiliary space system migration.
Using a system migration method based on virtual storage, the source host data is scanned, the free disk block is filtered out, the virtual storage space is created, and the original data is migrated to the virtual storage space before migrating to the target host.
It improves data migration efficiency and storage space utilization, avoids the waste of additional physical storage resources, optimizes network transmission efficiency, ensures data consistency and integrity, and reduces interference to business continuity.
Smart Images

Figure CN119902708A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer application technology, and in particular, relates to a system migration method, device, equipment and storage medium based on virtual storage. Background Art
[0002] With the rapid development of Internet technology and software technology, the technology upgrade or enterprise business model on which the original system is based has undergone major changes. The architecture and functions of the original system cannot well support new business processes and needs. In order to keep up with the development of new technologies and improve system performance and scalability, migration is required.
[0003] At present, the system migration process is to achieve the overall migration of the system by expanding third-party services or adding auxiliary space system migration. In actual business scenarios, data loss, damage or inconsistency may occur during the data migration process. Summary of the invention
[0004] In view of the above problems in the prior art, the purpose of this article is to provide a system migration method, device, equipment and storage medium based on virtual storage, which can improve data migration efficiency and space utilization.
[0005] In order to solve the above technical problems, the specific technical solutions of this article are as follows:
[0006] In one aspect, the present invention provides a system migration method based on virtual storage, the method comprising:
[0007] Scan the data in the source host to obtain the storage information of the source host, wherein the storage information includes: the storage location of the original data and the usage of each disk block;
[0008] Based on the usage of each disk block, filter out free disk blocks from all the disk blocks;
[0009] Creating a virtual storage space on the source host based on the free disk block size of the free disk block;
[0010] According to the storage location of the original data, the original data in different storage locations are migrated to the virtual storage space in sequence, and then according to the storage location of the original data, the original data is migrated from the virtual storage space to the location corresponding to the target host.
[0011] Furthermore, before scanning the data in the source host to obtain the storage information of the source host, the method includes:
[0012] Verify whether the data in each disk block in the source host is erroneous data, wherein the erroneous data is invalid, repeated or outdated data;
[0013] If the data in the disk block is erroneous data, the erroneous data is cleared.
[0014] Further, the creating a virtual storage space on the source host based on the free disk block size of the free disk block includes:
[0015] Obtaining super block information on the source host, wherein the super block information stores capacity information and physical locations of free disk blocks;
[0016] The virtual storage space and a virtual storage index table for managing the virtual storage space are created according to the super block information and the free disk block size.
[0017] Furthermore, the storage location of the original data includes: a boot area, a system area and a data area;
[0018] The step of sequentially migrating the original data in different storage locations to the virtual storage space according to the storage location of the original data, and then migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data includes:
[0019] Migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, wherein the storage in the area to be transferred is selected from the boot area, the system area and the data area based on a preset rule;
[0020] Reselect the area to be transferred and repeat the steps of: migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, until the data stored in the boot area, the system area and the data area are migrated.
[0021] Furthermore, before reselecting the area to be transmitted, the method includes:
[0022] The original data stored in the virtual storage space is deleted.
[0023] Furthermore, before migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data, the method includes:
[0024] Obtaining the space capacity occupied by the storage location of each original data of the source host;
[0025] Dividing the storage space of the target host according to the space capacity occupied by the storage location of each original data;
[0026] The data in the virtual storage space is shared with the target host through a sharing protocol.
[0027] Furthermore, the method further comprises:
[0028] receiving a test pass instruction sent by the target host, wherein the test pass instruction is sent by the target host when the original data received by the test meets the preset requirements;
[0029] The disk block corresponding to the original data is formatted according to the test passing instruction.
[0030] On the other hand, this article provides a system migration device based on virtual storage, the device comprising:
[0031] The scanning module is configured to scan the data in the source host to obtain the storage information of the source host, wherein the storage information includes: the storage location of the original data and the usage of each disk block;
[0032] A free disk screening module is configured to screen out free disk blocks from all the disk blocks based on the usage of each disk block;
[0033] a virtual space creation module configured to create a virtual storage space on the source host based on the free disk block size of the free disk block;
[0034] The data migration module is configured to migrate the original data in different storage locations to the virtual storage space in sequence according to the storage location of the original data, and then migrate the original data from the virtual storage space to the corresponding location of the target host according to the storage location of the original data.
[0035] On the other hand, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the computer program.
[0036] On the other hand, the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method described above is implemented.
[0037] By adopting the above technical scheme, the virtual storage-based system migration method, device, equipment and storage medium of this paper can effectively utilize the unused part of the existing storage resources and avoid the waste of additional physical storage resources by scanning the data in the source host and filtering out the free disk blocks. In addition, the method allows the original data to be migrated to the local virtual storage space first, and then migrated to the destination host uniformly, which can optimize the network transmission efficiency to a certain extent, especially when the network bandwidth is limited, and can significantly reduce the overall migration time. Secondly, the use of virtual storage space as an intermediate transition makes the migration process more flexible and controllable. The administrator can adjust the migration strategy according to the actual situation, such as migrating in batches, migrating important data first, etc., while reducing the risk of data transmission failure directly from the source to the destination. Copying data in the virtual storage space and then migrating it to the destination host helps to ensure the consistency and integrity of the data during the migration process. This can be achieved by implementing snapshots, verification and other mechanisms in the virtual storage stage. In addition, the data is first migrated to the virtual storage space, so that most of the preparation work can be completed without affecting the operation of existing business. Only when all preparations are ready, the last step of data synchronization will be performed, thereby minimizing the interference with business continuity.
[0038] In order to make the above and other purposes, features and advantages of this article more obvious and easy to understand, the following specifically cites preferred embodiments and describes them in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of this article or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of this article. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A schematic diagram of a system migration method based on virtual storage according to an embodiment of this invention is shown;
[0041] Figure 2 A schematic diagram of another scenario of a system migration device based on virtual storage according to an embodiment of this invention is shown;
[0042] Figure 3 A schematic diagram showing the structure of another system migration device based on virtual storage according to an embodiment of this invention is shown;
[0043] Figure 4 A schematic diagram showing a computer configuration according to an embodiment of the present invention is shown; DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of this article to clearly and completely describe the technical solutions in the embodiments of this article. Obviously, the described embodiments are only part of the embodiments of this article, not all of the embodiments. Based on the embodiments of this article, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this article.
[0045] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0046] In order to solve the above problems, the embodiments of this article provide a system migration method based on virtual storage, which can perform data cleanup of source host data, create virtual disks, and optimize space utilization without using auxiliary space, so that no additional auxiliary space is required during the system migration process, thereby improving space utilization. Figure 1 This is a schematic diagram of the steps of a system migration method based on virtual storage provided in the embodiments of this article. This specification provides method operation steps such as the embodiments or flowcharts, but more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or device product is executed, it can be executed in the order of the methods shown in the embodiments or the drawings or in parallel. Specifically, Figure 1 and Figure 2 As shown, the method may include:
[0047] S102, scanning data in a source host to obtain storage information of the source host, wherein the storage information includes: a storage location of original data and usage of each disk block;
[0048] Specifically, the source host refers to the computer or server where the original data, applications and operating system are located during system migration, data replication or backup operations. It is the starting point of the migration process, during which all configurations, files, databases, etc. will be migrated from the source host to the destination host.
[0049] Specifically, the storage information refers to the relevant information of the data stored in each disk block in the source host, which is used to characterize the corresponding storage situation. It can be understood that the source host can store data in different storage areas, and the different storage areas can be the boot area, the system area and the data area.
[0050] Among them, the boot sector (Boot Sector or Boot Area) is a specific area on a computer storage device (such as a hard disk, SSD, floppy disk, etc.), usually located in the first sector of the disk (i.e., cylinder 0, head 0, sector 1). The boot sector contains the initial set of instructions required for the operating system to start, also known as the boot loader. It is responsible for loading and executing the kernel of the operating system or the next stage of the boot process. On a computer with multiple operating systems installed, the boot area can also provide a multi-boot menu to allow users to select the operating system to start. The system area is a key area on a computer storage device, which usually contains the core components and information necessary for the operating system to start and run. The system area refers to a specific area on a hard disk or other storage medium where the operating system core files, boot loaders, and related configuration data are stored. The data area is an area on a storage device used to store non-system data such as user files, application data, and database records. Unlike the system area, the data area is mainly used to store actual business data and user-generated content data, which can be documents, pictures, videos, application configuration files, database records, etc.
[0051] It is understandable that different storage areas store data in the form of disk blocks, and different storage areas may store the same type of data or different types of data. The overall capacity of different storage areas may be pre-set, such as the capacity of the boot area is 10G, and in actual use, only 5G of data is stored, and accordingly, the disk blocks corresponding to the remaining 5G are idle.
[0052] Among them, disk blocks refer to the disk being divided into many small units of fixed size, called disk blocks (or sectors). Each block usually has a fixed size, such as 512 bytes, 4KB, etc.
[0053] That is to say, by scanning the data in the source host, it can be determined whether each disk block in each storage area stores the original data and whether the original data is stored in a certain area. The storage location of the original data can be the above-mentioned storage area, such as the boot area. The usage of the disk block is used to characterize whether the disk block stores data, such as storage corresponds to the usage state, and no data is stored corresponds to the idle state.
[0054] S104: Filter out free disk blocks from all the disk blocks based on the usage of the disk blocks.
[0055] During the scanning process of the source host, the usage status of each disk block can be systematically recorded. For used disk blocks, their locations and associated files are marked in detail; for free disk blocks, only their specific locations are recorded. Through this process, not only the total size of all free blocks on the disk can be counted, but also the total size of all free blocks on the disk can be counted. (where each block represents the size of the disk data block, and k represents the number of free blocks). It can also accurately count the location information of each free block.
[0056] Based on these detailed records, a super block table is generated, which will comprehensively record the location of all free blocks, providing a solid foundation for building logical virtual storage. This method not only improves the efficiency of disk space management, but also provides an accurate reference for subsequent data migration or expansion operations.
[0057] In practical applications, free disk blocks can be screened out by filtering the super block table.
[0058] S106: Create a virtual storage space on the source host based on the free disk block size of the free disk block.
[0059] Specifically, according to the migration requirements, the size of the virtual storage space to be created is determined to ensure that the capacity of the virtual storage space is less than the total available capacity of the free disk blocks. After that, the appropriate position and number are selected from the recorded free blocks to ensure that these blocks can be combined into the required continuous or non-continuous virtual storage space.
[0060] In practical applications, such as in Linux systems, you can use logical volume management (LVM) technology to combine multiple scattered free disk blocks into one or more logical volumes. LVM provides flexible storage management and allows dynamic adjustment of volume size. For Windows systems, you can use the dynamic disk function to expand existing volumes or create new volumes; some file systems (such as NTFS, ext4) also support online expansion, that is, to increase storage space without interrupting service. In addition, you can also create virtual disk files through virtualization technology (such as qemu-img, VHD, etc.) and map them to free blocks on the physical disk to form virtual storage space.
[0061] It should be noted that the disk blocks corresponding to different storage areas can all be used to create virtual storage space. For example, all free disk blocks are used to create virtual storage space; or, only disk blocks in a specific storage area are selected to create storage space, such as using free disk blocks in the data area to create virtual storage space; or, free disk blocks in different storage areas are used to create virtual storage space, such as using free disk blocks in the system area and data area.
[0062] It is understandable that when creating a virtual storage space, the selected free disk blocks may be part or all of the free disk blocks in the storage area.
[0063] Based on the size of the free disk blocks, the process of creating a virtual storage space on the source host involves using the identified free disk blocks to construct a logical additional storage area without actually adding physical storage devices.
[0064] S108. Migrate the original data in different storage locations to the virtual storage space in sequence according to the storage location of the original data, and then migrate the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data.
[0065] Specifically, the destination host refers to the computer or server that receives data, applications, and operating system configurations from the source host during system migration, data replication, or backup and recovery operations. It is the destination of the migration process, during which all configurations, files, databases, etc. will be migrated to the destination host.
[0066] In an optional embodiment, before migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data, the method includes:
[0067] Obtaining the space capacity occupied by the storage location of each original data of the source host;
[0068] Dividing the storage space of the target host according to the space capacity occupied by the storage location of each original data;
[0069] The data in the virtual storage space is shared with the target host through a sharing protocol.
[0070] Before data migration, the target host can be configured, such as partitioning and formatting the target host according to the number of partitions and file format of the source host. In addition, the remote sharing protocol is initialized to prepare for sharing the "virtual storage" of the source host to the target host.
[0071] It should be noted that after the target host is configured, a storage area corresponding to the source host is formed on the target host, such as a boot area, a data area, etc. Similarly, the same partitions as the source host can also be configured. For example, if the source host partitions are C, D, and E disks, the target host will also be configured with C, D, and E disks accordingly.
[0072] In an optional embodiment, the storage location of the original data includes: a boot area, a system area, and a data area;
[0073] The step of sequentially migrating the original data in different storage locations to the virtual storage space according to the storage location of the original data, and then migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data includes:
[0074] Migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, wherein the storage in the area to be transferred is selected from the boot area, the system area and the data area based on a preset rule;
[0075] Deleting the original data stored in the virtual storage space: After the system migration operation is completed, deleting the original data stored in the virtual storage space, releasing storage resources, and ensuring the security and cleanliness of the system.
[0076] Reselect the area to be transferred and repeat the steps of: migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, until the data stored in the boot area, the system area and the data area are migrated.
[0077] In actual applications, the original data in different storage locations on the source host can be migrated to the virtual storage space according to preset rules, such as first transmitting the data in the boot area, then transmitting the data in the system area, and finally transmitting the data in the data area. After all the data in different storage areas are transmitted, the original data in the virtual storage space is migrated to the corresponding position of the target host. Alternatively, after the data in a certain storage area is migrated to the virtual storage space, the original data in the virtual storage space is migrated to the corresponding position of the target host, and then the data in other storage areas is migrated to the virtual storage space, and the cycle is repeated until all the data of the source host are migrated to the storage area corresponding to the target host.
[0078] The system migration method based on virtual storage provided in the embodiment of this specification creates a virtual storage space by scanning the data in the source host and filtering out the free disk blocks, which can effectively utilize the unused part of the existing storage resources and avoid the waste of additional physical storage resources. In addition, the method allows the original data to be first migrated to the local virtual storage space, and then uniformly migrated to the destination host, which can optimize the network transmission efficiency to a certain extent, especially in the case of limited network bandwidth, and can significantly reduce the overall migration time. Secondly, the use of virtual storage space as an intermediate transition makes the migration process more flexible and controllable. The administrator can adjust the migration strategy according to the actual situation, such as migrating in batches, migrating important data first, etc., while reducing the risk of data transmission failure directly from the source to the destination. Copying data in the virtual storage space and then migrating it to the destination host helps to ensure the consistency and integrity of the data during the migration process. This can be achieved by implementing snapshots, verification and other mechanisms in the virtual storage stage. In addition, the data is first migrated to the virtual storage space, so that most of the preparations can be completed without affecting the operation of existing services. Only when all preparations are ready will the last step of data synchronization be performed, thereby minimizing interference with business continuity.
[0079] Based on the above embodiment, in one embodiment of this specification, before scanning the data in the source host to obtain the storage information of the source host, the method includes:
[0080] Verify whether the data in each disk block in the source host is erroneous data, wherein the erroneous data is invalid, repeated or outdated data;
[0081] Specifically, invalid data refers to data that does not conform to the expected format or business rules, such as damaged files, unparseable content, or data that violates constraints. Duplicate data refers to the same data appearing multiple times in different locations, which may lead to redundant storage and inefficient queries. Obsolete data refers to data that no longer reflects the current state or has expired, such as old versions of configuration files or historical records that have been replaced by new data.
[0082] The verification method can be checksum, cyclic redundancy check (CRC) or hash value comparison. Checksum refers to calculating the data checksum of each disk block and comparing it with the previously saved checksum. If the two do not match, it indicates that the block may contain erroneous data. Cyclic redundancy check (CRC) is similar to checksum, but uses more complex algorithms to detect errors in data transmission or storage. Hash value comparison means that for key data blocks, hash values can be generated and compared before and after migration to ensure data consistency.
[0083] If the data in the disk block is erroneous data, the erroneous data is cleared.
[0084] Specifically, when it is determined that the data stored in the disk block is erroneous data, the erroneous data can be directly deleted so that it no longer occupies storage space.
[0085] The implementation of the embodiments of this specification can effectively clear the erroneous data in the disk blocks, ensure the reasonable use of storage resources, and ensure the stability and security of the system. Correct implementation of the clearing operation not only improves storage efficiency, but also facilitates subsequent data management and system maintenance.
[0086] Based on the above embodiment, in one embodiment of the specification, the creating a virtual storage space on the source host based on the free disk block size of the free disk block includes:
[0087] Obtaining super block information on the source host, wherein the super block information stores capacity information and physical locations of free disk blocks;
[0088] Specifically, the superblock is usually located at a specific location in the file system (such as the beginning or end of the file system) and is used to store global information about the entire file system. The information in the superblock includes at least: Total number of blocks: the total number of all disk blocks in the file system. Number of free blocks: the number of disk blocks that are not currently in use. Number of used blocks: the number of disk blocks that have been allocated to files or other data structures. Block size: the size of each disk block (for example, 512 bytes, 4KB, etc.). The physical location can be a partitioning number (partitioning no.) and / or a block number (block no.), which is very important for managing and optimizing storage resources.
[0089] The virtual storage space and a virtual storage index table for managing the virtual storage space are created according to the super block information and the free disk block size.
[0090] In actual applications, the size, type and other parameters of the created virtual disk can be determined by the size of all free disk blocks. Specifically, the virtual storage space can be created on the source host by configuring the disk format, setting disk attributes and other parameters.
[0091] In order to manage and track each disk block in the virtual storage space, a virtual storage index table (Virtual Store Table) can be constructed during the process of creating the virtual storage space. The table contains the following fields: Storage No.: Uniquely identifies each virtual storage unit. Storage Format: Records the file system format used. Storage Type: Identifies the storage type (such as primary partition, extended partition, logical volume, etc.). Partitioning No.: Associated with a specific physical partition number. Block No.: Identifies the specific location of each disk block. Block Size: Defines the size of each disk block. Free Flag: Indicates whether the block is free (0 means used, 1 means free).
[0092] When creating a virtual storage space, the scattered free disk blocks can be integrated into a logically continuous virtual storage space based on the free block information provided by the super block, and a mapping relationship is created for each virtual storage unit to ensure that the underlying physical disk blocks can be accurately accessed.
[0093] The implementation of the embodiments of this specification can significantly improve the security, stability and management efficiency of the system by creating a virtual storage space and logically isolating the storage area corresponding to the original data.
[0094] Based on the above embodiment, in one embodiment of this specification, the method further includes:
[0095] receiving a test pass instruction sent by the target host, wherein the test pass instruction is sent by the target host when the original data received by the test meets the preset requirements;
[0096] Specifically, after the source host migrates the original data to the target host, the target host receives the data and places it in the specified location. The target host will also perform preliminary file integrity checks, such as checksum comparison, hash value verification, etc., to ensure that there is no damage during data transmission. After determining that the data is not damaged, a series of functional tests are performed on the migrated original data according to preset requirements, including but not limited to application startup, database query, file reading and writing, etc. Performance testing can also be performed to evaluate whether the performance of the data in the new environment meets the expected performance indicators, such as response time, throughput, etc. Consistency checks can also be performed to ensure that the migrated data is logically consistent with the original data and has not been lost or tampered with. After all the above tests are passed, a test pass instruction can be sent to the source host.
[0097] The performance test may be to evaluate the migration efficiency E. Only when the migration efficiency E meets the preset efficiency, the test pass instruction is allowed to be sent. The total amount of data is Q, the migration speed is V, and the migration time T is: T = Q ÷ V. The actual amount of data to be migrated is A, the theoretical maximum amount of data to be migrated is B, and the time is t, then the migration efficiency E is: E = A ÷ (B × t).
[0098] The disk block corresponding to the original data is formatted according to the test passing instruction.
[0099] Specifically, the system is installed by decompressing the data transferred from the system installation boot area, the system area, and the data area, and after testing the system integrity and operation performance and confirming that there is no abnormality, the source host releases the virtual disk.
[0100] Specifically, disk block formatting can be understood as clearing data traces, for example, performing low-level formatting or secure erasing on these disk blocks to ensure that all data traces are completely cleared and cannot be recovered. At the same time, the formatted disk blocks can be re-marked as free for subsequent use.
[0101] The implementation of the embodiment of this specification can ensure the quality of data after migration and the security of the system by receiving the test pass instruction sent by the target host and formatting the disk block corresponding to the original data accordingly, and can also optimize storage resources. The embodiment of this specification can perform data cleaning of the source host data, create a virtual disk, and optimize space utilization without using additional auxiliary space, so that the space utilization during the system migration process is more reasonable, avoiding space waste and increasing additional resource costs for users.
[0102] This embodiment provides a system migration device based on virtual storage, such as Figure 2 and 3 As shown, the device comprises:
[0103] The scanning module is configured to scan the data in the source host to obtain the storage information of the source host, wherein the storage information includes: the storage location of the original data and the usage of each disk block;
[0104] A free disk screening module is configured to screen out free disk blocks from all the disk blocks based on the usage of each disk block;
[0105] a virtual space creation module configured to create a virtual storage space on the source host based on the free disk block size of the free disk block;
[0106] The data migration module is configured to migrate the original data in different storage locations to the virtual storage space in sequence according to the storage location of the original data, and then migrate the original data from the virtual storage space to the corresponding location of the target host according to the storage location of the original data.
[0107] The technical effect of the device is the same as that of the above method and will not be repeated.
[0108] This embodiment provides a computer device, whose internal structure diagram can be shown as follows: Figure 4 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection.
[0109] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0110] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0111] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0112] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0113] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0114] It should also be understood that in the embodiments of this article, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0115] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this article.
[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0117] In the several embodiments provided herein, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be electrical, mechanical or other forms of connection.
[0118] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this article.
[0119] Specific embodiments are used in this article to illustrate the principles and implementation methods of this article. The description of the above embodiments is only used to help understand the methods and core ideas of this article. At the same time, for general technicians in this field, according to the ideas of this article, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on this article.
Claims
1. A system migration method based on virtual storage, characterized in that: The method comprises: Scan the data in the source host to obtain the storage information of the source host, wherein the storage information includes: the storage location of the original data and the usage of each disk block; Based on the usage of each disk block, filter out free disk blocks from all the disk blocks; Creating a virtual storage space on the source host based on the free disk block size of the free disk block; According to the storage location of the original data, the original data in different storage locations are migrated to the virtual storage space in sequence, and then according to the storage location of the original data, the original data is migrated from the virtual storage space to the location corresponding to the target host.
2. The method according to claim 1, characterized in that Before scanning the data in the source host to obtain the storage information of the source host, the method includes: Verify whether the data in each disk block in the source host is erroneous data, wherein the erroneous data is invalid, repeated or outdated data; If the data in the disk block is erroneous data, the erroneous data is cleared.
3. The method according to claim 1, characterized in that The creating a virtual storage space on the source host based on the free disk block size of the free disk block includes: Obtaining super block information on the source host, wherein the super block information stores capacity information and physical locations of free disk blocks; The virtual storage space and a virtual storage index table for managing the virtual storage space are created according to the super block information and the free disk block size.
4. The method according to claim 2, characterized in that: The storage locations of the original data include: a boot area, a system area and a data area; The step of sequentially migrating the original data in different storage locations to the virtual storage space according to the storage location of the original data, and then migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data includes: Migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, wherein the storage in the area to be transferred is selected from the boot area, the system area and the data area based on a preset rule; Reselect the area to be transferred and repeat the steps of: migrating the original data stored in the area to be transferred to the virtual storage space, and then migrating the original data from the virtual storage space to the corresponding position of the target host according to the storage in the area to be transferred, until the data stored in the boot area, the system area and the data area are migrated.
5. The method according to claim 4, characterized in that Before reselecting the area to be transmitted, the method includes: The original data stored in the virtual storage space is deleted.
6. The method according to claim 4, characterized in that Before migrating the original data from the virtual storage space to a location corresponding to the target host according to the storage location of the original data, the method includes: Obtaining the space capacity occupied by the storage location of each original data of the source host; Dividing the storage space of the target host according to the space capacity occupied by the storage location of each original data; The data in the virtual storage space is shared with the target host through a sharing protocol.
7. The method according to claim 1, characterized in that The method further comprises: receiving a test pass instruction sent by the target host, wherein the test pass instruction is sent by the target host when the original data received by the test meets the preset requirements; The disk block corresponding to the original data is formatted according to the test passing instruction.
8. A system migration device based on virtual storage, characterized in that: The device comprises: The scanning module is configured to scan the data in the source host to obtain the storage information of the source host, wherein the storage information includes: the storage location of the original data and the usage of each disk block; A free disk screening module is configured to screen out free disk blocks from all the disk blocks based on the usage of each disk block; a virtual space creation module configured to create a virtual storage space on the source host based on the free disk block size of the free disk block; The data migration module is configured to migrate the original data in different storage locations to the virtual storage space in sequence according to the storage location of the original data, and then migrate the original data from the virtual storage space to the corresponding location of the target host according to the storage location of the original data.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.