SSD internal log storage method and system and storage medium
By deploying the encryption, compression and decryption operations of SSD firmware internal logs on the upper computer, standardizing the log format and using digital IDs instead of strings, the problems of large space in the SSD system logs and information leakage are solved, and the effects of reducing resource occupation and information security are achieved.
Patent Information
- Application Number
- CN202411811335.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-15
AI Technical Summary
Existing SSD system logs are at risk of large space and information leakage, and encryption and compression operations occupy CPU and hardware resources.
The encryption, compression and decryption operations of SSD firmware internal logs are deployed on the host computer, standardize the log format, and use a digital ID to replace the string to generate the host computer log parsing method and string mapping table to realize the standardized storage and parsing of logs.
It reduces the use of CPU and hardware resources in the log generation and storage stages, reduces the code space occupied by system strings, and avoids the leakage of plaintext logs.
Smart Images

Figure CN119828962A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of solid state drives, and in particular to a method, system and storage medium for storing logs in an SSD. Background Art
[0002] The internal log of the SSD mainly records important events and information when the system is running. Its functions are as follows: Performance evaluation: By analyzing the read and write performance data in the log, you can evaluate the read and write speed and IOPS (input / output operations per second) of the SSD, thereby optimizing system performance. Fault diagnosis: The error information and status reports in the log help to quickly locate and resolve hardware failures, reducing system downtime. Life prediction: By analyzing the number of times the NAND block is erased and written, the remaining life of the SSD can be predicted, allowing maintenance or replacement to be performed in advance.
[0003] Existing SSD system logs are divided into plain text and encrypted, depending on whether they are encrypted or compressed. Plain text system logs take up a lot of space and are prone to leaking important system information. Encryption and compression require CPU or system hardware resources to be used to encrypt and compress logs when logs are generated. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method, system and storage medium for storing logs in an SSD.
[0005] The objective of the present invention is achieved through the following technical solutions: The first aspect of the present invention provides: a method for storing logs inside an SSD, comprising the following steps: S1: Deploy the encryption, compression and decryption operations of the internal logs of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; S2: Firmware writing stage, according to the defined standard format, generate log output code, use string ID to replace the string and update the string mapping table; S3: When the SSD firmware is running, the generated standardized log is written to the Flash or serial port; S4: The host computer obtains real-time logs through the serial port, or obtains the stored standardized logs from the Flash through the standard interface; S5: The host computer parses the string to be printed and the real-time running parameters according to the string mapping table and the standard log format, and outputs the log plain text according to the required target format.
[0006] Preferably, the S1 further comprises the following steps: defining the static string portion of the standard output log string as a fixed structure.
[0007] Preferably, the solid structure includes: a module character string, an event character string, an information character string and an input format character string.
[0008] A second aspect of the present invention provides: an SSD internal log storage system, used to implement any of the above-mentioned SSD internal log storage methods, comprising: The standardization module is used to deploy the encryption compression and decryption operations of the internal log of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; The firmware writing module is used to generate log output code according to the defined standard format, use string ID to replace the string and update the string mapping table; The writing module is used to write the generated standardized logs to the Flash or serial port when the SSD firmware is running; The parsing module is used to obtain real-time logs through the serial port, or to obtain the stored standardized logs from the Flash through the standard interface; the host computer parses the strings to be printed and the real-time running parameters according to the string mapping table and the log standard format, and outputs the log plain text according to the required target format.
[0009] A third aspect of the present invention provides: a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned SSD internal log storage methods is implemented.
[0010] The beneficial effects of the present invention are: 1) Deploy log encryption, compression, and decryption operations on the PC host computer, reducing the CPU or hardware resource usage during the log generation and storage stage.
[0011] 2) Use digital IDs instead of strings. During the compilation phase, the code space occupied by system strings will be greatly reduced.
[0012] 3) The host computer can only parse the correct log plaintext after obtaining the log format and SSD firmware string mapping table, which can avoid the output of plaintext logs on the serial port or in the flash, thereby avoiding the leakage of disk information. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a flow chart of the internal log storage method of SSD; Figure 2This is a schematic diagram of a general log format; Figure 3 This is a diagram of the log string output to standard output in S1; Figure 4 This is a schematic diagram of the logs obtained by the host computer in S4. DETAILED DESCRIPTION
[0014] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0015] See also Figure 1-4 The first aspect of the present invention provides: a method for storing internal logs in an SSD, comprising the following steps: S1: Deploy the encryption, compression and decryption operations of the internal logs of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; S2: Firmware writing stage, according to the defined standard format, generate log output code, use string ID to replace the string and update the string mapping table; S3: When the SSD firmware is running, the generated standardized log is written to the Flash or serial port; S4: The host computer obtains real-time logs through the serial port, or obtains the stored standardized logs from the Flash through the standard interface; S5: The host computer parses the string to be printed and the real-time running parameters according to the string mapping table and the standard log format, and outputs the log plain text according to the required target format.
[0016] In this embodiment, S1: standardize and modularize the logs. Figure 2 As shown in the figure, the format of a general log can be divided into two parts: one is the constant part, i.e. the static string part, which is used to represent the meaning of log information, events, modules, formats, etc.; the other is the variable part, i.e. the real-time running status data of the system. For the constant part, the format is defined as a fixed structure of module, event, information, and input format, such as Figure 3As shown. S2: In the firmware writing stage, enumerate all modules, events, information, input formats to be output, and maintain the number-string mapping table. Use digital IDs instead of strings, for example, output print("NFCTimeout Ch Ce %d_%d", ch, ce), and convert it into Generate_Event(M_NFC_ID, E_TIMEOUT_ID, I_CH, I_CE, F_2D, ch, ce). S3: When the SSD firmware is running, the log is output to the serial port or Flash. The existing plain text output to the serial port or Flash is characters, while the method of the present invention outputs pure numbers in the format of Figure 4 As shown, for example, print("NFC Timeout Ch Ce %d_%d", ch, ce); the plain text currently input to the serial port is NFC TimeoutCh Ce 10_6. The method proposed in the present invention outputs a pure digital stream, 0xff 0x10 0x0300 0x40000x40010x40 0x0a 0x06. S4: The host computer reads the log from the Flash through the serial port or SSD interface command. S5: The host computer obtains the following Figure 4 The format log shown in the figure parses the log string, format and real-time parameters to be output according to the firmware character map table, and outputs the plain text.
[0017] In some embodiments, the S1 further includes the following steps: defining a static string portion of a standard output log string as a fixed structure.
[0018] In some embodiments, the solid structure includes: a module string, an event string, an information string, and an input format string.
[0019] A second aspect of the present invention provides: an SSD internal log storage system, used to implement any of the above-mentioned SSD internal log storage methods, comprising: The standardization module is used to deploy the encryption compression and decryption operations of the internal log of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; The firmware writing module is used to generate log output code according to the defined standard format, use string ID to replace the string and update the string mapping table; The writing module is used to write the generated standardized logs to the Flash or serial port when the SSD firmware is running; The parsing module is used to obtain real-time logs through the serial port, or to obtain the stored standardized logs from the Flash through the standard interface; the host computer parses the strings to be printed and the real-time running parameters according to the string mapping table and the log standard format, and outputs the log plain text according to the required target format.
[0020] A third aspect of the present invention provides: a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, any of the above-mentioned SSD internal log storage methods is implemented.
[0021] The above is only a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not deviate from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A method for storing logs in an SSD, characterized in that: The following steps are involved: S1: Deploy the encryption, compression and decryption operations of the internal logs of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; S2: Firmware writing stage, according to the defined standard format, generate log output code, use string ID to replace the string and update the string mapping table; S3: When the SSD firmware is running, the generated standardized log is written to the Flash or serial port; S4: The host computer obtains real-time logs through the serial port, or obtains the stored standardized logs from the Flash through the standard interface; S5: The host computer parses the string to be printed and the real-time running parameters according to the string mapping table and the standard log format, and outputs the log plain text according to the required target format.
2. The SSD internal log storage method according to claim 1, characterized in that: The S1 further comprises the following steps: defining the static string part of the standard output log string as a fixed structure.
3. The SSD internal log storage method according to claim 2, characterized in that: The solid structure includes: a module character string, an event character string, an information character string and an input format character string.
4. An SSD internal log storage system, characterized in that: The method for implementing the internal log storage method of the SSD according to any one of claims 1 to 3 comprises: The standardization module is used to deploy the encryption compression and decryption operations of the internal log of the SSD firmware on the host computer, standardize the internal log format of the SSD firmware, define the standard output log string and the corresponding digital ID, and generate the host computer log parsing method and string mapping table; The firmware writing module is used to generate log output code according to the defined standard format, use string ID to replace the string and update the string mapping table; The writing module is used to write the generated standardized logs to the Flash or serial port when the SSD firmware is running; The parsing module is used to obtain real-time logs through the serial port, or to obtain the stored standardized logs from the Flash through the standard interface; the host computer parses the strings to be printed and the real-time running parameters according to the string mapping table and the log standard format, and outputs the log plain text according to the required target format.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by the processor, the SSD internal log storage method according to any one of claims 1 to 3 is implemented.
Citation Information
Cited By
Visual analysis method for SSD log, medium and equipment
CN122019314A
A method, medium and device for visual analysis of SSD logs
CN122019314B
Method, system and device for optimizing SSD log record and medium
CN122019330A