CN112416657A - System cloning method - Google Patents

System cloning method Download PDF

Info

Publication number
CN112416657A
CN112416657A CN202011425414.0A CN202011425414A CN112416657A CN 112416657 A CN112416657 A CN 112416657A CN 202011425414 A CN202011425414 A CN 202011425414A CN 112416657 A CN112416657 A CN 112416657A
Authority
CN
China
Prior art keywords
cloning
partition
disk
target
disks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011425414.0A
Other languages
Chinese (zh)
Other versions
CN112416657B (en
Inventor
先泽强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Aomei Technology Co ltd
Original Assignee
Chengdu Aomei Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Aomei Technology Co ltd filed Critical Chengdu Aomei Technology Co ltd
Priority to CN202011425414.0A priority Critical patent/CN112416657B/en
Publication of CN112416657A publication Critical patent/CN112416657A/en
Application granted granted Critical
Publication of CN112416657B publication Critical patent/CN112416657B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a system cloning method, which comprises the following steps: s1, initializing all disks and rolls; s2, selecting a proper target position and constructing a cloning parameter; s3, starting cloning the source system partition, and attempting to lock the volume of the source system partition before cloning; s4, judging whether cloning is carried out according to sectors, S5, judging whether the cloning belongs to the same type of disk inter-cloning, and S6, cloning the rest partitions of the source system; s7, after cloning is finished, judging whether the inter-disk cloning belongs to the same type; s8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type; and S9, if the disks do not belong to the same type of disk cloning, carrying out cloning guide repair among different types of disks. The invention solves the complex problems that the prior reinstallation system is a complicated and complicated project, and a user needs to reinstall the system after replacing a computer and a magnetic disk.

Description

System cloning method
Technical Field
The invention relates to the technical field of system cloning, in particular to a system cloning method.
Background
With the rapid development of computer technology, larger and faster hard disks are more and more popular, and the requirements of people on system operation efficiency or disk space are higher and higher, but if the hard disks are directly replaced, the problem is that the system needs to be reinstalled, but the reinstallation of the system is also a complicated and complicated project, particularly aiming at the situations that a computer with a complicated user environment and a system need to be cloned from an MBR to a GPT disk and from the GPT disk to the MBR disk. Therefore, there is a need to provide a systematic cloning method to overcome the above problems.
Disclosure of Invention
The invention provides a system cloning method, which aims to solve the problem that the system needs to be reinstalled when a hard disk is directly replaced at present, but the reinstallation system is also a complicated and complicated project, and a user needs to reinstall the system after replacing a computer and a magnetic disk.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows: a method of systematic cloning comprising the steps of:
s1, initializing all disks and volumes;
s2, selecting a proper target position and constructing a cloning parameter;
s3, starting cloning the source system partition, and attempting to lock the volume of the source system partition before cloning; if the volume cannot be locked, a snapshot needs to be created for the volume, and the data of the volume is read from the snapshot for cloning; if the volume can be locked, the cloning is carried out by directly using a disk reading and writing mode;
s4, judging whether to clone according to a sector, if not, cloning according to the use condition of the file system, namely only cloning the used sector of the volume; if the cloning is carried out according to the sector, cloning is carried out by using a disk reading and writing mode;
s5, judging whether the inter-disk cloning belongs to the same type, and if the inter-disk cloning belongs to the same type, cloning the System partition and the source System partition according to the same file System; if the System partitions do not belong to the same type of disk inter-cloning, the System partitions need to be formatted into corresponding formats;
s6, cloning other partitions of the source system;
s7, after cloning is finished, judging whether the inter-disk cloning belongs to the same type;
s8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type;
s9, if the disks do not belong to the same type of disk cloning, guiding and repairing the disks of different types; and at this point, the cloning is finished, the cloning-guided repair is finished, and the system is started normally.
Further, in step S1, all disks and volumes are initialized to initialize all disks, partitions and volumes of the current computer, and the System partition, the Boot partition and the Recovery partition of the current System are found.
Further, in step S2, selecting a proper target location as a determination result to determine whether the target disk has the cloning condition, and if the total capacity of the target disk is smaller than the sum of the used space capacities of the system partitions, the target disk does not have the cloning condition, that is, the target location is not proper; if the total capacity of the target disk is greater than or equal to the sum of the used spaces of the system partitions, the target disk is provided with a clone condition, that is, the target location is appropriate.
Further, in step S2, if the disk types are different but the space size condition is satisfied, the cloning condition is also satisfied.
Further, in step S2, the cloning parameters are constructed to be virtual configurations after the system is cloned to the target position according to the selected target position.
Further, in step S2, in the process of constructing the clone parameters, if the target location is smaller than the total size of the System partition, the Boot partition needs to be reduced when constructing the partition form of the target location, and the Boot partition is reduced until three partitions, namely the System partition, the Boot partition, and the Recovery partition, of the System can be accommodated in the target location.
Further, in step S2, in the process of constructing the clone parameters, if the reduced Boot partition reaches the limit value or cannot satisfy the condition, it is checked whether the System partition and the Recovery partition can be reduced, and if the reduced Boot partition can be reduced, the Recovery partition is preferentially reduced, and then the System partition is reduced.
Further, in step S2, if the conditions cannot be satisfied even after the System partition and the Recovery partition are reduced in the process of constructing the cloning parameters, the cloning cannot be continued.
Further, in step S2, in the process of constructing the clone parameters, if the target location is larger than the total size of the System, the System partition on the target disk is expanded, and the Boot partition is expanded to the size of the capacity of the target disk minus the capacity of the System partition and the capacity of the Recovery partition.
Further, in step S2, in the process of constructing the clone parameter, if the target location is consistent with the System size, the target disk is kept consistent with the System size, or the relative sizes of the System partition, the Boot partition, and the Recovery partition are changed, but it is required that the partition capacity of the target disk is greater than or equal to the used space capacity of the corresponding partition of the System, that is, the partition of the target disk can accommodate the corresponding partition of the lower System.
Compared with the prior art, the invention has the following beneficial effects: the system cloning method of the invention initializes all the magnetic disks and volumes through the step S1; s2, selecting a proper target position and constructing a cloning parameter; s3, starting cloning the source system partition, and attempting to lock the volume of the source system partition before cloning; s4, judging whether cloning is carried out according to sectors, S5, judging whether the cloning belongs to the same type of disk inter-cloning, and S6, cloning the rest partitions of the source system; s7, after cloning is finished, judging whether the inter-disk cloning belongs to the same type; s8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type; s9, if the disks do not belong to the same type of disk cloning, guiding and repairing the disks of different types; and at this point, the cloning is finished, the cloning-guided repair is finished, and the system is started normally. The invention provides a convenient and orderly system cloning method, and the system can be cloned to a new computer or a new disk without damage.
Drawings
FIG. 1 is a schematic diagram of a flow chart of a system cloning method of the present invention.
FIG. 2 is a diagram illustrating a small-end representation of a system cloning method of the present invention writing configuration files.
FIG. 3 is a schematic diagram of a disk signature of a system cloning method according to the present invention.
FIG. 4 is a diagram illustrating an offset of a recovery environment boot and an offset of a Windows boot in a system cloning method according to the present invention.
FIG. 5 is a diagram illustrating a GUID of a disk and a GUID of a partition in a system cloning method according to the present invention.
FIG. 6 is a diagram illustrating GUIDs of a recovery partition and a GUID of a disk where the recovery partition is located in the system cloning method according to the present invention.
Fig. 7 is a schematic diagram of the disk GUID data in GUID of the GPT disk of the system cloning method of the present invention.
FIG. 8 is a diagram of a GUID of a partition in a system cloning method in a partition table of a GPT disk according to the present invention.
Fig. 9 is a schematic diagram of the meaning of the drive letter information of the C disk in the registry when the system drive letter on the MBR disk is repaired according to the system clone method of the present invention.
Fig. 10 is a schematic diagram of the meaning of the drive letter information of the C disk in the registry when the system drive letter on the GPT disk is repaired according to the system clone method of the present invention.
Detailed Description
The technical solutions of the present invention are further described in detail below with reference to the accompanying drawings, but the scope of the present invention is not limited to the following.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings of the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The present invention will be further described with reference to the following examples, which are intended to illustrate only some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, other embodiments used by those skilled in the art without any creative effort belong to the protection scope of the present invention.
Referring to fig. 1 to 10, an embodiment of the present invention is shown, which is for illustration purpose only and is not limited by the structure.
Example one
As shown in fig. 1, a system cloning method includes the following steps:
s1, initializing all disks and volumes;
s2, selecting a proper target position and constructing a cloning parameter;
s3, starting cloning the source system partition, and attempting to lock the volume of the source system partition before cloning; if the volume cannot be locked, a snapshot needs to be created for the volume, and the data of the volume is read from the snapshot for cloning; if the volume can be locked, the cloning is carried out by directly using a disk reading and writing mode;
s4, judging whether to clone according to a sector, if not, cloning according to the use condition of the file system, namely only cloning the used sector of the volume; if the cloning is carried out according to the sector, cloning is carried out by using a disk reading and writing mode;
s5, judging whether the inter-disk cloning belongs to the same type, and if the inter-disk cloning belongs to the same type, cloning the System partition and the source System partition according to the same file System; if the System partitions do not belong to the same type of disk inter-cloning, the System partitions need to be formatted into corresponding formats;
s6, cloning other partitions of the source system;
s7, after cloning is finished, judging whether the inter-disk cloning belongs to the same type;
s8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type;
s9, if the disks do not belong to the same type of disk cloning, guiding and repairing the disks of different types; and at this point, the cloning is finished, the cloning-guided repair is finished, and the system is started normally.
Example two
In step S1, initializing all disks and volumes to initialize all disks, partitions and volumes of the current computer, and finding the System partition, Boot partition and Recovery partition of the current System.
In step S2, selecting a proper target location as a determination result to determine whether the target disk has a cloning condition, and if the total capacity of the target disk is less than the sum of the used space capacities of the system partitions, the target disk does not have the cloning condition, that is, the target location is not proper; if the total capacity of the target disk is greater than or equal to the sum of the used spaces of the system partitions, the target disk is provided with a clone condition, that is, the target location is appropriate.
In step S2, if the disk type is different but the space size condition is satisfied, the disk is also qualified for cloning.
In step S2, the cloning parameters are constructed into virtual forms after the system is cloned to the target position according to the selected target position.
In step S2, in the process of constructing the clone parameter, if the target location is smaller than the total size of the System partition, the Boot partition needs to be reduced when the partition form of the target location is constructed, and the Boot partition is reduced until three partitions, namely a System partition, a Boot partition, and a Recovery partition, of the System can be accommodated in the target location.
In step S2, in the process of constructing the clone parameter, if the reduced Boot partition reaches the limit value or cannot satisfy the condition, it is checked whether the System partition and the Recovery partition can be reduced, and if the reduced Boot partition can be reduced, the Recovery partition is preferentially reduced, and the System partition is reduced again.
In step S2, in the process of constructing the cloning parameters, if the conditions cannot be satisfied even after the System partition and the Recovery partition are reduced, the cloning cannot be continued.
In step S2, in the process of constructing the clone parameters, if the target location is larger than the total size of the System, the System partition on the target disk is expanded, and the Boot partition is expanded to the size of the capacity of the target disk minus the capacity of the System partition and the capacity of the Recovery partition.
In step S2, in the process of constructing the clone parameter, if the target location is consistent with the size of the System, the size of the target disk is kept consistent with the size of the System, or the relative sizes of the System partition, the Boot partition, and the Recovery partition are changed, but it is required that the partition capacity of the target disk is greater than or equal to the used space capacity of the corresponding partition of the System, that is, the partition of the target disk can accommodate the corresponding partition of the lower System.
EXAMPLE III
The specific process of the invention is as follows:
initializing all disks, partitions and volumes of the current computer, and finding out System partitions, Boot partitions and Recovery partitions of the current System.
Before cloning is started, whether a target disk has a cloning condition needs to be judged, and if the total capacity of the target disk is smaller than the used spaces of a System partition, a Boot partition and a Recovery partition, the target disk cannot be cloned. If the target location (which may be an entire disk or a location on the disk) is greater than or equal to the sum of the used spaces of the system partition, then the clone condition is satisfied. If the source disk and the target disk are of different types (MBR or GPT format), it is also allowable to clone the system if the condition of space size is satisfied.
Constructing a virtual form after a System is cloned to a target position according to a selected target position, if the target position is smaller than the total size of a current System partition (the total size refers to the sum of the total capacity of the 3 partitions), reducing a Boot partition when constructing the partition form of the target position, reducing the Boot partition until the three partitions can be accommodated in the target position, checking whether the System partition and the Recovery partition can be reduced if the reduced Boot partition reaches a limit value or cannot meet a condition, preferentially reducing the Recovery partition and reducing the System partition (the sizes of the System partition and the Recovery partition are relatively fixed, the two partitions are not too large, and in addition, data of the System partition and the Recovery partition are possibly stored in the Boot partition so that one physical partition is generally a System partition, a Boot partition and a Recovery partition), if the minimum space requirement cannot be met after scaling down the two partitions, cloning cannot continue. If the target position is larger than the total size of the source System, the System partition on the target disk can be expanded, the Boot partition is generally expanded to the size obtained by subtracting the capacity of the System partition and the Recovery partition capacity from the target position, the default size consistent with that of the source partition can be maintained, and the size of any partition of the Boot partition can be manually adjusted; if the target location is consistent with the system size, the target system is generally consistent with the source system, but the sizes of the three partitions can be manually changed, but the target capacity of a certain partition cannot be adjusted to be smaller than the used capacity in any adjustment.
According to the constructed partitions, cloning the partitions of the source system is started, generally cloning is performed according to the sequence of each partition of the source system on a disk, before cloning is started, a volume lock is firstly attempted to be performed on the source partition, if the volume can be normally locked, cloning is directly performed in a disk reading and writing mode, the partitions on the source disk are analyzed according to the type of a file system, then data are copied to a target position, for the volume which cannot be locked, a snapshot needs to be created for the volume, and the data of the volume are read from the snapshot, wherein the code is as follows:
CreateVssBackupComponents(&pBackup);
pBackup->InitializeForBackup();
pBackup- > AddToSpatHotSet (/. disk characters D: \ \ of volumes needed to create snapshots, GUID _ NULL, & snapshotSetId);
pBackup->DoSnapshotSet(&pDoShadowCopy);
pBackup->GetSnapshotProperties(snapshotSetId,&snapshotProp);
after the snapshot creation is successful, a symbolic link for access is returned.
For example: \ \ is a? \\ GLOBALROOT \ Device \ HarddiskVolumeShadowcopy19, which may open the symbolic link through the API of Windows to read the data of the volume, the pseudo code is as follows:
hHandle=CreateFile(\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy19,…);
there are two patterns of cloning of volumes in general:
1. for cloning only the sectors already used in the volume, the method needs to use an "auume file system parsing module" to obtain the used clusters of the volume through parsing and copy the used clusters to the target position. Or a file system analysis module in the prior art is used for analysis.
2. For a complete clone, it is only necessary to sequentially read all sectors of the volume and write the sectors to the target location, and the sectors may be directly read after the volume is locked or read from a snapshot.
For System cloning among different types of disks, System partitioning needs to create different types of file systems for different types of disks:
if the clone is from an MBR disk to a GPT disk, then the clone of the System partition becomes a create operation that directly creates a partition of FAT32 file System of the same size as the source partition at the target location.
If cloned from GPT disk to MBR disk, the System partition will be formatted as an NTFS file System by default.
After data cloning is completed, in order to ensure that a System can be normally started, a Boot configuration file of an operating System needs to be repaired to adapt to System Boot of a new target position, the repair Boot mainly comprises the positions of a repair System partition, a Boot partition and a Recovery partition recorded in Boot configuration, the drive symbol of a partition where Windows is located is repaired, the System of a GPT disk is cloned to the Boot reconstruction of an MBR disk, and the System on the MBR disk is cloned to the Boot reconstruction of the GPT disk.
The process is as follows:
1. repairing the Boot information of the Boot partition BCD file:
windows Boot Manager repair (MBR disk cloning to MBR disk case)
HKEY_LOCAL_MACHINE\BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\11000001
0x 20-0 x27 are the starting positions of the partitions (in bytes), for example: the starting sector of the partition is 2048, and the number of bytes per sector of the disk is 512, so the starting byte is: 2048 × 512 ═ 1048576, converted into 16-ary system: 100000, writing configuration files according to the small-end notation as shown in fig. 2: 4 bytes at 0000100000000000 and 0x 38-0 x0x3a are the disk signature of the disk, and the disk signature is offset 0x1b 8-0 x1bb of the MBR of the disk, as shown in fig. 3.
The repair of the Boot entry (the Boot entry includes Boot entry for booting Windows and Boot entry for other third parties) is basically similar to that of the Windows Boot Manager, except that the offset position of the Boot entry is different, and usually one Boot entry needs to repair two positions, for example, the following two positions of the Windows Boot entry record the disk and volume information of the volume where Windows is located:
HKEY_LOCAL_MACHINE\BCD00000000\Objects\{8aec7dc4-e119-11ea-ad02-d48d04b5e7d6}\Elements\11000001
HKEY_LOCAL_MACHINE\BCD00000000\Objects\{8aec7dc4-e119-11ea-ad02-d48d04b5e7d6}\Elements\21000001
similarly, like Windows Boot Manager, 8 bytes of 0x 20-0 x27 are the starting position (byte) of the partition where Windows is located, and the signatures of 0x 38-0 x3a are still the signatures of the disks.
Boot repair for the recovery environment needs to be separately accounted for because the offset of the boot of the recovery environment is different from the offset of the Windows boot, as shown in FIG. 4.
0x 54-0 x5b is the starting position of the recovery partition;
0x6 c-0 x6f are disk signatures of the disk where the recovery partition is located;
restoring a partition typically requires repairing two locations:
HKEY_LOCAL_MACHINE\BCD00000000\Objects\{8aec7dc5-e119-11ea-ad02-d48d04b5e7d6}\Elements\11000001
HKEY_LOCAL_MACHINE\BCD00000000\Objects\{8aec7dc5-e119-11ea-ad02-d48d04b5e7d6}\Elements\21000001
repair of Windows Boot Manager (cloning of GPT disk to GPT disk)
The position of the Windows Boot Manager in the configuration file is the same as that of the MBR disk, except that the MBR uses the partition starting position and the disk signature mode to determine the position of the Windows Boot Manager, instead of using the GUID of the disk and the GUID of the partition, as shown in fig. 5.
0x 20-0 x2f, wherein the 16 bytes represent the GUID of the Windows Boot Manager volume;
0x 38-0 x 48: the 16 bytes indicate the GUID of the disk where the volume is located in Windows Boot Manager.
Boot repair of the recovery partition for a system clone of a GPT disk to GPT disk is also different, as shown in fig. 6.
0x 54-0 x 63: these 16 bytes of GUID represent the GUID of the recovery partition;
0x6 c-0 x7 b: the 16 byte GUID indicates the GUID of the disk where the recovery partition is located.
The disk GUID data for the GPT disk is inside the GUID header, as shown in fig. 7.
The GUID of the partition is in the partition table of the GPT disk, as shown in FIG. 8.
3. Modifying the operating System disk letter also includes two parts, one is to repair the System on the MBR disk, and the other is to repair the System disk letter on the GPT disk, the repair method is consistent with the boot repair method, but the System configuration file (C: \ Windows \ System32\ configuration \ System) on the target disk needs to be mounted in the registry, the disk letter information of the current operating System is recorded under the position HKEY _ LOCAL _ MACHINE \ System \ mounted devices, usually only the disk letter information of the C disk needs to be repaired, the disk letter of the C disk is \ DosDevices \ C:inthe registry, and the meaning of the value of this item is specifically shown in fig. 9.
0x 0-0 x 03: the 4 bytes are signatures of the disks and are consistent with the disk signatures at the repaired BCD;
0x 04-0 x0 b: here 8 bytes indicate the start of the partition, as at the repair BCD;
the data of the two positions are changed into the corresponding data of the target disk.
If the target head disk is a GPT, as shown in FIG. 10.
0x 08-0 x 17: here, the GUID of the partition of the drive letter C is shown, and the GUID is repaired to the GUID of the Boot partition on the target disk.
So far, the system on the GPT disk is cloned to the GPT disk, and the boot repair of the system on the MBR disk cloned to the MBR disk is completed. The repair for GPT to MBR and MBR to GPT can be repaired using methods known in the art.
Wherein, the System partition: referred to as boot partitions. Boot partitioning: refers to the partition in which the system is located. BCD: boot configuration file for Windows operating system.
A disk management module: constructing disk and volume information of a current system and volume information of a virtual target position;
a file system module: the function module is used for analyzing NTFS, FAT32, FAT16 and FAT12 file systems and mainly realizing a file system reading function cloned according to used clusters;
a VSS management module: the function module is used for creating and deleting snapshots of each volume;
a disk partition read-write module: the module is used for reading the information of the source volume and writing new data into the target disk;
a guiding and repairing module: this module is used to repair the BCD and drive letter information.
Example four
The invention can be applied to virtual machine cloning, thereby solving the problems of low cloning speed, interruption of external service of a system and low cloning success rate in the cloning process of the traditional system cloning method.
A system cloning method for virtual machine cloning comprises the following steps:
step 1, initializing all disks and volumes;
step 2, selecting a proper target position and constructing a cloning parameter;
step 3, starting to clone the source system partition, and trying to lock the volume of the source system partition before cloning; if the volume cannot be locked, a snapshot needs to be created for the volume, and relevant data in the system needing to be cloned at a specified time point is stored in a snapshot file; reading data from the snapshot for cloning; if the volume can be locked, the cloning is carried out by directly using a disk reading and writing mode;
step 4, judging whether to clone according to the sector, if not, cloning according to the use condition of the file system, namely only cloning the sector already used by the volume; if the cloning is carried out according to the sector, cloning is carried out by using a disk reading and writing mode;
step 5, judging whether the disk clones belong to the same type, if so, cloning the System partition and the source System partition according to the same file System; if the System partitions do not belong to the same type of disk inter-cloning, the System partitions need to be formatted into corresponding formats;
step 6, cloning other partitions of the source system;
step 7, after cloning is finished, judging whether the same type of disk inter-cloning belongs to;
step 8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type;
step 9, if the disks do not belong to the same type of disk cloning, guiding and repairing the disks of different types; and at this point, the cloning is finished, the cloning-guided repair is finished, and the system is started normally.
Before creating a snapshot file, configuring a storage mode of a system to be cloned, and configuring a mapping relation between a server and a storage device of the system to be cloned; the disk file of the system is set to a read-only state. Then, determining the type of the system to be cloned, and determining the state of the system to be cloned; when the state of the system is a stop operation state, creating a snapshot file of the system to be cloned at a certain time point according to the type of the system and the state of the system;
creating a second snapshot file, and saving the related data which is changed in the system to be cloned after the time point in the second snapshot file;
and generating a corresponding subsystem in the target server according to the created snapshot file and the second snapshot file.
Creating the snapshot includes:
determining the type of a system to be cloned, and determining the state of the system to be cloned;
and when the state of the system is a stop running state, creating a snapshot file of the system at a specified time point according to the type of the system and the state of the system.
The specific implementation process of generating the corresponding subsystem in the target position is as follows: firstly, writing data in a snapshot file into a target position to generate a corresponding subsystem; and storing the data written first in the storage device corresponding to the target position. Then, in the subsystem of the target location that has been generated, the relevant data in the second snapshot file is synchronized into the subsystem.
The above-described embodiments are intended to be illustrative, not limiting, of the invention, and therefore, variations of the example values or substitutions of equivalent elements are intended to be within the scope of the invention.
From the above detailed description, it will be apparent to those skilled in the art that the foregoing objects and advantages of the invention are achieved and are in accordance with the provisions of the patent statutes.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention. The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, it should be noted that any modifications, equivalents and improvements made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of systematic cloning, comprising the steps of:
s1, initializing all disks and volumes;
s2, selecting a proper target position and constructing a cloning parameter;
s3, starting cloning the source system partition, and attempting to lock the volume of the source system partition before cloning; if the volume cannot be locked, a snapshot needs to be created for the volume, and the data of the volume is read from the snapshot for cloning; if the volume can be locked, the cloning is carried out by directly using a disk reading and writing mode;
s4, judging whether to clone according to a sector, if not, cloning according to the use condition of the file system, namely only cloning the used sector of the volume; if the cloning is carried out according to the sector, cloning is carried out by using a disk reading and writing mode;
s5, judging whether the inter-disk cloning belongs to the same type, and if the inter-disk cloning belongs to the same type, cloning the System partition and the source System partition according to the same file System; if the System partitions do not belong to the same type of disk inter-cloning, the System partitions need to be formatted into corresponding formats;
s6, cloning other partitions of the source system;
s7, after cloning is finished, judging whether the inter-disk cloning belongs to the same type;
s8, if the disks belong to the same type, cloning, guiding and repairing the disks of the same type;
s9, if the disks do not belong to the same type of disk cloning, guiding and repairing the disks of different types; and at this point, the cloning is finished, the cloning-guided repair is finished, and the system is started normally.
2. The System cloning method of claim 1, wherein in step S1, initializing all disks and volumes is to initialize all disks, partitions and volumes of the current computer and find System partition, Boot partition and Recovery partition of the current System.
3. The system cloning method of claim 2, wherein in step S2, the proper target location is selected as a target disk for determining whether the target disk has the cloning condition, and if the total capacity of the target disk is less than the sum of the used space capacities of the system partitions, the target disk does not have the cloning condition, that is, the target location is not proper; if the total capacity of the target disk is greater than or equal to the sum of the used spaces of the system partitions, the target disk is provided with a clone condition, that is, the target location is appropriate.
4. The system cloning method of claim 3, wherein in step S2, if the disk types are different and the condition of space size is satisfied, the system cloning method is also qualified.
5. The system cloning method of claim 4, wherein in step S2, the cloning parameters are constructed to construct a virtual configuration after the system is cloned to the target location according to the selected target location.
6. The System cloning method of claim 5, wherein in step S2, in the process of constructing the cloning parameters, if the target location is smaller than the total size of the System partition, the Boot partition needs to be reduced when constructing the partition form of the target location, and the Boot partition is reduced until three partitions, namely a System partition, a Boot partition and a Recovery partition of the System, can be accommodated in the target location.
7. The System cloning method as claimed in claim 6, wherein in step S2, if the reduced Boot partition reaches the limit value or cannot satisfy the condition during the clone parameter construction, checking whether the System partition and the Recovery partition can be reduced, and if the System partition and the Recovery partition can be reduced, preferentially reducing the Recovery partition and then reducing the System partition.
8. The System cloning method of claim 7, wherein in step S2, if the condition is not satisfied after the System partition and the Recovery partition are reduced during the construction of the cloning parameters, the cloning cannot be continued.
9. The System cloning method of claim 8, wherein in step S2, in the process of constructing the clone parameters, if the target location is larger than the total size of the System, the System partition on the target disk is expanded, and the Boot partition is expanded to a size of the capacity of the target disk minus the capacity of the System partition and the capacity of the Recovery partition.
10. The System cloning method as claimed in claim 9, wherein in step S2, in the process of constructing the clone parameters, if the target location is consistent with the System size, the target disk is kept consistent with the System size, or the relative sizes of the System partition, Boot partition and Recovery partition are changed, but the partition capacity of the target disk is greater than or equal to the used space capacity of the corresponding partition of the System, that is, the partition of the target disk can accommodate the corresponding partition of the lower System.
CN202011425414.0A 2020-12-09 2020-12-09 System cloning method Active CN112416657B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011425414.0A CN112416657B (en) 2020-12-09 2020-12-09 System cloning method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011425414.0A CN112416657B (en) 2020-12-09 2020-12-09 System cloning method

Publications (2)

Publication Number Publication Date
CN112416657A true CN112416657A (en) 2021-02-26
CN112416657B CN112416657B (en) 2023-05-09

Family

ID=74775307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011425414.0A Active CN112416657B (en) 2020-12-09 2020-12-09 System cloning method

Country Status (1)

Country Link
CN (1) CN112416657B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112304A (en) * 2023-08-31 2023-11-24 成都傲梅科技有限公司 Disk cloning method and system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545657A (en) * 2001-08-31 2004-11-10 () Method for backing up and recovering data in hard disk of computer
KR20090006928A (en) * 2007-07-13 2009-01-16 주식회사 가자아이 Method for restoration and backup of computer system
CN102567136A (en) * 2010-12-15 2012-07-11 研祥智能科技股份有限公司 Backup and recovery method of computer system, device and computer system
CN105138431A (en) * 2015-08-27 2015-12-09 厦门市美亚柏科信息股份有限公司 Linux system back-up and restoring method
CN106326039A (en) * 2016-08-24 2017-01-11 浪潮(北京)电子信息产业有限公司 Method and device for cloning logical volume in disk and disk
CN106648957A (en) * 2015-11-03 2017-05-10 中国移动通信集团安徽有限公司 Operating system backup and recovery method and system
CN108241550A (en) * 2016-12-23 2018-07-03 研祥智能科技股份有限公司 A kind of operating system backup and reduction method
CN108829351A (en) * 2018-06-04 2018-11-16 成都傲梅科技有限公司 A kind of MBR disk turns the method and its system of GPT disk

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1545657A (en) * 2001-08-31 2004-11-10 () Method for backing up and recovering data in hard disk of computer
KR20090006928A (en) * 2007-07-13 2009-01-16 주식회사 가자아이 Method for restoration and backup of computer system
CN102567136A (en) * 2010-12-15 2012-07-11 研祥智能科技股份有限公司 Backup and recovery method of computer system, device and computer system
CN105138431A (en) * 2015-08-27 2015-12-09 厦门市美亚柏科信息股份有限公司 Linux system back-up and restoring method
CN106648957A (en) * 2015-11-03 2017-05-10 中国移动通信集团安徽有限公司 Operating system backup and recovery method and system
CN106326039A (en) * 2016-08-24 2017-01-11 浪潮(北京)电子信息产业有限公司 Method and device for cloning logical volume in disk and disk
CN108241550A (en) * 2016-12-23 2018-07-03 研祥智能科技股份有限公司 A kind of operating system backup and reduction method
CN108829351A (en) * 2018-06-04 2018-11-16 成都傲梅科技有限公司 A kind of MBR disk turns the method and its system of GPT disk

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
R GIOVANINI 等: "A primary and backup cooperative protection system based on wide area agents" *
高志鹏 等: "基于文件系统数据结构互补的NTFS引导扇区智能修复系统" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112304A (en) * 2023-08-31 2023-11-24 成都傲梅科技有限公司 Disk cloning method and system
CN117112304B (en) * 2023-08-31 2024-02-20 成都傲梅科技有限公司 Disk cloning method and system

Also Published As

Publication number Publication date
CN112416657B (en) 2023-05-09

Similar Documents

Publication Publication Date Title
CN110531940B (en) Video file processing method and device
EP1739535B1 (en) File system storing transaction records in flash-like media
US7363540B2 (en) Transaction-safe FAT file system improvements
US20120084272A1 (en) File system support for inert files
JP2007012056A (en) File system having authentication of postponed data integrity
US8825653B1 (en) Characterizing and modeling virtual synthetic backup workloads
JP2007012054A (en) Startup authentication of optimized file system integrity
US9921765B2 (en) Partial snapshots in virtualized environments
US8655847B2 (en) Mirroring data changes in a database system
EP2738688A1 (en) Method and apparatus for file system cleaning and storage medium thereof
KR20170125698A (en) Generalized write operations verification method
US9298733B1 (en) Storing files in a parallel computing system based on user or application specification
US9858287B2 (en) Storage system
CN111007990B (en) Positioning method for quickly positioning data block references in snapshot system
CN106709014B (en) File system conversion method and device
CN112800007B (en) Directory entry expansion method and system suitable for FAT32 file system
CN110795386B (en) Data writing method and server
CN117112304B (en) Disk cloning method and system
CN112416657A (en) System cloning method
KR20100011137A (en) Data processing apparatus and data procssing method, using fat file system capable of fast file recovery
KR20100066735A (en) An automatic sync or back-up system using a removable storage device and the method thereof
JP2008129967A (en) Volume transition program and method
CN111143110A (en) Raid data recovery method based on metadata in logical volume management
CN114816542A (en) System starting method and device
CN111831224B (en) Method, system and equipment for erasing residual space of exFAT partition file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant