Virtual machine MBR partition metadata protection method, system and device for Ceph RBD and medium

By leveraging Ceph RBD's object management mechanism, innovative backup and recovery of MBR partition metadata is achieved, mitigating the risk of data loss in Ceph RBD virtual machines and enabling non-intrusive, efficient data protection and rapid recovery.

CN119271456APending Publication Date: 2025-01-07SICHUAN ZHONGDIAN AOSTAR INFORMATION TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411283869.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing technologies cannot directly back up the MBR partition metadata of Ceph RBD virtual machines, resulting in a high risk of data loss, low recovery efficiency, and an inability to accurately recover data without affecting the actual data.

Method used

By leveraging Ceph RBD's object management mechanism, and by backing up and restoring specific portions of the MBR partition metadata object file, using MD5 value verification and temporary file processing, non-intrusive backup and rapid recovery can be achieved.

Benefits of technology

It achieves seamless and efficient backup, ensuring data integrity and business continuity, reducing operation and maintenance costs, and improving data protection efficiency and recovery flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271456A_ABST
    Figure CN119271456A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, in particular to a virtual machine MBR partition metadata protection method, system and device for Ceph RBD and a medium. According to the method, an object management mechanism of Ceph RBD is utilized, and only a specific part containing an MBR partition metadata object file is backed up, so that the problem that the MBR partition metadata of a ceph rbd disk cannot be directly backed up is solved; in the recovery process, only 4MB object files need to be processed, the recovery speed is high, the data integrity can be ensured, a user is allowed to select and recover partition metadata at different time points according to timestamps, and the flexibility and reliability of data recovery are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a method, system, device and medium for protecting MBR partition metadata of a virtual machine for Ceph RBD. Background Art

[0002] In cloud computing environments, virtual machines (VMs) are usually stored using distributed storage systems, such as Ceph. Ceph stores data in object blocks of 4M through the RADOS (Reliable Autonomic Distributed Object Store) layer. However, during the operation of a virtual machine, the system disk partition information of the virtual machine may be damaged or lost due to power failure, malicious attacks, or abnormal operations. Although the real data may still exist in the Ceph cluster, due to the lack of a backup and recovery mechanism for disk partition metadata, it is often difficult for system administrators to quickly restore the virtual machine to a normal working state.

[0003] In the field of cloud computing, with the rapid growth of data volume and the increase in business complexity, the performance, scalability and reliability of storage systems have become particularly important. In this context, Ceph, as an open source distributed storage system, has gradually become the preferred storage solution in cloud computing with its excellent performance and flexible scalability. The core advantages of Ceph lie in its distributed architecture and elastic expansion capabilities. By distributing data on multiple physical nodes, Ceph not only provides high availability and fault tolerance, but also achieves seamless expansion of storage capacity. This architecture enables Ceph to easily cope with dynamically changing storage needs in cloud computing environments.

[0004] Once the MBR metadata is lost or damaged, the system may not be able to recognize the partitions on the disk, making the data inaccessible. Although this situation does not occur frequently, once it occurs, it often causes serious losses to users because the partition table information in the MBR is crucial for recovering data.

[0005] Currently, when providing cloud storage services, many cloud vendors focus on the persistence and availability of the data itself, but pay relatively little attention to the protection of disk partition metadata (such as MBR). This is mainly because cloud vendors usually use virtualization technology to manage storage resources, and the disk images of virtual machines are usually stored in the storage system. Backup and recovery mechanisms are also provided to protect the virtual machines themselves. However, when only the metadata is damaged, the full data will be overwritten and restored, which is time-consuming, with low backup / restore efficiency, and usually cannot be accurately restored without affecting the real data.

[0006] 1. A common solution is to use the dd command to obtain the disk partition metadata of the running virtual machine for virtual machine disk devices in formats such as qcow2 (nas / nfs) and raw (SAN), but there is no solution for ceph types.

[0007] 2. For virtual machines using ceph rbd type, you can also map rbd to a local disk through map, and then read the partition metadata through the dd command. However, this mapping and backup solution requires turning off the default feature of rbd, which will affect the original snapshot and other functions, and will also affect the operation of the original virtual machine.

[0008] 3. For ceph rbd, you can also use rbd snapshots / backups to achieve similar results, but snapshots and backups can only restore data to the time of creation, and data after the creation time will be lost, which does not meet the requirements. In addition, the long-term existence of batch snapshots will affect the overall performance, occupy additional space, and increase a lot of additional management burden.

[0009] 4. For systems using GPT partitions, due to the principle of GPT partitions, the GPT header and GPT partition will be backed up in the last sector of the disk to achieve the backup effect. However, this solution is only applicable to systems in UEFI+GPT mode. If you want to switch the MBR partition to the GPT partition, professional tools are required and there is a risk of data loss. Such modifications are not allowed in the production environment.

[0010] Traditional disk metadata backup and recovery methods (such as dd) cannot be directly applied to Ceph RBD because its internal metadata cannot be directly accessed. When traditional backups deal with disk metadata corruption but real data is not lost, they usually restore the virtual machine as a whole to a certain point in time, which may cause data loss. Summary of the invention

[0011] In view of the problem that the existing backup and recovery methods cannot directly access the internal metadata and easily cause data loss, the present invention proposes a virtual machine MBR partition metadata protection method, system, device and medium for Ceph RBD; the object management mechanism of Ceph RBD is utilized to solve the problem that the MBR partition metadata of the ceph rbd disk cannot be directly backed up by backing up only the specific part of the MBR partition metadata object file; the recovery process only needs to process 4MB of object files, the recovery speed is fast, and data integrity can be ensured, allowing users to select to restore partition metadata at different time points according to timestamps, thereby improving the flexibility and reliability of data recovery.

[0012] The specific implementation contents of the present invention are as follows: A method for protecting the MBR partition metadata of a virtual machine for Ceph RBD specifically comprises the following steps: Step S1: Obtain the ID value of the RBD disk from the virtual machine, and locate the object file through the ID value; Step S2: intercept the object file in the temporary directory and calculate the MD5 value of the intercepted object file; Step S3: Calculate the MD5 value of the last backup file and compare it with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file for backup; Step S4: shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file; Step S5: Select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file; Step S6: restart the virtual machine. If the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

[0013] In order to better implement the present invention, further, the step S1 specifically includes the following steps: Step S11: call the rbd info command to query and obtain the ID value of the RDB disk in the Ceph distributed storage system; Step S12: According to the ID value of the RDB disk, the first created object file is obtained and exported to a temporary directory.

[0014] In order to better implement the present invention, further, the specific operation of step S2 is: calling the dd command according to the temporary directory to intercept the MBR metadata of the first 512B of the temporary file, and calculating the MD5 value of the intercepted object file; if the corresponding MBR metadata backup file does not exist in the temporary directory, directly use the intercepted file as the first successful backup, store it in the backup space and wait for the next backup.

[0015] In order to better implement the present invention, further, the step S3 specifically includes the following steps: Step S31: Calculate the MD5 value of the first 512B of the last backup file; Step S32: Compare the MD5 value of the last backup file with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file in the backup space, wait for the next polling, and record the polling time.

[0016] In order to better implement the present invention, further, the step S4 specifically includes the following steps: Step S41: shut down the virtual machine and locate and obtain the latest object file again according to the ID value; Step S42: intercept the non-metadata after 512B in the latest object file and store it in a temporary directory as a temporary file.

[0017] According to a method for protecting MBR partition metadata of a virtual machine for Ceph RBD according to claim 5, it is characterized in that the specific operation of step S5 is: first overwrite the partition metadata of the first 512B, and then append the non-metadata after 512B to the corresponding object file.

[0018] Based on the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD, in order to better implement the present invention, further, a virtual machine MBR partition metadata protection system for Ceph RBD is proposed, which is used to execute the above-mentioned virtual machine MBR partition metadata protection method for CephRBD; including a backup unit and a recovery unit; The backup unit is used to obtain the ID value of the RBD disk from the virtual machine, and locate the object file through the ID value; intercept the object file in the temporary directory, and calculate the MD5 value of the intercepted object file; calculate the MD5 value of the last backup file, and compare it with the MD5 value of the intercepted object file, if they are consistent, delete the obtained MBR metadata file and wait for the next polling, if they are inconsistent, store the obtained MBR metadata file for backup; The recovery unit is used to shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file; select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file; start the virtual machine, if the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

[0019] Based on the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD, in order to better realize the present invention, further, an electronic device is proposed, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD is implemented.

[0020] Based on the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD, in order to better realize the present invention, further, a computer-readable storage medium is proposed, on which computer instructions are stored; when the computer instructions are executed on the electronic device as described in claim 8, the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD is implemented.

[0021] The present invention has the following beneficial effects: (1) The present invention directly utilizes the object management mechanism of Ceph RBD to solve the problem that rbd cannot directly back up MBR partition metadata, and realizes non-intrusive backup of virtual machine disk partition metadata without interrupting business operations, greatly improving data protection efficiency and business continuity.

[0022] (2) The present invention achieves the minimum data operation in the backup process by accurately capturing and backing up the key changes of MBR partition metadata, avoiding the tediousness and inefficiency of large-scale data transmission in traditional backup methods. At the same time, in the recovery phase, through precise data overwriting and appending strategies, the complete recovery of partition metadata is ensured, effectively eliminating the risk of data loss, and ensuring business continuity and data security. This innovative design not only simplifies the operation and maintenance process, but also significantly improves the emergency response speed and data protection capabilities of the data center.

[0023] (3) The present invention is designed for large-scale Ceph environments. The backup and recovery processes are fully automated and imperceptible, which greatly reduces the operation and maintenance costs. It has wide applicability and can be applied to various Ceph-based virtual machine environments, providing strong support for data protection. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 The overall logical architecture diagram provided for the present invention.

[0025] Figure 2 This is a flow chart of the disk MBR metadata backup provided by the present invention.

[0026] Figure 3 This is a flow chart of disk MBR metadata recovery provided by the present invention. DETAILED DESCRIPTION

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.

[0028] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "disposed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0029] The professional terms and terminology involved in the embodiments of this application are explained as follows: Virtual machine: A virtual server built using server virtualization technology.

[0030] Disk MBR partition metadata: MBR partition refers to a hard disk partition method that uses the Master Boot Record (MBR) as a boot and partition management method. MBR is a special boot sector stored in the first sector (usually the 0th sector) of a computer hard disk, which contains information required to start the computer, such as the partition table and boot program. The size of MBR is 512 bytes, of which the first 446 bytes store the boot program, the next 64 bytes store the partition table, and the last 2 bytes are the end mark of MBR. MBR was originally designed for DOS systems, but now almost all operating systems use MBR as a boot method, including Windows, Linux, Unix, etc.

[0031] Ceph: Ceph is an open source distributed storage system designed to provide high-performance, high-reliability, and scalable storage solutions.

[0032] Ceph RBD: In Ceph, RBD stands for Rados Block Device, which is a block device based on distributed storage. It is an important component in the Ceph storage cluster and is used to provide block-level storage for applications such as virtual machines and containers.

[0033] RBD: In Ceph's storage solution, block device (RBD, RADOS Block Device) is an important component. RBD abstracts Ceph's storage capabilities into traditional block-level storage interfaces, allowing virtual machines in cloud computing environments to use Ceph's storage resources like local hard disks. In RBD, data is stored in the form of objects, and each object is usually 4MB in size. This design makes data more efficient in storage and transmission, and also improves the system's parallel processing capabilities. Regarding RBD's backup and recovery solutions, Ceph provides a complete set of mechanisms. First, RBD supports the snapshot function. Users can create a data snapshot for a virtual machine at any point in time to preserve the current storage status. When a virtual machine fails or needs to be restored to a specific state, users can quickly restore data through snapshots. Secondly, Ceph also provides a recycle bin (Trash) mechanism for storing data objects that have been deleted but not completely cleared. This means that within a certain period of time after deleting the data, users can still retrieve the deleted data, which increases the flexibility of data recovery. In addition, Ceph also supports a variety of backup and recovery tools and technologies, such as RBD's export and import functions, CephFS's file system backup, etc. These tools and technologies can provide users with flexible and diverse backup and recovery solutions based on different business needs and scenarios.

[0034] In Linux system, disk partition metadata is the key data for managing disk partition information. It records important information such as the partition layout and file system type of the disk. These metadata are crucial for the normal startup of the system and data access. Among them, the Master Boot Record (MBR) is an important part of disk partition metadata. MBR is located in the first sector of the disk (sector 0) and is 512 bytes in size. It contains the partition table information of the disk and a boot code for starting the operating system. The partition table is a table containing four partition entries, each of which occupies 16 bytes and is used to describe a partition on the disk, including partition type, starting sector location, partition size and other information. Although MBR can work stably in most cases, it is easily affected by factors such as attacks, power failures, and misoperations because it is located at the beginning of the disk, resulting in metadata loss or damage.

[0035] 1. Attack: Malware or hackers may try to modify or corrupt the MBR to prevent the system from booting properly or to execute malicious code.

[0036] 2. Power failure: During the system startup process, if a sudden power interruption such as power failure occurs, it may cause incomplete or damaged MBR data writing.

[0037] 3. Misoperation: Administrators or users may accidentally modify or delete the MBR when operating the disk, especially when using certain disk tools or partitioning software.

[0038] Embodiment 1: This embodiment proposes a method for protecting the MBR partition metadata of a virtual machine for Ceph RBD, which specifically includes the following steps: Step S1: Obtain the ID value of the RBD disk from the virtual machine, and locate and obtain the object file through the ID value.

[0039] Furthermore, the step S1 specifically includes the following steps: Step S11: call the rbd info command to query and obtain the ID value of the RDB disk in the Ceph distributed storage system; Step S12: According to the ID value of the RDB disk, the first created object file is obtained and exported to a temporary directory.

[0040] In order to better implement the present invention, further, the specific operation of step S2 is: calling the dd command according to the temporary directory to intercept the MBR metadata of the first 512B of the temporary file, and calculating the MD5 value of the intercepted object file; if the corresponding MBR metadata backup file does not exist in the temporary directory, directly use the intercepted file as the first successful backup, store it in the backup space and wait for the next backup.

[0041] Step S2: intercept the object file in the temporary directory and calculate the MD5 value of the intercepted object file.

[0042] Step S3: Calculate the MD5 value of the last backup file and compare it with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file for backup.

[0043] Furthermore, the step S3 specifically includes the following steps: Step S31: Calculate the MD5 value of the first 512B of the last backup file; Step S32: Compare the MD5 value of the last backup file with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file in the backup space, wait for the next polling, and record the polling time.

[0044] Step S4: shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file.

[0045] Furthermore, the step S4 specifically includes the following steps: Step S41: shut down the virtual machine and locate and obtain the latest object file again according to the ID value; Step S42: intercept the non-metadata after 512B in the latest object file and store it in a temporary directory as a temporary file.

[0046] Step S5: Select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file.

[0047] The specific operation of step S5 is: first overwrite the first 512B of partition metadata, and then append the non-metadata after 512B to the corresponding object file.

[0048] Step S6: restart the virtual machine. If the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

[0049] Working Principle: This embodiment focuses on the virtual machine disk environment based on Ceph RBD (RADOS Block Device), and proposes an innovative solution for the backup and recovery of MBR (Master Boot Record) partition metadata. As a distributed block storage solution, Ceph RBD has a special architecture in that its data management and access methods are significantly different from traditional storage systems (such as NAS, NFS and other network file systems, and SAN storage such as FC-SAN and iSCSI), which directly leads to the inability to directly apply traditional methods (such as using the dd command) to easily access or back up the partition metadata inside the virtual machine from the outside.

[0050] It is worth noting that although the GPT (GUID Partition Table) partition table is highly praised for its built-in partition metadata verification and backup mechanism, in the current cloud computing platform, especially when using Ceph RBD as the virtual machine storage backend, due to historical compatibility, ease of configuration or the needs of specific application scenarios, MBR partitions are still widely used, especially in scenarios where GPT features are not specifically required.

[0051] However, for virtual machine disks in Ceph RBD environments, existing solutions do not provide a direct and non-intrusive MBR partition metadata backup method. In addition, with the expansion of cloud computing, the requirements for backup efficiency and recovery flexibility are also increasing, but there is currently a lack of a mechanism that can efficiently and large-scale backup and recovery of MBR partition metadata.

[0052] The core technical problem of this embodiment focuses on providing an innovative Ceph RBD virtual machine disk MBR metadata backup and recovery solution. This solution not only realizes a non-intrusive and business-unaware efficient backup process, accurately captures and minimizes the partition metadata required for backup, but also builds a fast recovery mechanism for partition metadata damage (real data is not damaged). The key technical problems include the following: Limitations of Ceph RBD: Traditional backup and recovery methods cannot be directly applied to Ceph RBD because its internal MBR metadata cannot be directly accessed.

[0053] Non-intrusive backup / business-unaware: A backup method needs to be designed that does not interfere with the normal operation of the virtual machine during execution and does not require any modification or configuration of the virtual machine or Ceph environment.

[0054] Efficient and lightweight backup: By accurately identifying and extracting the virtual machine MBR partition metadata, the data volume is minimized, the backup efficiency is improved, and the storage space usage is reduced.

[0055] Fast and accurate recovery: When the system disk partition information is damaged or lost, a method is needed to quickly and accurately restore the MBR metadata to ensure that the virtual machine can quickly return to normal working state.

[0056] Regular inspection and traceability: Provide a mechanism to allow regular inspection of the integrity of the metadata inside the virtual machine and detect potential data corruption or loss through verification methods such as md5 values. At the same time, the method should support the traceability of historical metadata files so that it can roll back to the previous state when necessary.

[0057] In view of the complex architecture of Ceph RBD and its restrictions on direct access to the MBR partition metadata inside the virtual machine, the traditional backup method seems to be unable to cope with the present embodiment. This embodiment can not only accurately identify and efficiently extract the MBR partition metadata in the virtual machine disk, ensuring the efficiency and reliability of the backup process, but also has strong scalability and can easily cope with the backup needs of large-scale and batch virtual machines. The designed backup mechanism supports a fast recovery strategy, which can quickly restore the virtual machine to a normal working state even when the partition metadata is damaged but the real data remains intact, greatly shortening the recovery time window. In addition, the backup solution is also compatible with repeated recovery strategies to ensure that the integrity and recoverability of the backup data are not affected in multiple disaster recovery scenarios.

[0058] Embodiment 2: This embodiment is based on the above embodiment 1. Figure 1 , Figure 2 , Figure 3As shown, a specific embodiment is described in detail.

[0059] like Figure 1 As shown in the figure, the method of this embodiment directly addresses the difficulty of reading the MBR partition metadata of the Ceph RBD disk, cleverly utilizes the object management mechanism of Ceph RBD, and creates an original MBR partition metadata backup strategy. It not only realizes the deep protection of data, but also designs a convenient backup and instant recovery mechanism to ensure data integrity and business continuity, bringing innovative solutions to data management in the Ceph environment.

[0060] This embodiment innovatively designs a set of efficient RBD virtual machine disk MBR partition metadata backup solutions to achieve fully automated and imperceptible backup, without the need for intrusive agents, extremely short backup time, and minimized space usage. It is optimized for large-scale batch deployment, ensuring data security while improving operation and maintenance efficiency to the extreme, meeting the efficient operation and maintenance needs of modern data centers. The specific backup process is as follows: Figure 2 shown.

[0061] Step S1: Get the ID value of the RBD disk, and locate the object file through the ID.

[0062] Use the command "rbd info rbd name" to query and obtain the id value of rbd in Ceph. The id value is the unique identifier of the RBD image, and you can use this value to query the object file in the distributed system.

[0063] In the ceph distributed storage system, all data is stored in object files of 4MB by default, and the disk MBR partition metadata information of the operating system is the first to be written into the storage (similar to sector 0). Therefore, to obtain the disk MBR partition metadata of ceph rbd, you can directly read the object file created first (numbered "0000000000000000"), and use the ceph related command "rados -p<pool_name> get rbd.data. <id>.0000000000000000" to export the object file into a temporary directory.

[0064] Step S2: intercept the files in the temporary directory.

[0065] The data exported in the above steps is in the form of a file. At this time, you can easily intercept the first 512B of the temporary file through the dd command, and you can easily calculate the MD5 value. The 512B calculation speed is also very fast. (If the virtual machine does not have a corresponding MBR metadata backup file, directly use the intercepted file as the first successful backup, store it in the backup space and wait for the next backup) Step S3: Calculate the MD5 value of the last backup file, perform MD5 value comparison and subsequent processing.

[0066] The metadata file of the last backup is also stored in the form of a file, and the MD5 value of the 512B backup file can be quickly calculated.

[0067] Compare the MD5 values. If the MD5 values ​​are the same, it means that the MBR metadata has not changed during this cycle. The metadata backed up this time can be discarded and wait until the next polling (the default interval is 1 day).

[0068] If the MD5 values ​​are different, it means that the partition metadata has changed during this period, and the changed metadata files need to be recorded in the backup space, and then wait for the next polling (the default interval is 1 day). Multiple polling may generate multiple backup files (changes are not necessarily abnormal, it may be that the user is expanding the disk and other operations), record the time, so that when an abnormality occurs, the user can select a time period to restore the metadata.

[0069] like Figure 3 As shown, the data volume involved in the recovery process of this embodiment is only 4MB, the recovery speed is fast, no real data will be lost, and it can be recovered repeatedly. The specific recovery process is as follows: Step S4: shut down the virtual machine, locate and obtain the object file again through the ID, obtain the latest data file, and obtain the real data except the partition metadata.

[0070] Usually, the partition metadata is attacked, damaged or lost, and the operating system cannot start. However, at this time, the virtual machine needs to be shut down to avoid the risk of double writing to rbd.

[0071] When you need to refer to the backup again, get the first object file created in rbd (numbered "0000000000000000") to obtain the latest data except the MBR partition metadata to avoid data loss caused by recovery.

[0072] At this time, the first 512B of the object file obtained above is damaged, and the latter (4096KB-512B) data stores the latest real data of the current virtual machine and needs to be retained. At this time, the command "dd if=<obtained 4MB object file>of=<intercepted file path>bs=512 skip=1" is used to intercept the data after 512B, and then store it in the temporary directory.

[0073] Step S5: Select the correct backup file for restoration.

[0074] Since writing data to the rbd object file will overwrite the entire object file, restoring the MBR partition metadata requires two steps: first overwrite the 512B partition metadata, then append the latest real data (4096KB-512B) to maintain the integrity of the 4MB file data. The reference commands for the specific steps are as follows: First select the MBR backup file 512B of the normal time period: "rados -p<pool_name> put rbd.data. <id>.0000000000000000<backup metadata file name>"; Then append the latest real data: "rados -p<pool_name> append rbd.data. <id>.0000000000000000<(4096KB-512B) of real-time data>".

[0075] Step S6: Start the virtual machine check.

[0076] If you can start the virtual machine and enter the system normally, it proves that the recovery is successful. You can delete the temporary files generated during the recovery process. If you cannot enter the system normally, you can choose the partition metadata files backed up at other times for repeated recovery.

[0077] Working principle: This embodiment utilizes the object management mechanism of Ceph RBD, especially the order and characteristics of object files, and innovatively proposes to back up only the specific part of the object file containing the MBR partition metadata, thereby solving the problem that the cephrbd disk MBR partition metadata cannot be directly backed up.

[0078] The backup and recovery mechanism is designed with a fully automated backup process that does not require manual intervention and does not affect the normal operation of the system, achieving non-perceptual backup. The backup process is implemented through Ceph commands and standard Linux tools (such as dd and MD5 calculations), which is easy to deploy and maintain. The recovery process only needs to process 4MB of object files, with a fast recovery speed and ensuring data integrity. It allows users to choose to restore partition metadata at different time points based on timestamps, improving the flexibility and reliability of data recovery.

[0079] This patent provides an efficient and reliable data protection solution for virtual machine disk partition metadata in Ceph environment with innovative backup and recovery strategies.

[0080] This embodiment realizes efficient and non-intrusive data protection. By directly utilizing the object management mechanism of Ceph RBD, it solves the problem that rbd cannot directly back up MBR partition metadata, and realizes non-intrusive backup of virtual machine disk partition metadata without interrupting business operations, greatly improving data protection efficiency and business continuity.

[0081] This embodiment has an accurate and efficient Ceph RBD partition metadata backup and recovery mechanism. In response to the severe challenges of partition metadata damage and loss in the Ceph RBD environment, an unprecedented convenient, fast and efficient backup and recovery mechanism is proposed. This mechanism achieves minimized data operations in the backup process by accurately capturing and backing up key changes in MBR partition metadata, avoiding the tediousness and inefficiency of large amounts of data transmission involved in traditional backup methods. At the same time, during the recovery phase, accurate data overwriting and appending strategies are used to ensure the complete recovery of partition metadata, effectively eliminating the risk of data loss, and ensuring business continuity and data security. This innovative design not only simplifies the operation and maintenance process, but also significantly improves the emergency response speed and data protection capabilities of the data center.

[0082] This embodiment has wide applicability. Since Ceph RBD is the main solution for virtual machine disks, it is designed for large-scale Ceph environments. The backup and recovery process is fully automated and imperceptible, which greatly reduces the operation and maintenance costs and has wide applicability. It can be applied to various Ceph-based virtual machine environments to provide strong support for data protection.

[0083] The other parts of this embodiment are the same as those of the above-mentioned embodiment 1, and thus will not be described in detail.

[0084] Embodiment 3: Based on any one of the above-mentioned embodiments 1-2, this embodiment proposes a virtual machine MBR partition metadata protection system for Ceph RBD, which is used to execute the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD; it includes a backup unit and a recovery unit; The backup unit is used to obtain the ID value of the RBD disk from the virtual machine, and locate the object file through the ID value; intercept the object file in the temporary directory, and calculate the MD5 value of the intercepted object file; calculate the MD5 value of the last backup file, and compare it with the MD5 value of the intercepted object file, if they are consistent, delete the obtained MBR metadata file and wait for the next polling, if they are inconsistent, store the obtained MBR metadata file for backup; The recovery unit is used to shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file; select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file; start the virtual machine, if the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

[0085] This embodiment also proposes an electronic device, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD is implemented.

[0086] This embodiment also proposes a computer-readable storage medium, on which computer instructions are stored; when the computer instructions are executed on the above-mentioned electronic device, the above-mentioned virtual machine MBR partition metadata protection method for Ceph RBD is implemented.

[0087] The other parts of this embodiment are the same as any one of the above-mentioned embodiments 1-2, so they will not be repeated here.

[0088] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.< / id> < / id> < / id>

Claims

1. A method for protecting the MBR partition metadata of a virtual machine for Ceph RBD, characterized in that: The specific steps include: Step S1: Obtain the ID value of the RBD disk from the virtual machine, and locate the object file through the ID value; Step S2: intercept the object file in the temporary directory and calculate the MD5 value of the intercepted object file; Step S3: Calculate the MD5 value of the last backup file and compare it with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file for backup; Step S4: shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file; Step S5: Select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file; Step S6: restart the virtual machine. If the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

2. A method for protecting virtual machine MBR partition metadata for Ceph RBD according to claim 1, characterized in that: The step S1 specifically includes the following steps: Step S11: call the rbd info command to query and obtain the ID value of the RDB disk in the Ceph distributed storage system; Step S12: According to the ID value of the RDB disk, the first created object file is obtained and exported to a temporary directory.

3. A method for protecting virtual machine MBR partition metadata for Ceph RBD according to claim 2, characterized in that: The specific operation of step S2 is: calling the dd command according to the temporary directory to intercept the MBR metadata of the first 512B of the temporary file, and calculating the MD5 value of the intercepted object file; if the corresponding MBR metadata backup file does not exist in the temporary directory, directly use the intercepted file as the first successful backup, store it in the backup space and wait for the next backup.

4. A method for protecting virtual machine MBR partition metadata for Ceph RBD according to claim 3, characterized in that: The step S3 specifically comprises the following steps: Step S31: Calculate the MD5 value of the first 512B of the last backup file; Step S32: Compare the MD5 value of the last backup file with the MD5 value of the intercepted object file. If they are consistent, delete the obtained MBR metadata file and wait for the next polling. If they are inconsistent, store the obtained MBR metadata file in the backup space, wait for the next polling, and record the polling time.

5. A method for protecting virtual machine MBR partition metadata for Ceph RBD according to claim 4, characterized in that: The step S4 specifically comprises the following steps: Step S41: shut down the virtual machine and locate and obtain the latest object file again according to the ID value; Step S42: intercept the non-metadata after 512B in the latest object file and store it in a temporary directory as a temporary file.

6. A method for protecting virtual machine MBR partition metadata for Ceph RBD according to claim 5, characterized in that: The specific operation of step S5 is: first overwrite the first 512B of the partition metadata, and then append the non-metadata after 512B to the corresponding object file.

7. A virtual machine MBR partition metadata protection system for Ceph RBD, used to execute the virtual machine MBR partition metadata protection method for Ceph RBD as claimed in claim 1; characterized in that: Including backup unit and recovery unit; The backup unit is used to obtain the ID value of the RBD disk from the virtual machine, and locate the object file through the ID value; intercept the object file in the temporary directory, and calculate the MD5 value of the intercepted object file; calculate the MD5 value of the last backup file, and compare it with the MD5 value of the intercepted object file, if they are consistent, delete the obtained MBR metadata file and wait for the next polling, if they are inconsistent, store the obtained MBR metadata file for backup; The recovery unit is used to shut down the virtual machine, obtain the latest object file according to the ID value, intercept the non-metadata content in the object file and store it as a temporary file; select the correct partition metadata to overwrite the RDB object file, and append the latest intercepted temporary file to the corresponding object file; Start the virtual machine. If the virtual machine fails to start, return to step S5; if the virtual machine starts successfully, delete the temporary file and complete the MBR metadata recovery.

8. An electronic device, characterized in that: It comprises a memory and a processor; a computer program is stored in the memory; when the computer program is executed on the processor, the virtual machine MBR partition metadata protection method for CephRBD as described in any one of claims 1-6 is implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device as described in claim 8, the virtual machine MBR partition metadata protection method for Ceph RBD as described in any one of claims 1-6 is implemented.