Memory data storage method and device, computer equipment and storage medium

By generating a universally unique identifier for the root partition of the system disk block device, obtaining command line parameters for matching, determining the target system disk, and storing memory data, the problem of not being able to accurately save the system disk in a multi-system environment is solved, and the accurate saving and rewriting of memory data is achieved.

CN116414292BActive Publication Date: 2026-11-06ZHEJIANG UNIVIEW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111660218.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2026-11-06
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In a multi-system environment, existing technologies cannot accurately determine the system disk at the time of a system crash, resulting in the inaccurate preservation of memory data.

Method used

By generating a universally unique identifier for the root partition of the block device of each system disk, obtaining the command line parameters when the system crashes, parsing the universally unique identifier to be matched, and matching it with the universally unique identifier of the root partition of the block device of each system disk, the target block device of the target system disk is determined, and the memory data is stored in the preset root partition directory.

Benefits of technology

It enables accurate saving and rewriting of memory data in the event of system failure in a multi-system disk environment, avoiding data loss or inconsistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116414292B_ABST
    Figure CN116414292B_ABST
Patent Text Reader

Abstract

The application discloses a memory data storage method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring command line parameters when a system crashes, and acquiring a to-be-matched universally unique identifier according to the command line parameters; matching the to-be-matched universally unique identifier with root partition universally unique identifiers of block devices of each system disk to determine a target block device of a target system disk; mounting a root partition of the target block device to a preset root partition directory, and storing memory data into a directory file under the preset root partition directory. The technical scheme of the application can realize accurate storage of memory data when a system is abnormal in a multi-system disk environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to data processing technology, and more particularly to a method, apparatus, computer device, and storage medium for storing memory data. Background Technology

[0002] Kdump is a kernel crash dumping mechanism based on kexec. When a running system crashes, deadlocks, or freezes, kdump uses kexec to switch the current kernel to the capture kernel, captures memory data, and stores the memory data in the kdump memory system.

[0003] In multi-system environments, after accessing the kdump memory system, it's crucial to accurately match the system disk at the time of the system crash and locate the corresponding block device. The root and log partitions of this block device are then mounted to a specified directory within the kdump memory system. However, because block device names are affected by the PCIE (Peripheral Component Interconnect Express) scan order or the system disk's reporting time, the system disk at the time of the crash cannot be determined solely by its block device name. Existing technologies also add corresponding labels to different partitions of the system disk. When the system abnormally enters the kdump memory system, the block device is determined based on the labels of the root and log partitions. However, in multi-system environments, there might be two system disks with the same partition labels, again making it impossible to accurately determine the system disk at the time of the crash. Summary of the Invention

[0004] This invention provides a method, apparatus, computer device, and storage medium for storing memory data, so as to accurately save memory data in the event of system failure in a multi-system disk environment.

[0005] In a first aspect, embodiments of the present invention provide a method for storing memory data, the method comprising:

[0006] Obtain the command-line parameters at the time of system crash, and obtain the universally unique identifier to be matched based on the command-line parameters;

[0007] The target block device of the target system disk is determined by matching the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk.

[0008] Mount the root partition of the target block device to the preset root partition directory and store the memory data in the directory file under the preset root partition directory.

[0009] Secondly, embodiments of the present invention also provide a memory data storage device, the device comprising:

[0010] The module for obtaining the universally unique identifier to be matched is used to obtain the command line parameters when the system crashes, and obtain the universally unique identifier to be matched based on the command line parameters;

[0011] The target block device determination module is used to match the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk.

[0012] The memory data storage module is used to mount the root partition of the target block device to a preset root partition directory and store the memory data in a directory file under the preset root partition directory.

[0013] Thirdly, embodiments of the present invention also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a memory data storage method as described in any of the embodiments of the present invention.

[0014] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for storing memory data as described in any of the embodiments of the present invention.

[0015] This invention generates a universally unique identifier for the root partition of the block device on each system disk. When the system crashes, command-line parameters are obtained, parsed to obtain the universally unique identifier to be matched, and matched with the universally unique identifier of the root partition of the block device on each system disk to determine the target block device of the target system disk. The root partition of the target block device is mounted to a preset root partition directory, and the memory data is stored in a directory file under the preset root partition directory. This solves the problem in the prior art that it is impossible to accurately determine the system disk when the system crashes in a multi-system environment, and achieves accurate preservation of memory data in the event of system anomalies in a multi-system disk environment. Attached Figure Description

[0016] Figure 1 This is a flowchart of a memory data storage method according to Embodiment 1 of the present invention;

[0017] Figure 2 This is a flowchart of a memory data storage method according to Embodiment 2 of the present invention;

[0018] Figure 3 This is a schematic diagram of the structure of a memory data storage device according to Embodiment 3 of the present invention;

[0019] Figure 4 This is a schematic diagram of the structure of a computer device according to Embodiment 4 of the present invention. Detailed Implementation

[0020] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0021] Example 1

[0022] Figure 1 This is a flowchart of a memory data storage method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where, in a multi-system disk environment, the system disk that has crashed is accurately identified and the memory data is accurately stored. This method can be executed by a memory data storage device, which can be implemented by software and / or hardware and is generally integrated into a computer device.

[0023] like Figure 1 As shown, the technical solution of this embodiment of the invention specifically includes the following steps:

[0024] S110. Obtain the command line parameters when the system crashes, and obtain the universally unique identifier to be matched based on the command line parameters.

[0025] The system disk is used for scheduling, monitoring and maintaining the computer system. The command line parameters are also known as cmdline parameters. The universally unique identifier to be matched is also known as the UUID (Universally Unique Identifier). The UUID is an identifier generated by a unique machine within a certain range. The UUID is unique. Therefore, the identity of the crashed system can be determined by matching the UUID to be matched with the UUIDs of the pre-stored system disks.

[0026] When a system crashes, the kdump service starts. When the kdump service loads the kernel using the kexec command, it loads the cmdline parameters. These cmdline parameters consist of the cmdline parameters of the system before the crash, along with additional parameters from the kdump service. The cmdline parameters of the system before the crash are passed from the system configuration file during system startup via the bootloader. The bootloader is a program that can pass parameters to the kernel. The system configuration file of the crashed system includes a UUID; therefore, by parsing the cmdline parameters, the UUID to be matched for the crashed system can be obtained.

[0027] S120. Match the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk.

[0028] A block device is a random access device with a specific structure, and multiple block devices can exist on the system disk. The root partition, also known as the root node, is the root node of the system. System-related directories and files are mounted under the root node. The universally unique identifier of the root partition is the UUID generated for it. This embodiment does not restrict the method of generating the UUID.

[0029] Optionally, a block device can be specified among the various block devices corresponding to the system disk, and its root partition can be set with a UUID. This embodiment does not restrict the way the block device is specified among the various block devices.

[0030] The UUID to be matched is compared with the root partition UUID of the block device of each system to determine the target block device corresponding to the target system disk of the crashed target system.

[0031] S130. Mount the root partition of the target block device to the preset root partition directory and store the memory data in the directory file under the preset root partition directory.

[0032] Once the target block device corresponding to the crashed target system is identified, the root partition of the target block device of the crashed target system can be mounted to the preset root partition directory. Mounting associates the root partition of the target block device of the crashed target system with the root partition directory, through which the root partition directory can be used to determine the root partition of the target block device of the target system disk.

[0033] The preset root partition directory is a pre-defined directory used to mount the target block device's root partition. This embodiment does not restrict the method for determining the preset root partition directory. Directory files are created under the preset root partition directory to store memory data. This memory data is the data saved when the system crashes, used for troubleshooting system crashes by relevant personnel.

[0034] In this embodiment of the invention, the UUID to be matched is obtained by parsing the cmdline parameters. This UUID is then compared with the root partition UUID of the block device on each system disk to determine the target block device of the crashed system. The root partition of the target block device is mounted to a preset root partition directory, and the memory data at the time of the crash is written to a directory file under that preset root partition directory. In a multi-system disk environment, when the system abnormally enters the kdump memory system, the block device of the crashed system can be accurately determined, and the memory data of the abnormal system can be written to the directory file under the root partition directory of the target block device, ensuring the correctness of memory data storage.

[0035] The technical solution of this embodiment generates a universally unique identifier for the root partition of the block device of each system disk. When the system crashes, command-line parameters are obtained, parsed to obtain the universally unique identifier to be matched, and matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device corresponding to the target system disk of the crashed system. The root partition of the target block device is mounted to a preset root partition directory, and the memory data is stored in a directory file under the preset root partition directory. This solves the problem in the prior art that it is impossible to accurately determine the system disk when the system crashes in a multi-system environment, and realizes accurate preservation of memory data when the system is abnormal in a multi-system disk environment.

[0036] Example 2

[0037] Figure 2 This is a flowchart of a memory data storage method provided in Embodiment 2 of the present invention. Based on the above embodiments, the present invention further specifies the memory data storage process and adds the steps of generating universally unique identification codes for each partition of the block device of each system disk, the step of rewriting memory data when the system crashes and restarts, and the steps of storing and rewriting log data.

[0038] Correspondingly, such as Figure 2 As shown, the technical solution of this embodiment of the invention specifically includes the following steps:

[0039] S210. Partition the block devices of each system disk.

[0040] Specifically, during a system upgrade in a multi-system disk environment, the corresponding block devices of the system disk can be identified, and the block devices can be specified for system upgrade. After partitioning the specified block devices on the system disk using the mkfs tool, each partition of the block device can be formatted, and a UUID can be generated for each partition.

[0041] In addition to the root partition, block device partitions can also include log partitions, boot partitions, tmp partitions, etc. The log partition, also known as the journal partition, is used to record system logs. The boot partition contains the system kernel and files used during system startup, and the tmp partition is used to store temporary files. This embodiment does not limit the partitioning method of block devices on each system disk, nor the number and type of partitions on each system disk's block devices.

[0042] S220: Generate a universally unique identifier for each partition of the block device on each system disk.

[0043] For each partition of the block device on each system disk, a UUID is generated. Due to the uniqueness of UUID, the UUID of each partition is different and remains unchanged.

[0044] S230. For each system disk, the boot parameters in the system configuration file are assigned the universally unique identifier of the root partition.

[0045] The system configuration file, grub.cfg, contains the root parameter, which is the boot parameter. After determining the root partition UUID of each system disk's block device, the root partition UUID is written into the grub.cfg file of each system disk. During system startup, the root parameter in the grub.cfg file is passed to the system's cmdline parameters by the bootloader. When the kdump kernel system loads, it adds the system's cmdline parameters as kdump system boot parameters. Upon entering the kdump kernel, it generates the corresponding cmdline parameters for the kdump system. Therefore, by generating the UUID of the root partition of each system disk's block device and writing it into the grub.cfg file, the root partition UUID of the crashed system's block device can be obtained based on the cmdline parameters in the event of a system crash.

[0046] S240: Determine if the system crash conditions are met. If yes, execute S250; otherwise, return to execute S240.

[0047] The system crash conditions are met, meaning the current system crashes, freezes, or deadlocks, and the kdump service starts.

[0048] S250: Generate command-line parameters based on the startup parameters in the system configuration file.

[0049] The root parameter in the grub.cfg file is passed from the bootloader to the system cmdline. When the system crashes and loads the kdump system, the system cmdline parameter is loaded into the kdump kernel system, generating the kdump cmdline parameter.

[0050] S260. Obtain the command line parameters when the system crashes, and obtain the universally unique identifier to be matched based on the command line parameters.

[0051] In this embodiment of the invention, when the system crashes, the kdump service starts, and the cmdline parameters can be loaded via the kexec command. Parsing the cmdline parameters yields the UUID to be matched.

[0052] S270. Match the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk.

[0053] In this embodiment of the invention, since each system disk generates a UUID for each partition of the specified block device during the system upgrade process, the target block device of the crashed target system can be determined by matching the UUID to be matched with the root partition UUID of the block device of each system disk.

[0054] S280. Mount the root partition of the target block device to the preset root partition directory.

[0055] The above embodiments have described how to mount the root partition of the target block device to the preset root partition directory, and this embodiment will not repeat the description here.

[0056] S290. Obtain memory data based on the pre-stored address information.

[0057] In this embodiment of the invention, grub, i.e., the boot manager, can reserve address information, and the address corresponding to the address information is used to store the memory data that needs to be saved.

[0058] Correspondingly, S290 may include:

[0059] S291. Obtain the address information of the memory data based on the pre-stored address information.

[0060] Access the pre-stored address space using the pre-stored address information, and retrieve the address information of the memory data at the pre-stored address space.

[0061] S292. Obtain memory data based on the address information of the memory data.

[0062] The ioremap tool can be used to convert memory data address information into virtual addresses for the kdump memory system. The ioremap tool is used to convert I / O addresses into virtual addresses for the kdump memory system.

[0063] After converting the address information of the memory data into the virtual address of the kdump memory system, the memory data can be obtained by reading the information at the virtual address of the kdump memory system.

[0064] S2100: Determine whether the flag file under the preset root partition directory meets the memory data storage conditions. If yes, execute S2110; otherwise, execute S2160.

[0065] The flag file is used to record the write status of memory data. By checking whether the flag file meets the memory data storage conditions, it can be determined whether the memory data has been stored, thus avoiding duplicate storage of memory data.

[0066] For example, the flag file can be set to 0 to indicate that the memory data has not yet been stored. After the memory data storage is completed, the flag file can be modified to 1. Then, the flag file meets the memory data storage condition and the flag file content is 0.

[0067] S2110. Store the memory data in a directory file under the preset root partition directory.

[0068] The memory data is written to a directory file under the preset root partition directory. After the writing is completed, the contents of the flag file under the preset root partition directory are modified. The modified flag file no longer meets the memory data storage conditions, which can avoid the duplicate storage of memory data.

[0069] S2120. Mount the log partition of the target block device to the preset log partition directory and store the log data in the directory file under the preset log partition directory.

[0070] In this embodiment of the invention, after determining the target block device of the target system disk, the log partition of the target block device is also mounted to the preset log partition directory to realize the storage and rewriting of log data.

[0071] The log partition directory and the root partition directory can be the same or different; this embodiment does not impose any restrictions on this. Optionally, the log partition directory can be specified in the log management configuration file, i.e., the rsyslog.conf file. Similarly, when the log partition directory and the root partition directory are the same, the directory file storing memory data and the directory file storing log data can also be the same or different; this embodiment does not impose any restrictions on this.

[0072] Specifically, you can execute the command " / usr / sbin / rsyslogd&" to store log data in a directory file under the preset log partition directory.

[0073] S2130. Determine whether the flag file under the root partition directory meets the conditions for memory data rewriting. If yes, execute S2140; otherwise, execute S2160.

[0074] When the crashed system recovers and restarts, it checks the conditions for rewriting memory data in the flag file under the root partition directory.

[0075] If the flag file content is 0, it means that the memory data has not been stored yet. If the flag file content is 1, it means that the memory data has been stored. After the memory data storage is completed, the flag file content is modified to 1. The flag file satisfies the memory data rewriting condition when the flag file content is 1.

[0076] S2140. Write the memory data in the directory file under the preset root partition directory into the system memory corresponding to the target block device.

[0077] When the crashed system disk is restored and restarted, if the flag file meets the conditions for memory data rewriting, the memory data in the directory file under the preset root partition directory will be rewritten to the system memory corresponding to the target block device.

[0078] After the rewriting is complete, the contents of the flag file in the preset root partition directory are modified. For example, if the contents of the flag file are set to 0, it means that the memory data has not been stored yet, and the contents of the flag file are set to 1, it means that the memory data has been stored. After the memory data storage is completed, the contents of the flag file are modified to 1, and after the memory data rewriting is completed, the contents of the flag file are modified to 0.

[0079] In this embodiment of the invention, the storage and rewriting of memory data and log data during system crashes are performed using UUIDs, ensuring data accuracy and avoiding data loss or inconsistency during system crashes.

[0080] S2150, End.

[0081] The technical solution of this embodiment generates a universally unique identifier for the root partition of the block device of each system disk. When the system crashes, command-line parameters are obtained, parsed to obtain the universally unique identifier to be matched, and matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk. The root partition of the target block device is mounted to a preset root partition directory, and the log partition of the target block device is mounted to a preset log partition directory. When the flag file under the preset root partition directory meets the memory data storage conditions, the memory data is stored in a directory file under the preset root partition directory, and the log data is stored in a directory file under the preset log partition directory. When the flag file meets the memory data rewrite conditions, the memory data is rewritten to the system memory corresponding to the target block device. This solves the problem in the prior art that it is impossible to accurately determine the system disk when the system crashes in a multi-system environment, and realizes accurate storage and rewriting of memory data when the system is abnormal in a multi-system disk environment.

[0082] Example 3

[0083] Figure 3 This is a schematic diagram of a memory data storage device according to Embodiment 3 of the present invention. The device includes: a module 310 for obtaining a universally unique identifier to be matched, a target block device determination module 320, and a memory data storage module 330. Wherein:

[0084] The module 310 for obtaining the universally unique identifier to be matched is used to obtain the command line parameters when the system crashes, and obtain the universally unique identifier to be matched based on the command line parameters.

[0085] The target block device determination module 320 is used to match the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk.

[0086] The memory data storage module 330 is used to mount the root partition of the target block device to a preset root partition directory and store the memory data in a directory file under the preset root partition directory.

[0087] The technical solution of this embodiment generates a universally unique identifier for the root partition of the block device of each system disk. When the system crashes, command-line parameters are obtained, parsed to obtain the universally unique identifier to be matched, and matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk. The root partition of the target block device is mounted to a preset root partition directory, and the memory data is stored in a directory file under the preset root partition directory. This solves the problem in the prior art that it is impossible to accurately determine the system disk when the system crashes in a multi-system environment, and realizes accurate preservation of memory data when the system is abnormal in a multi-system disk environment.

[0088] Based on the above embodiments, the device further includes:

[0089] The block device partitioning module is used to partition the block devices of each system disk;

[0090] The Universal Unique Identifier Generation Module is used to generate a universal unique identifier for each partition of the block device of each system disk.

[0091] The boot parameter assignment module is used to assign the boot parameters in the system configuration file to the root partition's universally unique identifier for each system disk.

[0092] Based on the above embodiments, the device further includes:

[0093] The command-line argument generation module is used to generate command-line arguments based on the startup parameters in the system configuration file if the system crash conditions are determined to be met.

[0094] Based on the above embodiments, the memory data storage module 330 includes:

[0095] The root partition mount unit is used to mount the root partition of the target block device to a preset root partition directory;

[0096] The memory data acquisition unit is used to acquire memory data based on pre-stored address information;

[0097] The memory data storage unit is used to store memory data in a directory file under the preset root partition directory if the flag file under the preset root partition directory meets the memory data storage conditions.

[0098] Based on the above embodiments, the memory data acquisition unit is specifically used for:

[0099] Based on the pre-stored address information, it will be converted into address information to obtain the system memory data from the system disk crash dump.

[0100] Obtain memory data based on the address information of the system memory data dumped after the system disk crashes.

[0101] Based on the above embodiments, the device further includes:

[0102] The memory data rewrite module is used to write the memory data in the directory file under the preset root partition directory into the system memory of the target block device if the flag file under the preset root partition directory meets the memory data rewrite conditions.

[0103] Based on the above embodiments, the device further includes:

[0104] The log data storage module is used to mount the log partition of the target block device to the preset log partition directory and store the log data in the directory file under the preset log partition directory;

[0105] The memory data storage device provided in the embodiments of the present invention can execute the memory data storage method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0106] Example 4

[0107] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention, as shown below. Figure 4 As shown, the computer device includes a processor 70, a memory 71, an input device 72, and an output device 73; the number of processors 70 in the computer device can be one or more. Figure 4 Taking a processor 70 as an example; the processor 70, memory 71, input device 72, and output device 73 in a computer device can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.

[0108] The memory 71, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the modules corresponding to the memory data storage method in this embodiment of the invention (e.g., the module 310 for obtaining the universally unique identifier to be matched, the target block device determination module 320, and the memory data storage module 330 in the memory data storage device). The processor 70 executes various functional applications and data processing of the computer device by running the software programs, instructions, and modules stored in the memory 71, thereby implementing the aforementioned memory data storage method. This method includes:

[0109] Obtain the command-line parameters at the time of system crash, and obtain the universally unique identifier to be matched based on the command-line parameters;

[0110] The target block device of the target system disk is determined by matching the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk.

[0111] Mount the root partition of the target block device to the preset root partition directory and store the memory data in the directory file under the preset root partition directory.

[0112] The memory 71 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 71 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, the memory 71 may further include memory remotely located relative to the processor 70, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0113] Input device 72 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the computer device. Output device 73 may include display devices such as a display screen.

[0114] Example 5

[0115] Embodiment 5 of the present invention also provides a storage medium containing computer-executable instructions, wherein the computer-executable instructions, when executed by a computer processor, are used to perform a method for storing memory data, the method comprising:

[0116] Obtain the command-line parameters at the time of system crash, and obtain the universally unique identifier to be matched based on the command-line parameters;

[0117] The target block device of the target system disk is determined by matching the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk.

[0118] Mount the root partition of the target block device to the preset root partition directory and store the memory data in the directory file under the preset root partition directory.

[0119] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the method operations described above, but can also perform related operations in the memory data storage method provided in any embodiment of the present invention.

[0120] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0121] It is worth noting that in the embodiments of the memory data storage device described above, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy distinction between each other and are not used to limit the scope of protection of the present invention.

[0122] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for storing memory data, characterized in that, include: Partition the block devices on each system disk; Generate a universally unique identifier for each partition of the block device on each system disk; For each system disk, the boot parameters in the system configuration file are assigned the universal and unique identifier of the root partition; If the system crash conditions are determined to be met, then command-line arguments are generated based on the startup parameters in the system configuration file. Obtain the command-line parameters at the time of system crash, and obtain the universally unique identifier to be matched based on the command-line parameters; The target block device of the target system disk is determined by matching the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk. Mount the root partition of the target block device to the preset root partition directory and store the memory data in the directory file under the preset root partition directory.

2. The method according to claim 1, characterized in that, Mount the root partition of the target block device to the preset root partition directory, and store the memory data in the directory files under the preset root partition directory, including: Mount the root partition of the target block device to the preset root partition directory; Retrieve memory data based on pre-stored address information; If the flag file in the preset root partition directory meets the memory data storage conditions, then the memory data will be stored in the directory file in the preset root partition directory.

3. The method according to claim 2, characterized in that, Based on the pre-stored address information, retrieve the memory data, including: Based on the pre-stored address information, obtain the address information of the memory data; Retrieve memory data based on its address information.

4. The method according to claim 2, characterized in that, After storing the memory data in a directory file under the preset root partition directory, the following is also included: If the flag file under the preset root partition directory meets the memory data rewrite conditions, then the memory data in the directory file under the preset root partition directory will be written into the system memory corresponding to the target block device.

5. The method according to claim 4, characterized in that, After storing the memory data in a directory file under the preset root partition directory, the following is also included: Mount the target block device's log partition to the preset log partition directory and store the log data in a directory file under the preset log partition directory.

6. A storage device for memory data, characterized in that, include: The block device partitioning module is used to partition the block devices of each system disk; The Universal Unique Identifier Generation Module is used to generate a universal unique identifier for each partition of the block device of each system disk. The boot parameter assignment module is used to assign the boot parameters in the system configuration file to the root partition's universally unique identifier for each system disk. The command-line argument generation module is used to generate command-line arguments based on the startup parameters in the system configuration file if the system crash conditions are determined to be met. The module for obtaining the universally unique identifier to be matched is used to obtain the command line parameters when the system crashes, and obtain the universally unique identifier to be matched based on the command line parameters; The target block device determination module is used to match the universally unique identifier to be matched with the universally unique identifier of the root partition of the block device of each system disk to determine the target block device of the target system disk. The memory data storage module is used to mount the root partition of the target block device to a preset root partition directory and store the memory data in a directory file under the preset root partition directory.

7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the memory data storage method as described in any one of claims 1-5.

8. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the memory data storage method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • A method of recovering a kvm virtual machine from a failed distributed storage

    CN109710377A

  • Method and system for storing memory data when system is abnormal

    CN110309008A