Data synchronization methods, mirroring methods, devices, and media

By converting the target file into a virtual disk image and mounting it to the serial bus control port of the remote server, it monitors file change events in real time and dynamically updates the image, solving the problems of data synchronization complexity and error risks in existing technologies and achieving efficient and accurate data synchronization.

CN120448358BActive Publication Date: 2025-09-16INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510948131.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-16
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

In the prior art, data synchronization methods are complex and have a high risk of errors, resulting in low efficiency and low accuracy, especially in the data synchronization process between a remote server and a local server.

Method used

By converting the target file into a virtual disk image and mounting it to the serial bus control port of the remote server, it is identified as a removable storage device, monitoring file change events in real time, obtaining change information, and dynamically updating the virtual disk image based on this to complete modification synchronization.

Benefits of technology

It achieves efficient and accurate file modification synchronization between local and remote servers, ensures real-time data consistency, and improves the efficiency and reliability of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448358B_ABST
    Figure CN120448358B_ABST
Patent Text Reader

Abstract

The present invention provides a data synchronization method that can be applied to the field of computer communication technology. The data synchronization method includes: responding to a synchronization request initiated by a local server, receiving a virtual disk image generated by the local server through a preset transmission channel by converting a target file, wherein the synchronization request carries an edit mode identifier of the target file; mounting the virtual disk image to a serial bus control port of a remote server so that the virtual disk image can be identified as a removable storage device; if the edit mode identifier indicates that the target file is in an editable state, obtaining change information generated by the local server and / or remote server in modifying the target file by real-time monitoring of file change events on the removable storage device; and dynamically updating the virtual disk image based on the change information to complete modification synchronization of the target file. The present invention also provides a mirror mounting method, device, and storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer communications, and in particular to a data synchronization method, a mirror mounting method, a device and a medium. Background Art

[0002] Current remote server management technologies often require enterprise data to be synchronized between local and remote servers. These technologies primarily support one-way data transfer from the local server to the remote server. Modified content on the remote server must first be exported before it can be synchronized back to the local server.

[0003] In the process of realizing the concept of the present invention, there are at least the following problems in the related art: the synchronization method of exporting and then transmitting data not only increases the complexity of the operation, but also has a high risk of errors in the export link, which ultimately leads to low efficiency and low accuracy of data synchronization. Summary of the Invention

[0004] In view of the above problems, the present invention provides a data synchronization method, a mirror mounting method, an apparatus, a device, a medium and a program product.

[0005] According to a first aspect of the present invention, a data synchronization method is provided, comprising: responding to a synchronization request initiated by a local server, receiving a virtual disk image generated by the local server converting a target file through a preset transmission channel, wherein the synchronization request carries an editing mode identifier of the target file; mounting the virtual disk image to a serial bus control port of a remote server so that the virtual disk image can be identified as a removable storage device; if the editing mode identifier indicates that the target file is in an editable state, obtaining change information generated by the local server and / or the remote server modifying the target file by real-time monitoring of file change events on the removable storage device; and dynamically updating the virtual disk image based on the change information to complete modification synchronization of the target file.

[0006] The second aspect of the present invention provides an image mounting method, comprising: converting a target file selected by an object into a virtual disk image; transmitting the virtual disk image to the management controller through a preset transmission channel connected to the management controller, so as to mount the virtual disk image to the serial bus control port of the remote server through the management controller, so that the virtual disk image can be identified as a removable storage device.

[0007] The third aspect of the present invention provides a data synchronization device, including: an image receiving module, used to respond to a synchronization request initiated by a local server, and receive a virtual disk image generated by the local server converting the target file through a preset transmission channel, wherein the synchronization request carries an editing mode identifier of the target file; an image mounting module, used to mount the virtual disk image to the serial bus control port of the remote server so that the virtual disk image can be identified as a removable storage device; an information acquisition module, used to obtain change information generated by the local server and / or the remote server modifying the target file by real-time monitoring of file change events on the removable storage device if the editing mode identifier indicates that the target file is in an editable state; a dynamic update module, used to dynamically update the virtual disk image based on the change information to complete the modification synchronization of the target file.

[0008] The fourth aspect of the present invention provides an image mounting device, comprising: a file conversion module, used to convert a target file selected by an object into a virtual disk image; an image transmission module, used to transmit the above-mentioned virtual disk image to the above-mentioned management controller through a preset transmission channel connected to the management controller, so as to mount the above-mentioned virtual disk image to the serial bus control port of the remote server through the above-mentioned management controller, so that the above-mentioned virtual disk image can be identified as a removable storage device.

[0009] A fifth aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0010] The sixth aspect of the present invention further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.

[0011] The seventh aspect of the present invention further provides a computer program product, comprising a computer program or instructions, which implement the steps of the above method when executed by a processor.

[0012] According to an embodiment of the present invention, a virtual disk image converted from a target file is received and mounted on a serial bus controller port of a remote server so that the target file is identified as a removable storage device. By converting the target file into a virtual disk image and mounting it for transmission, efficient data flow is achieved. When the target file is in an editable state, file change events are monitored in real time to obtain change information, and the virtual disk image is dynamically updated based on the change information, thereby completing modification synchronization. By monitoring file change events in real time and dynamically updating, the real-time consistency of local and remote server data is ensured. With the help of virtual disk image mounting and real-time monitoring mechanisms, automatic synchronization of file modifications between local and remote servers is achieved, significantly improving the efficiency and accuracy of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings.

[0014] Figure 1 An application scenario diagram of a data synchronization method, a mirror mounting method, an apparatus, a device, a medium, and a program product according to an embodiment of the present invention is shown.

[0015] Figure 2 A flow chart of a data synchronization method according to an embodiment of the present invention is shown.

[0016] Figure 3 A data flow diagram of mounting a storage medium in a data synchronization method according to an embodiment of the present invention is shown.

[0017] Figure 4 A flowchart of multi-mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0018] Figure 5 A flowchart of overlay mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0019] Figure 6 A flowchart of new mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0020] Figure 7 A flowchart of merge mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0021] Figure 8 A flow chart of an image mounting method according to an embodiment of the present invention is shown.

[0022] Figure 9 A structural block diagram of a data synchronization device according to an embodiment of the present invention is shown.

[0023] Figure 10A structural block diagram of an image mounting device according to an embodiment of the present invention is shown.

[0024] Figure 11 A block diagram of an electronic device suitable for implementing a data synchronization method and a mirror mounting method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0025] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concept of the present invention.

[0026] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the presence of the features, steps, operations and / or components, but do not exclude the presence or addition of one or more other features, steps, operations or components.

[0027] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0028] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0029] In the technical solution of the present invention, the data involved (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0030] An embodiment of the present invention provides a data synchronization method, comprising: responding to a synchronization request initiated by a local server, receiving a virtual disk image generated by the local server through a preset transmission channel by converting a target file, wherein the synchronization request carries an editing mode identifier of the target file; mounting the virtual disk image to a serial bus control port of a remote server so that the virtual disk image can be identified as a removable storage device; if the editing mode identifier indicates that the target file is in an editable state, obtaining change information generated by the local server and / or remote server modifying the target file by real-time monitoring of file change events on the removable storage device; and dynamically updating the virtual disk image based on the change information to complete modification synchronization of the target file.

[0031] Figure 1 An application scenario diagram of a data synchronization method, a mirror mounting method, an apparatus, a device, a medium, and a program product according to an embodiment of the present invention is shown.

[0032] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a local server 101, a remote server 102, and a management controller 103 deployed on the remote server 102. A network 104 is used as a medium for providing a communication link between the local server 101 and the remote server 102. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0033] Users can use the local server 101 to interact with the remote server 102 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the local server 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0034] The local server 101 may be any electronic device having a display screen and supporting web browsing, including but not limited to a tablet computer, a laptop computer, a desktop computer, and the like.

[0035] Remote server 102 may be a server that provides various services, such as a backend management server (for example only) that supports websites browsed by users using local server 101. The backend management server may analyze and process received user requests and other data, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal device.

[0036] The management controller 103 is a core hub component connecting the local server 101 and the remote server 102. As the central coordination unit of the distributed system, the management controller 103 is mainly responsible for the scheduling and protocol conversion of bidirectional data flows.

[0037] It should be noted that the data synchronization method provided in the embodiment of the present invention can generally be executed by the management controller 103 in the remote server 102, and the image mounting method can generally be executed by the local server 101. Accordingly, the data synchronization device provided in the embodiment of the present invention can generally be set in the remote server 102, and the image mounting device can generally be set in the local server 101.

[0038] It should be understood that Figure 1 The number of remote servers, networks and local servers in the embodiment is merely illustrative. Any number of remote servers, networks and local servers may be provided as needed.

[0039] The following will be based on Figure 1 The scene described by Figures 2 to 7 The data synchronization method of the embodiment is described in detail.

[0040] Figure 2 A flow chart of a data synchronization method according to an embodiment of the present invention is shown.

[0041] like Figure 2 As shown, this embodiment includes operations S210 to S240.

[0042] In operation S210, in response to a synchronization request initiated by a local server, a virtual disk image generated by converting a target file by the local server is received through a preset transmission channel, wherein the synchronization request carries an edit mode identifier of the target file.

[0043] In operation S220 , the virtual disk image is mounted to a serial bus control port of a remote server, so that the virtual disk image can be recognized as a removable storage device.

[0044] In operation S230, if the edit mode flag indicates that the target file is in an editable state, the change information generated by the local server and / or remote server in modifying the target file is obtained by monitoring the file change event on the removable storage device in real time.

[0045] In operation S240 , the virtual disk image is dynamically updated based on the change information to complete modification synchronization of the target file.

[0046] According to embodiments of the present invention, with the widespread adoption of distributed systems and cloud computing technologies, enterprises often require real-time synchronization of data between local and remote servers to meet requirements for cross-regional collaboration, data backup, and disaster recovery. Especially in scenarios involving large files or frequent changes, converting virtual disk images to removable storage devices through a Baseboard Management Controller (BMC) can effectively improve the flexibility and reliability of data synchronization.

[0047] When the BMC responds to a synchronization request from a local server, it receives the virtual disk image through a pre-defined transmission channel built on the Transport Layer Security (TLS) protocol. This pre-defined transmission channel integrates an encrypted tunnel to ensure data transmission security. Furthermore, it uses streaming to receive image files in segments, preventing transmission interruptions caused by large files.

[0048] During this process, the BMC parses the edit mode flag carried in the synchronization request. This flag is used to distinguish between the read-only and editable status of the target file. After receiving the request, the virtual disk image is stored in a standard format in a temporary cache directory, ready for subsequent mounting operations. This implementation ensures stable image transmission and efficient flag parsing, enabling the BMC to accurately identify the target file's operational permissions.

[0049] Mounting a virtual disk image to a remote server's virtual serial bus controller requires the use of the operating system's device driver interface. Specifically, the BMC binds a Network Block Device (NBD) to the target port of the virtual serial bus controller and enumerates it as a removable storage device to the remote server.

[0050] The mounting process requires configuring the file system type and setting read and write permissions based on the edit mode flag. In read-only mode, the read-only flag is set when mounting on the remote server, prohibiting write operations. At the same time, the kernel layer activates mandatory access control mechanisms to ensure that even privileged users cannot bypass the read-only restrictions. In read-write mode, the kernel module for the userspace file system is loaded and mounted to the specified directory. Once the virtual disk image is successfully mounted, the remote server's file system will assign it a separate device node for easy identification in subsequent operations.

[0051] Figure 3 A data flow diagram of mounting a storage medium in a data synchronization method according to an embodiment of the present invention is shown.

[0052] like Figure 3As shown, a target file 311 on a local server 310 is connected to a virtual machine 312 on the local server 310 via a custom protocol. The virtual machine 312 then transmits the virtual disk image to a management controller 321 deployed on a remote server 320 via a preset transmission channel. The management controller 321 then passes the virtual disk image to a network block device 322 on the remote server 320, which then simulates the virtual disk image via a serial bus controller 323, ultimately identifying the virtual disk image as a removable storage medium 324.

[0053] According to an embodiment of the present invention, if the edit mode identifier indicates that the target file is in an editable state, the BMC needs to deploy a file change monitoring module in the remote server. The file change monitoring module monitors events such as file creation, modification, and deletion on removable storage devices in real time based on the file system event notification mechanism of the operating system. When a change is detected, the file change monitoring module extracts the change information and distinguishes the source of the change by comparing the identifier or process identifier of the local server. The acquired change information will be encapsulated as a structured log object and temporarily stored in the memory buffer waiting for processing, ensuring millisecond-level change capture efficiency. In read-only mode, the monitoring module will be automatically disabled to avoid unnecessary resource consumption, and the file integrity will be regularly checked to ensure that it has not been tampered with.

[0054] Based on the acquired change information, the BMC dynamically updates the virtual disk image through an incremental update mechanism. To avoid performance loss, a change buffer threshold can be set. When the cumulative change volume reaches the threshold or a preset time interval (for example, 500 milliseconds), a batch update is triggered. During the update process, a transaction log mechanism is enabled, and each operation is recorded. If an exception occurs, the log can be used to roll back to a consistent state. For read-only images, the update process is skipped, but access logs are still recorded for audit trails.

[0055] After the update is complete, the BMC synchronizes the changes to the peer server, achieving bidirectional data synchronization. This dynamic update method keeps synchronization latency to within seconds while ensuring the integrity and consistency of the image file through a transaction mechanism. In read-only mode, only one-way synchronization is performed, ensuring that modifications made to the remote server do not propagate back to the source, thereby maintaining strict data protection policies.

[0056] According to an embodiment of the present invention, a virtual disk image converted from a target file is received and mounted on a serial bus controller port of a remote server so that the target file is identified as a removable storage device. By converting the target file into a virtual disk image and mounting it for transmission, efficient data flow is achieved. When the target file is in an editable state, file change events are monitored in real time to obtain change information, and the virtual disk image is dynamically updated based on the change information, thereby completing modification synchronization. By monitoring file change events in real time and dynamically updating, the real-time consistency of local and remote server data is ensured. With the help of virtual disk image mounting and real-time monitoring mechanisms, automatic synchronization of file modifications between local and remote servers is achieved, significantly improving the efficiency and accuracy of data synchronization.

[0057] According to an embodiment of the present invention, based on the change information, the virtual disk image is dynamically updated to complete the modification synchronization of the target file, including: in response to the file synchronization mode selected by the object, the change information obtained by monitoring is analyzed to obtain the analysis result, and the synchronization strategy is determined based on the analysis result, the file synchronization mode is one of the overwrite mode, the new mode and the merge mode, and the change information includes the file path, file size and modification time triggered by the file change event; according to the synchronization strategy, the virtual disk image is dynamically updated to complete the modification synchronization of the target file.

[0058] When dynamically updating a virtual disk image based on change information, the system first responds to the user's selected file synchronization mode (overwrite, create, or merge) and then performs structured parsing and analysis of the change information (including file path, file size, modification time, etc.) acquired through monitoring. Remote server change information is generated by capturing write operations in the NBD transaction log, while local server change information is generated by acquiring file change events through the file system event listener.

[0059] After obtaining the change information, the integrity of the change information is first verified. For example, verifying whether the file path points to a valid location within the virtual disk image and comparing the file size with the modification time stamp can determine whether the change is the latest and unprocessed operation. During the analysis process, corresponding synchronization policies are generated and execution conditions are determined based on different file synchronization modes. For example, the overwrite mode requires confirming that the target file exists and that the permissions allow overwriting; the new create mode requires checking whether the target path can create a file; and the merge mode requires detecting the risk of file conflicts.

[0060] After determining the synchronization strategy, the incremental update mechanism is activated to dynamically modify the virtual disk image. During the update process, transaction logs are monitored in real time. If an anomaly occurs in any step (such as data writing or metadata updating), a rollback mechanism is immediately triggered, restoring the virtual disk image to its pre-update consistency based on the log records. After the update is complete, the change information is synchronized to the peer server and the file status flag is refreshed to ensure that the virtual disk image is fully synchronized with the actual file operations, ultimately completing the target file modification synchronization task.

[0061] This dynamic update mechanism enables efficient and accurate data synchronization. It significantly improves the flexibility and reliability of file transfers through structured analysis of change information and the application of differentiated synchronization strategies.

[0062] Figure 4 A flowchart of multi-mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0063] like Figure 4 As shown, in operation S410, it is determined that a target file has been modified for synchronization. By scanning the change records of the local server and the remote server, the difference content of the file that needs to be synchronized is accurately identified.

[0064] In operation S420, a file synchronization mode selected by a user is determined.

[0065] When the user selects overwrite mode, operations S4211 and S4212 are executed sequentially. In operation S4211, the hash value of the local file is verified. In operation S4212, an atomic replacement operation is performed. By verifying the hash value of the local file, data integrity is ensured; by performing the atomic replacement operation, the new version of the file can completely and securely overwrite the old version of the file.

[0066] When the user selects the new mode, operations S4221 and S4222 are executed sequentially. In operation S4221, a timestamped copy is generated. In operation S4222, the historical version is retained. In the new mode, a copy of the original file with an accurate timestamp is generated, the historical version is retained as a backup, and the new file is written to the designated location.

[0067] When the user selects the merge mode, operations S4231 and S4232 are executed sequentially. In operation S4231, a difference comparison is initiated. In operation S4232, a merge suggestion report is generated. By initiating a difference comparison algorithm (which intelligently compares the local and remote versions), a detailed merge suggestion report is automatically generated based on the comparison results for the user's final confirmation.

[0068] By scanning the change records of local and remote servers, accurately identifying file differences and adopting differentiated processing strategies based on the synchronization mode selected by the user, it ensures that the virtual disk image can be accurately and reliably updated in various application scenarios.

[0069] According to an embodiment of the present invention, if the synchronization mode is an overwrite mode, the change information obtained through monitoring is analyzed to obtain an analysis result, and a synchronization strategy is determined based on the analysis result, including: performing a difference comparison between the change information sent by the remote server obtained through monitoring and the file information of the target file in the local server to obtain a comparison result, the difference comparison includes file path comparison, file size comparison and modification time comparison; based on the comparison result, determining the change status of the target file; if the change status is a pending update status, determining the synchronization strategy to update the change data generated by the remote server to the virtual disk image, so that the local server obtains the change data from the virtual disk image through a preset transmission channel to overwrite the local target file.

[0070] In overlay mode, a multi-layered verification mechanism achieves strong consistency in data synchronization from remote to local servers. Change information (including file path, file size, and modification time) sent by the monitored remote server is compared against the target file information on the local server in multiple dimensions. File path comparison utilizes a prefix tree index structure, locating path validity within milliseconds. File size comparison is combined with a hash checksum to avoid invalid comparisons due to transmission errors. Modification time comparison is based on nanosecond timestamp sorting to ensure the accuracy of change timing.

[0071] After the comparison is complete, the state machine model is used to determine the target file's change status. If the file path in the remote server's change information doesn't exist in the local index, or if the modification time indicates an update to the target file on the remote server, the file is marked as "pending update." If the file sizes are inconsistent but the modification times are the same, the incremental synchronization algorithm triggers a block hash comparison to accurately identify the data differences.

[0072] When a pending update is determined, the transactional deletion protocol is activated, marking the target file on the local server for pre-deletion. Simultaneously, an improved incremental synchronization algorithm is used to calculate the changed data to be transmitted. Only the changes on the remote server are written to the virtual disk image via a pre-set transmission channel. The local server polls the update marker in the virtual disk image to retrieve the changed data in real time and overwrite the local target file. The entire process is ensured by the atomicity of the transaction log.

[0073] In overwrite mode, a multi-dimensional comparison of file paths, file sizes, and modification times between the remote and local servers is performed. Based on the comparison results, the change status is determined and an overwrite update is triggered. By building a change detection mechanism based on multi-feature comparison, accurate file status identification and targeted updates are achieved.

[0074] According to an embodiment of the present invention, based on the comparison result, the change status of the target file is determined, including: if the comparison result indicates that the file path and modification time are consistent, but there is a difference in file size, then the real-time verification code of the target file in the local server is dynamically calculated; if the comparison result indicates that there is a difference in file path or modification time, or the calculated real-time verification code is different from the expected verification code in the change information sent by the remote server, then the change status of the target file is marked as a pending update status.

[0075] In overwrite mode, when it is detected that the file path is consistent with the modification time but the file size is different, a multi-layer verification mechanism will be activated to accurately identify content changes. Specifically, the real-time handle of the target file is located through the transaction log, and the real-time verification code of the local file is calculated using block streaming reading. For files larger than the preset value (1MB), the block hash algorithm is automatically enabled to avoid memory peaks caused by one-time loading. For files smaller than the preset value, the full content is directly read to generate a verification code. During the calculation process, if it is found that the file is being written, the verification will be performed after the operation is completed to ensure data integrity.

[0076] When there are discrepancies in file paths (e.g., the file path in the remote server change information doesn't exist in the local index, or the path hierarchy has changed), or when there are nanosecond differences in modification times, the target file is immediately marked as pending an update. For files with the same modification time but unusual sizes, a real-time checksum is calculated and compared with the expected checksum in the remote change information.

[0077] If the checksums are inconsistent, it means the file content has been modified, and an update will be triggered even if the modification time has not been updated. If the checksums are consistent, it is determined that the abnormal file size display is caused by a storage medium error. In this case, the update will be skipped to reduce invalid transmission.

[0078] The entire comparison process, by building a multi-dimensional verification mechanism, introduces real-time verification code calculation and dynamic matching of expected verification codes based on the comparison of file paths and modification times, thus achieving accurate identification of file content changes.

[0079] According to an embodiment of the present invention, the data synchronization method also includes: adding files that exist in the local server but are marked as to be deleted in the change information of the remote server to the deletion queue; and moving the files in the deletion queue to a temporary recycle bin; if it is determined that the synchronization of the target file is completed, the file information in the local server is compared with the change information of the remote server; if a difference in information is detected, the rollback mechanism is triggered, and the target file before synchronization is restored from the temporary recycle bin to the local server; if it is detected that the information remains consistent, the files in the temporary recycle bin are cleared.

[0080] In overwrite mode, if a file is detected that exists on the local server but is marked for deletion in the remote server's change information, the target file is quickly located based on the file index, encapsulated as a deletion task object, and added to the deletion queue. The deletion queue is managed using a linked list structure. Each deletion task object contains the file's original path, deletion timestamp, and permissions information, ensuring accurate restoration of file attributes during subsequent recovery.

[0081] Next, the files in the deletion queue are moved in batches to a temporary recycle bin. Each step of this process is recorded in the transaction log. Specifically, hard links are created for the files in the temporary recycle bin before the original files are deleted. If input / output interruptions or process anomalies occur during the operation, the hard link information recorded in the transaction log can be used to quickly restore the files.

[0082] If synchronization of the target file is complete, a bidirectional consistency check is initiated. Specifically, the target file's file information on the local server is rescanned and compared item by item with the change information on the remote server. Comparison criteria include the existence of the file path, the pending deletion flag status, the file size, the modification time, and the checksum.

[0083] If the target file is not deleted on the local server but is marked as deleted on the remote server, or if the target file in the temporary Recycle Bin is inconsistent with the original record, a rollback mechanism is triggered. The target file is restored from the temporary Recycle Bin using the original path and permissions recorded in the transaction log, and the remaining copy in the temporary Recycle Bin is deleted. If all file comparison results are consistent, the Recycle Bin is emptied through an atomic operation to prevent residual files from occupying storage resources.

[0084] By building a cached file synchronization rollback mechanism and using a temporary recycle bin to temporarily store pending deletion files, recovery or cleanup operations are triggered based on the information comparison results between the two ends after synchronization is complete. By introducing a deletion buffer layer and state verification, reversibility control of the synchronization process is achieved.

[0085] Figure 5 A flowchart of overlay mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0086] like Figure 5 As shown, in operation S501 , it is determined that the virtual machine session is terminated.

[0087] In operation S502, it is determined whether the current mode is read-write mode. If yes, operation S503 is executed; if not, operation S514 is executed.

[0088] In operation S503, the overlay synchronization process is triggered. In operation S504, the virtual disk image in the remote server is mounted. In operation S505, the file index of the local server and the remote server is generated. In operation S506, the difference analysis engine is started.

[0089] In operation S507, it is determined whether there is a synchronization difference. If yes, operation S508 is executed; if not, operation S514 is executed.

[0090] In operation S508, transaction pre-execution is performed. In operation S509, an atomic commit operation is performed. In operation S510, consistency verification is performed.

[0091] In operation S511, it is determined whether the consistency verification is passed. If passed, operation S512 is performed; if not, operation S513 is performed.

[0092] In operation S512, the audit log is updated. In operation S513, the operation is rolled back and an alarm is issued.

[0093] In operation S514 , the virtual disk is unmounted.

[0094] Regarding the file synchronization process when a virtual machine session is terminated, when it is determined that a virtual machine session event has been triggered, it is detected whether the current session is in read-write mode. If it is in read-write mode, the overwrite synchronization process is immediately started.

[0095] During the synchronization preparation phase, the remote server's virtual disk image is remounted and a read-write mode mount check is performed to ensure normal device access. A file index for the local and remote servers is then generated. This file index contains read-write mode-specific checksum chain information, providing baseline data for subsequent difference analysis. Once the difference analysis engine is activated, it scans and compares the file system to determine if there are any differences that need to be synchronized.

[0096] When a difference to be synchronized is detected, the transaction processing phase begins. A pre-transaction operation is performed to verify feasibility. Once confirmed, an atomic commit is performed to ensure the integrity of the data update. After the update is complete, a strict consistency check is performed. If the check fails, a rollback mechanism is triggered, an alert is generated, and the virtual disk is unmounted. If the check succeeds, the audit log is updated to record the exception and the virtual disk is unmounted. This entire process, through transactional operations and a dual verification mechanism, effectively ensures data security during unexpected session terminations.

[0097] The triple protection of pre-execution checks, atomic operations, and rollback mechanisms prevents data inconsistencies caused by accidental session disconnections. The complete audit log also provides a reliable basis for subsequent problem tracing.

[0098] According to an embodiment of the present invention, if the synchronization mode is a new creation mode, the change information obtained through monitoring is analyzed to obtain an analysis result, and a synchronization strategy is determined based on the analysis result, including: saving the change information sent by the remote server obtained through monitoring and the change information sent by the local server as independent version files respectively; pointing the logical path of the target file in the virtual disk image to the storage location of the selected version file; and determining the synchronization strategy to obtain the corresponding version file from the virtual disk image based on the storage location to perform the file synchronization operation.

[0099] In new mode, a version branch management mechanism is used to preserve historical versions and synchronize them without conflicts. For each monitored change from the remote and local servers, a separate version file is generated. This unique identifier is constructed using a nanosecond timestamp combined with a hash of the original file name, such as 20250625T142318.123456789_8a3b_report.txt. Version files are sharded based on the first four digits of the file path's hash value (e.g., ` / versions / 8a3b / `). This approach evenly distributes millions of files across 256 directories, preventing overloading of a single directory.

[0100] Convert the logical path of the target file in the virtual disk image to the storage location of the version file. Quickly locate the latest version through the version control index. The index maintains the mapping relationship between the logical path and the storage location and records the version chain information (such as the parent version ID and the change time).

[0101] When syncing, the storage location of the currently active version file is parsed based on the logical path and mounted to the specified directory via the userspace file system, enabling transparent version switching. If you need to go back to a previous version, you only need to modify the storage location to point to the version file with the corresponding timestamp, without moving the actual data.

[0102] To optimize storage efficiency, version files older than a preset time are automatically compressed and archived, generating immutable package files. Content-addressed storage eliminates duplicate data blocks. After synchronization is complete, an audit report is generated containing a change summary, version path, and operation time. Version retrieval based on time range and file path is supported. The entire process is atomic, guaranteed by transaction logging, allowing for rapid rollback to the most recent consistent state in the event of an anomaly.

[0103] In the new mode, the change information of the remote server and the local server are saved as independent version files respectively. During synchronization, the target version storage location is dynamically pointed to through the logical path, realizing parallel storage and flexible calling of multiple versions.

[0104] Figure 6 A flowchart of new mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0105] like Figure 6 As shown, in operation S610, the changed files are detected. In operation S620, a timestamp copy is generated. In operation S630, the metadata index is updated. In operation S640, the old version is compressed and archived. In operation S650, a synchronization report is generated.

[0106] Through a real-time monitoring mechanism, file change events on remote and local servers are captured. For each changed file, a timestamp copy is generated and a unique version identifier is constructed using nanosecond timestamps combined with file hash values ​​to ensure accurate version tracking.

[0107] During the version management phase, metadata indexes are updated to establish a mapping between the file's logical path and the version storage location. Historical versions are automatically compressed and archived, using content-addressable storage technology to eliminate redundant data blocks and optimize storage space utilization.

[0108] Finally, a synchronization report is generated, detailing key information such as the change summary, version path, and operation time. Transaction logging ensures the atomicity of operations and supports rapid rollback in the event of anomalies. In new mode, remote and local changes are saved as independent versions. Dynamic path resolution enables concurrent management and flexible access of multiple versions, providing users with complete version control capabilities.

[0109] According to an embodiment of the present invention, if the synchronization mode is a merge mode, the change information obtained through monitoring is analyzed to obtain an analysis result, and a synchronization strategy is determined based on the analysis result, including: constructing a comparison tree based on the change information sent by the remote server obtained through monitoring and the change information sent by the local server, wherein each comparison node in the comparison tree corresponds to the file path in the change information, and the node attributes of the comparison node include the file size and modification time; determining the modification status of the target file by traversing the comparison tree, wherein the modification status includes the local server and the remote server performing unidirectional modification or bidirectional modification on the target file; based on the modification status, determining the synchronization strategy as an overwrite synchronization strategy corresponding to the unidirectional modification, or a conflict merge strategy corresponding to the bidirectional modification.

[0110] In merge mode, a multi-level comparison tree is constructed to analyze and make policy decisions regarding changes between the local and remote servers. A prefix tree structure is used to construct the comparison tree for change information sent by the remote and local servers. Specifically, the file path is hierarchically broken down into comparison nodes, each storing the file size, modification time, and hash value of the corresponding file path.

[0111] After the comparison tree is built, breadth-first traversal is used to analyze the attribute differences of the comparison nodes layer by layer to dynamically identify the modification status of the target file. During the traversal process, each comparison node will be classified according to the change records, modification time and hash value of the local server and the remote server. If the comparison node has a modification record only on one side (such as the local server or the remote server), and its modification time is later than the last synchronization timestamp, it is determined to be a "one-way modification" (only local modification or only remote modification). If the modification time on both sides is updated and the hash values ​​are inconsistent, it is marked as "two-way modification". For comparison nodes where no timestamp or hash changes are detected, they are classified as "unmodified on both sides". If the file on one side has been deleted and there are modifications on the other side, the modification status will be determined as "one-way modification" based on the side with the modification. In the future, the user can be requested to manually intervene in this situation.

[0112] For bidirectional modification scenarios, a text-based or binary content similarity algorithm is introduced to calculate the difference ratio. When the similarity exceeds a preset threshold (e.g., 90%), the merge process is automatically triggered, prioritizing the retention of the latest version or the fusion of key fields. If the similarity falls below the threshold, a conflict alert is generated, the metadata of the conflicting file (e.g., file path, modification time) is recorded, and automatic synchronization is suspended, pending manual intervention by an administrator or user. This process balances automation efficiency and data consistency through real-time comparison and threshold control, ensuring reliable synchronization in complex modification scenarios.

[0113] Dynamically select a synchronization strategy based on the modification status. For one-way modifications, the optimized overwrite synchronization strategy is directly used, and only the changed data is transferred through block hash comparison using the incremental synchronization algorithm. For two-way modifications, a conflict merge strategy is enabled, which can include automatic merging of non-conflicting sections, generating visual differences for manual selection, and adopting a latest modification priority strategy. During the merge process, each operation is recorded in the transaction log, and if an exception occurs, the system immediately rolls back to the most recent consistent state to ensure data atomicity.

[0114] In merge mode, a comparison tree with file path, file size, and modification time is constructed based on the change information on both ends. By traversing the tree structure, the unidirectional or bidirectional modification status of the target file and the corresponding synchronization strategy are determined to achieve differentiated synchronous data transmission.

[0115] According to an embodiment of the present invention, the overlay synchronization strategy is to update the changed data to the virtual disk image so that the changed data can be synchronized unidirectionally from the virtual disk image to the data lagging party through a preset transmission channel; the conflict merge strategy is to merge the changed data generated by the local server and the changed data generated by the remote server, and update them to the virtual disk image so that the merged changed data can be synchronized from the virtual disk image to the preset recipient through a preset transmission channel.

[0116] For the overwrite synchronization strategy, the changed data in the virtual disk image is directly transferred from the kernel buffer to the preset transmission channel, skipping the data copy link between user state and kernel state, thereby significantly improving transmission efficiency and accelerating data synchronization.

[0117] For conflict merge strategies, we leverage machine learning models to pre-analyze historical merge records and generate automated merge templates for common conflict scenarios (such as paragraph insertions in text files and code comment modifications). When bidirectional changes are detected, these templates are prioritized for automatic merging, significantly reducing manual intervention time and improving processing efficiency. For complex conflicts, we enable an interactive merge interface that pushes differences in real-time, supporting collaborative online conflict resolution by multiple people, ensuring accurate and efficient conflict resolution.

[0118] Both strategies utilize transactional batch execution, encapsulating changes to multiple files into a single transaction and enabling parallel data writes to virtual disk images. Furthermore, asynchronous I / O operations push data to pre-defined transmission channels, further optimizing performance and ensuring efficient and stable data synchronization.

[0119] According to an embodiment of the present invention, the data synchronization method also includes: if the modification status is bidirectional modification and a conflict is detected in the modification process, a conflict version file including the change difference is generated according to the file type of the target file; and the conflict version file is updated to the virtual disk image so that the object handles the conflict.

[0120] When a bidirectional modification conflict is detected in merge mode, the conflict resolution process is immediately initiated. Using a dual identification mechanism based on file extension and magic number, the target file type is determined. For text files, the local and remote versions of the target file are compared line by line, generating a visual diff file with the changes embedded and highlighted, creating a conflict version file. For binary files, the hash values ​​and modification times of both versions are recorded to generate a conflict version file.

[0121] The generated conflicting versions of the files will be stored in a tiered manner. A directory will be created within the virtual disk image, with the target file's path and hash value as the subdirectory name (for example, ` / conflicts / 8a3b1234`), storing conflicting versions of the files in different formats. Simultaneously, the metadata index will be updated, temporarily redirecting the original file's logical path to the conflicting directory, ensuring that conflict details are presented first when users access the file.

[0122] For bidirectional modification conflicts, a conflict version file containing the change differences is generated based on the target file's file type, allowing the target to visually resolve the conflict. The conflict version file generation strategy is determined by file type, ensuring conflict traceability and facilitating manual intervention, resulting in efficient conflict resolution.

[0123] According to an embodiment of the present invention, a conflict version file including change differences is generated based on the file type of the target file, including: if the file type is a text type, the modified paragraphs in the target file are merged to obtain a conflict version file; if the file type is a binary type, a conflict copy is generated to back up the modified version file of the local server and the modified version file of the remote server to obtain a conflict version file.

[0124] When handling bidirectional modification conflicts, we implement differentiated conflict version file generation strategies based on file type. For text files, we implement conflict merge logic. Specifically, we compare the local server version, the remote server version, and the last synchronized baseline version line by line, identifying undisputed sections and merging them directly.

[0125] For conflicting paragraphs, we use natural language processing technology to identify logical connections between paragraphs through semantic analysis. If this cannot be determined automatically, the conflicting areas are marked with special markers. After the merge is complete, a conflicting version file is generated in the virtual disk image directory, and a detailed merge log is added to the file header, documenting the modification source and merge strategy.

[0126] For binary files, a conflict replica generation mechanism is activated. Specifically, through multi-threaded parallel processing, modified versions of files on both the local and remote servers are copied to a designated directory. File names follow pre-set rules, with version numbers automatically incremented based on the number of conflicts within the same file. Each replica file is accompanied by a corresponding metadata file, recording information such as file size, modification time, hash value, and synchronization initiator, stored in a hidden directory.

[0127] This intelligent conflict handling mechanism based on file type uses paragraph-level merging for text files and generates dual-version backups for binary files, building a differentiated conflict version generation strategy and effectively improving the flexibility and accuracy of conflict handling.

[0128] According to an embodiment of the present invention, in response to a received conflict handling operation triggered by an object, for a text type, the data recipient selected in the conflict handling operation is determined, so that the conflict version file in the virtual disk image is transmitted to the data recipient through a preset transmission channel to complete the overwriting of the target file in the data recipient; for a binary type, the data recipient selected in the conflict handling operation is determined based on the version file selected in the conflict version file in the conflict handling operation; and the version file selected in the virtual disk image is transmitted to the data recipient through a preset transmission channel to complete the overwriting of the target file in the data recipient.

[0129] After receiving a user-triggered conflict handling operation, the system executes a differentiated overwrite synchronization process based on the file type. For text files, the system parses the selection parameters in the operation instruction to determine the data recipient (local or remote server). Using a real-time communication protocol, the system transfers the conflicting file versions in the directory within the virtual disk image to the recipient in blocks. Once the transfer is complete, the recipient's file system interface is automatically invoked to atomically overwrite the target file, while also recording the operation time, recipient, and version source.

[0130] For binary files, the corresponding version file is located in the directory based on the user's selection in the conflicting copy (e.g., selecting a version number through the graphical interface or specifying it on the command line). Zero-copy technology is used to push file data directly from the kernel buffer of the virtual disk image to the pre-set transmission channel, avoiding data loss between user and kernel state copies. Upon arrival at the data recipient, the version file is first written to a temporary directory for integrity verification. Once the verification passes, the target file is atomically overwritten, and the version status flag is updated.

[0131] By building a conflict handling response mechanism based on file types, text files are transferred to the merged conflict version files by determining the data recipient, and binary files are transferred in a targeted manner according to the selected version file, achieving accurate distribution and coverage of conflict handling results, ensuring the accuracy and efficiency of data synchronization.

[0132] Figure 7 A flowchart of merge mode synchronization of a data synchronization method according to an embodiment of the present invention is shown.

[0133] like Figure 7 As shown, in operation S710, the version file of the local server is obtained. In operation S720, the version file of the remote server is obtained. In operation S730, the version files are merged. In operation S740, a difference report is generated. In operation S750, it is determined whether the user confirms.

[0134] If it is determined that the user accepts the local server version, operation S751 is executed. In operation S751, the version file of the local server is retained and the version file of the remote server is discarded.

[0135] If it is determined that the user accepts the remote server version, operation S752 is performed. In operation S752, the version file of the local server is overwritten with the version file of the remote server.

[0136] If it is determined that the user needs to manually merge, operation S753 is performed. In operation S753, a visual editing tool is started.

[0137] Obtain the local server's version file and the remote server's version file and merge them. The difference analysis engine automatically generates a structured difference report, detailing the changes and conflicts in each version, providing data support for user decision-making.

[0138] During the user interaction phase, a multi-layered solution is provided. This includes a simple way to quickly select between the local or remote server version of a file. Furthermore, a manual merge option is provided, enabling fine-grained merges at the code or paragraph level through an integrated visual editing tool. The visual tool displays the differences between the three versions side by side, supporting line-by-line comparison and selective merging to ensure critical changes are not missed.

[0139] The entire merge process uses a non-destructive processing mechanism, and the original version file remains unchanged until the user confirms the final merge result. This not only meets the needs of fast merges in common scenarios, but also provides sufficient flexibility for handling complex conflicts, effectively balancing operational efficiency and merge accuracy.

[0140] According to an embodiment of the present invention, if it is detected that the occupancy rate of the storage space in the removable storage device is greater than a preset value, the storage space is expanded according to a preset ratio.

[0141] When the storage space usage of a removable storage device exceeds a preset threshold (e.g., 80%), the dynamic capacity expansion mechanism is automatically triggered. Initially, 1.5 times the size of the current sparse image will be pre-allocated as virtual disk space.

[0142] As write operations continue to increase and the pre-allocated space limit is approached, a gradual expansion strategy is implemented. Each expansion is performed by 25% of the currently used space, while maintaining a 1.5x reserve ratio. During the expansion process, the file system size is automatically adjusted to ensure that the expanded space is immediately available. To prevent the expansion from impacting normal read and write operations, new space is pre-allocated in a background asynchronous process, making the expansion transparent to upper-layer applications.

[0143] By real-time monitoring of the storage space occupancy rate of removable storage devices, when the occupancy rate exceeds the preset value, the capacity is automatically expanded according to the preset ratio, thereby achieving dynamic management of storage resources, ensuring efficient use of storage space and stable operation of the system.

[0144] Figure 8 A flow chart of an image mounting method according to an embodiment of the present invention is shown.

[0145] like Figure 8 As shown, this embodiment includes operation S810 and operation S820.

[0146] In operation S810 , a target file selected by an object is converted into a virtual disk image.

[0147] In operation S820, the virtual disk image is transmitted to the management controller through a preset transmission channel connected to the management controller, so that the virtual disk image is mounted to the serial bus control port of the remote server through the management controller, so that the virtual disk image can be identified as a removable storage device.

[0148] On the local server, a toolchain is used to encapsulate the user's selected target file (or directory) into a virtual disk image. The initial allocated space is 1.5 times the actual file size, using a sparse space allocation method and pre-allocated physical storage blocks. For directory structures, a differential hash index is automatically generated using an incremental synchronization algorithm, and only modified files are transferred, reducing data transmission.

[0149] After the virtual disk image is generated, it is pushed to the baseboard management controller (BMC) via a pre-defined transmission channel built on the Transport Layer Security protocol (which integrates an encrypted tunnel). During transmission, a streaming segmentation mechanism is used to split image files larger than 1GB into 16MB data blocks, each with a hash checksum. The receiving end verifies data integrity in real time using a sliding window protocol.

[0150] After receiving the virtual disk image, the management controller maps it to a device node via the Network Block Device (NBD) and then binds it to the virtual serial bus controller port. By modifying the serial bus device descriptor, the remote server enumerates it as a removable storage device.

[0151] This mechanism ensures data security and integrity through efficient encapsulation and transmission, while reducing unnecessary data transmission and improving synchronization efficiency.

[0152] Based on the above data synchronization method, the present invention also provides a data synchronization device. Figure 9 The device is described in detail.

[0153] Figure 9 A structural block diagram of a data synchronization device according to an embodiment of the present invention is shown.

[0154] like Figure 9 As shown, the data synchronization device 900 of this embodiment includes a mirror receiving module 910 , a mirror mounting module 920 , an information acquisition module 930 and a dynamic update module 940 .

[0155] Image receiving module 910 is configured to respond to a synchronization request initiated by a local server and receive, via a preset transmission channel, a virtual disk image generated by the local server through conversion of a target file. The synchronization request carries an edit mode identifier for the target file. In one embodiment, image receiving module 910 may be configured to perform operation S210 described above and will not be further described herein.

[0156] The image mounting module 920 is used to mount the virtual disk image to the serial bus control port of the remote server so that the virtual disk image can be identified as a removable storage device. In one embodiment, the image mounting module 920 can be used to perform the operation S220 described above, which will not be repeated here.

[0157] Information acquisition module 930 is configured to, if the edit mode flag indicates that the target file is in an editable state, obtain change information resulting from modifications to the target file by the local server and / or the remote server by monitoring file change events on the removable storage device in real time. In one embodiment, information acquisition module 930 may be configured to perform operation S230 described above, which will not be further described herein.

[0158] The dynamic update module 940 is used to dynamically update the virtual disk image based on the change information to complete the modification synchronization of the target file. In one embodiment, the dynamic update module 940 can be used to perform the operation S240 described above, which will not be repeated here.

[0159] Figure 10 A structural block diagram of an image mounting device according to an embodiment of the present invention is shown.

[0160] like Figure 10 As shown, the image mounting device 1000 of this embodiment includes a file conversion module 1010 and an image transmission module 1020 .

[0161] The file conversion module 1010 is configured to convert the target file selected by the object into a virtual disk image. In one embodiment, the file conversion module 1010 can be configured to execute the operation S810 described above, which will not be described in detail here.

[0162] Image transmission module 1020 is configured to transmit the virtual disk image to the management controller via a pre-defined transmission channel connected to the management controller, so that the management controller can mount the virtual disk image to a serial bus control port of a remote server, thereby enabling the virtual disk image to be recognized as a removable storage device. In one embodiment, image transmission module 1020 can be configured to perform operation S820 described above, which will not be further described here.

[0163] According to an embodiment of the present invention, any multiple modules among the image receiving module 910, image mounting module 920, information acquisition module 930, dynamic update module 940, file conversion module 1010, and image transmission module 1020 can be combined into a single module, or any one of these modules can be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules can be combined with at least part of the functionality of other modules and implemented in a single module. According to an embodiment of the present invention, at least one of the image receiving module 910, image mounting module 920, information acquisition module 930, dynamic update module 940, file conversion module 1010, and image transmission module 1020 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or any appropriate combination of any of these. Alternatively, at least one of the image receiving module 910, the image mounting module 920, the information acquisition module 930, the dynamic update module 940, the file conversion module 1010 and the image transmission module 1020 can be at least partially implemented as a computer program module, which can perform corresponding functions when run.

[0164] It should be noted that the data synchronization device and mirror mounting device parts in the embodiments of the present invention correspond to the data synchronization method and mirror mounting method parts in the embodiments of the present invention. The description of the data synchronization device and mirror mounting device parts specifically refers to the data synchronization method and mirror mounting method parts, which will not be repeated here.

[0165] Figure 11 A block diagram of an electronic device suitable for implementing a data synchronization method and a mirror mounting method according to an embodiment of the present invention is shown.

[0166] like Figure 11As shown, an electronic device 1100 according to an embodiment of the present invention includes a processor 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage unit 1108 into a random access memory (RAM) 1103. Processor 1101 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. Processor 1101 may also include onboard memory for caching purposes. Processor 1101 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0167] RAM 1103 stores various programs and data required for the operation of electronic device 1100. Processor 1101, ROM 1102, and RAM 1103 are interconnected via bus 1104. Processor 1101 executes the various operations of the method flow according to the embodiment of the present invention by executing the programs in ROM 1102 and / or RAM 1103. It should be noted that the programs may also be stored in one or more memories other than ROM 1102 and RAM 1103. Processor 1101 may also execute the various operations of the method flow according to the embodiment of the present invention by executing the programs stored in one or more memories.

[0168] According to an embodiment of the present invention, electronic device 1100 may further include an input / output (I / O) interface 1105, which is also connected to bus 1104. Electronic device 1100 may also include one or more of the following components connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 1108 including a hard disk; and a communication section 1109 including a network interface card such as a LAN card or modem. Communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 1110 as needed, so that computer programs read from the removable media can be installed into storage section 1108 as needed.

[0169] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.

[0170] According to an embodiment of the present invention, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present invention, a computer-readable storage medium may include ROM 1102 and / or RAM 1103 described above, and / or one or more memories other than ROM 1102 and RAM 1103.

[0171] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to enable the computer system to implement the data synchronization method and image mounting method provided in the embodiments of the present invention.

[0172] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when executed by the processor 1101. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0173] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 1109, and / or installed from removable media 1111. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0174] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1109 and / or installed from the removable medium 1111. When the computer program is executed by the processor 1101, the above-described functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.

[0175] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0176] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0177] It will be understood by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention may be combined and / or coupled in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or couplings fall within the scope of the present invention.

[0178] The above describes embodiments of the present invention. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present invention. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A data synchronization method, characterized in that: Applied to a management controller, the method includes: In response to a synchronization request initiated by a local server, receiving, through a preset transmission channel, a virtual disk image generated by the local server through conversion of a target file, wherein the synchronization request carries an edit mode identifier of the target file; Mounting the virtual disk image to a serial bus control port of a remote server so that the virtual disk image can be identified as a removable storage device; If the edit mode identifier indicates that the target file is in an editable state, acquiring change information resulting from modifications to the target file by the local server and / or the remote server by real-time monitoring of file change events on the removable storage device; Based on the change information, the virtual disk image is dynamically updated to complete modification synchronization of the target file.

2. The method according to claim 1, characterized in that The dynamically updating the virtual disk image based on the change information to complete modification synchronization of the target file includes: In response to a file synchronization mode selected by the object, analyzing the change information obtained through monitoring to obtain an analysis result, and determining a synchronization strategy based on the analysis result, wherein the file synchronization mode is one of an overwrite mode, a new mode, and a merge mode, and the change information includes a file path, a file size, and a modification time triggered by the file change event; According to the synchronization strategy, the virtual disk image is dynamically updated to complete the modification synchronization of the target file.

3. The method according to claim 2, characterized in that If the synchronization mode is the overlay mode, analyzing the change information obtained by monitoring to obtain an analysis result, and determining a synchronization strategy based on the analysis result, includes: Comparing the change information sent by the remote server with the file information of the target file in the local server to obtain a comparison result, wherein the comparison includes a file path comparison, a file size comparison, and a modification time comparison; Based on the comparison result, determining the change status of the target file; If the change status is the pending update status, the synchronization strategy is determined to update the change data generated by the remote server to the virtual disk image, so that the local server obtains the change data from the virtual disk image through the preset transmission channel to overwrite the local target file.

4. The method according to claim 3, characterized in that Determining the change status of the target file based on the comparison result includes: If the comparison result indicates that the file path and modification time are consistent but the file size is different, dynamically calculating the real-time checksum of the target file in the local server; If the comparison result indicates that there is a difference in file path or modification time, or there is a difference between the calculated real-time checksum and the expected checksum in the change information sent by the remote server, the change status of the target file is marked as a pending update status.

5. The method according to claim 3, characterized in that The method further comprises: Add files that exist in the local server but are marked as to be deleted in the change information of the remote server to a deletion queue, and move the files in the deletion queue to a temporary recycle bin; If it is determined that synchronization of the target file is completed, the file information in the local server is compared with the change information of the remote server; If a difference in information is detected, a rollback mechanism is triggered to restore the target file before synchronization from the temporary recycle bin to the local server; If it is detected that the information is consistent, the files in the temporary recycle bin are emptied.

6. The method according to claim 2, characterized in that If the synchronization mode is the new mode, analyzing the change information obtained through monitoring to obtain an analysis result, and determining a synchronization strategy based on the analysis result, including: Saving the monitored change information sent by the remote server and the change information sent by the local server as independent version files respectively; The logical path of the target file in the virtual disk image is pointed to the storage location of the selected version file; and the synchronization strategy is determined to obtain the corresponding version file from the virtual disk image based on the storage location to perform a file synchronization operation.

7. The method according to claim 3, characterized in that If the synchronization mode is the merge mode, analyzing the change information obtained through monitoring to obtain an analysis result, and determining a synchronization strategy based on the analysis result, includes: Constructing a comparison tree based on the monitored change information sent by the remote server and the change information sent by the local server, wherein each comparison node in the comparison tree corresponds to a file path in the change information, and node attributes of the comparison node include file size and modification time; Determining a modification status of the target file by traversing the comparison tree, wherein the modification status includes whether the local server and the remote server perform unidirectional modification or bidirectional modification on the target file; Based on the modification status, the synchronization strategy is determined to be an overwrite synchronization strategy corresponding to the unidirectional modification, or a conflict merge strategy corresponding to the bidirectional modification.

8. The method according to claim 7, characterized in that The overlay synchronization strategy is: updating the changed data to the virtual disk image so as to synchronize the changed data unidirectionally from the virtual disk image to the data lagging party through the preset transmission channel; The conflict merge strategy is: merge the change data generated by the local server and the change data generated by the remote server, and update them to the virtual disk image, so that the merged change data can be synchronized from the virtual disk image to the preset recipient through the preset transmission channel.

9. The method according to claim 8, characterized in that The method further comprises: If the modification status is the bidirectional modification and a conflict is detected in the modification process, generating a conflict version file including the change difference according to the file type of the target file; The conflicting version file is updated to the virtual disk image so that the object handles the conflict.

10. The method according to claim 9, characterized in that The step of generating a conflict version file including change differences based on the file type of the target file includes: If the file type is a text type, merging the modified paragraphs in the target file to obtain the conflicting version file; If the file type is a binary type, a conflict copy is generated to back up the modified version file of the local server and the modified version file of the remote server to obtain the conflict version file.

11. The method according to claim 10, characterized in that The method further comprises: In response to the received conflict handling operation triggered by the object, determining a data recipient selected in the conflict handling operation for the text type, so as to transmit the conflicting version file in the virtual disk image to the data recipient through the preset transmission channel, thereby completing the overwriting of the target file in the data recipient; For the binary type, the data recipient selected in the conflict handling operation is determined based on the version file selected in the conflict version file by the conflict handling operation, and the version file selected in the virtual disk image is transmitted to the data recipient through the preset transmission channel to complete the overwriting of the target file in the data recipient.

12. The method according to claim 1, characterized in that The method further comprises: If it is detected that the occupancy rate of the storage space in the removable storage device is greater than a preset value, the storage space is expanded according to a preset ratio.

13. A mirror mounting method, characterized in that: Applied to a local server, the method includes: Convert the selected target file into a virtual disk image; Sending a synchronization request to the management controller, wherein the synchronization request carries an edit mode identifier of the target file; The virtual disk image is transmitted to the management controller through a preset transmission channel connected to the management controller, so that the management controller can execute: mounting the virtual disk image to the serial bus control port of the remote server so that the virtual disk image can be identified as a removable storage device; if the editing mode identifier indicates that the target file is in an editable state, then by real-time monitoring of file change events on the removable storage device, the change information generated by the local server and / or the remote server in modifying the target file is obtained; based on the change information, the virtual disk image is dynamically updated to complete the modification synchronization of the target file.

14. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 13.

15. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.