Method, system and terminal for collecting multi-firmware version hard disk log and storage medium
By integrating a quicksort algorithm and tool library, rapid log collection for NVMe SSDs with different firmware versions is achieved, solving the problems of chaotic tool selection and low efficiency in existing technologies, and improving the accuracy and efficiency of log collection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-02-16
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies require different tools and commands for log collection when dealing with different firmware versions of NVMe SSDs. This leads to tool confusion, inefficiency, and time and effort consumption, reducing the accuracy of log collection.
A quick sorting algorithm is used to classify hard drive firmware versions, and a tool library is built to integrate multiple log collection tools. The appropriate log collection tool is automatically called by a script to achieve fast log collection for hard drives with different firmware versions.
It improves the efficiency of log collection, avoids confusion in tool selection, saves manpower, and improves the accuracy and efficiency of data collection.
Smart Images

Figure CN116010215B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of server technology, specifically relating to a method, system, terminal, and storage medium for collecting hard disk logs of multiple firmware versions. Background Technology
[0002] During the research, development, production, use, and maintenance of NVMe SSDs, it may be necessary to collect relevant information about the drive to confirm its status or the cause of failure. This information is generally obtained by collecting relevant drive log records. The drive logs we need typically include error logs, SMART logs, and vendor logs. The error log records all errors that occur during drive operation to ensure no error loss. This log maintains important information about the number of errors, the queue from which the errors originated, and which data and namespaces were affected. This is crucial for identifying problematic drives and the root causes of potential errors in the system. The SMART log reports general health information about the drive. When its key health indicators fail to meet standards, it generates warning messages to alert the drive to a problem. The NVMe drive then notifies the host of the type of problem. The SMART log also summarizes information about media or data integrity errors and lists the number of unsafe shutdowns caused by power outages. Finally, the SMART page is very useful for monitoring endurance. By checking the SMART Percentage Used field, the remaining drive life can be viewed as an easily readable percentage of the total used / usable life. Vendorlog logs are used to record physical information about SSDs, such as operating temperature, voltage, wear and tear, and the number of bad blocks.
[0003] Currently, the general method for collecting logs related to NVMe SSDs is to use a log collection tool that matches the firmware version of the drive and execute specific collection commands to obtain the required information. However, when dealing with different drive types and firmware versions, different tools need to be used for collection, which can easily lead to confusion between the tools used and the commands executed, resulting in unsuccessful command execution when obtaining logs and reducing accuracy. Furthermore, this approach is time-consuming, labor-intensive, and inefficient. Summary of the Invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present invention provides a method, system, terminal and storage medium for collecting hard disk logs of multiple firmware versions to solve the above-mentioned technical problems.
[0005] In a first aspect, the present invention provides a method for collecting hard disk logs across multiple firmware versions, comprising:
[0006] Collect basic information about all hard drives on the server, including hard drive identification information and hard drive firmware version;
[0007] The basic information is sorted and classified based on the hard drive firmware version using the quicksort algorithm;
[0008] Based on the category of the target hard drive, the corresponding log collection tool is invoked from the preset tool library to obtain the logs of the target hard drive.
[0009] Furthermore, the method also includes:
[0010] Remotely log in to the server using the Secure Shell protocol and interactive tools;
[0011] The execution script is stored in a specified path on the server. The execution script is used to perform the steps of collecting basic hard disk information, classifying hard disks, and calling log collection tools.
[0012] The server builds a tool library containing various log collection tools, each applicable to different firmware versions of the hard drive.
[0013] Furthermore, basic information about all hard drives on the server is collected, including hard drive identification information and hard drive firmware version, including:
[0014] The nvme list command identifies the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server.
[0015] Furthermore, the quicksort algorithm is used to sort and classify basic information based on the hard drive firmware version, including:
[0016] The quicksort algorithm is used to sort the hard drives based on their firmware version number information, and hard drives with the same firmware version number are grouped into the same category;
[0017] Label each hard drive category and establish a mapping relationship between each category of hard drive and the applicable log collection tools.
[0018] Furthermore, based on the category of the target hard drive, the corresponding log collection tool is invoked from the preset tool library to obtain the logs of the target hard drive, including:
[0019] Select the target hard drive from all hard drives on the server, and call the log collection tool that has a mapping relationship with the target hard drive from the tool library according to the category of the target hard drive;
[0020] The collected logs from the target hard drive are named according to the target log's serial number, log type, and collection time, and the named logs are saved to the specified path.
[0021] Secondly, the present invention provides a system for collecting hard disk logs across multiple firmware versions, comprising:
[0022] An information collection unit is used to collect basic information about all hard drives on the server, including hard drive identification information and hard drive firmware version.
[0023] The hard drive classification unit is used to sort and classify basic information based on the hard drive firmware version using a quicksort algorithm;
[0024] The log acquisition unit is used to call the corresponding log collection tool from the preset tool library according to the category of the target hard drive, so as to obtain the logs of the target hard drive.
[0025] Furthermore, the system also performs:
[0026] Remotely log in to the server using the Secure Shell protocol and interactive tools;
[0027] The execution script is stored in a specified path on the server. The execution script is used to perform the steps of collecting basic hard disk information, classifying hard disks, and calling log collection tools.
[0028] The server builds a tool library containing various log collection tools, each applicable to different firmware versions of the hard drive.
[0029] Furthermore, the information collection unit includes:
[0030] The information collection module is used to identify the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server using the nvme list command.
[0031] Furthermore, the hard disk classification unit includes:
[0032] The version sorting module is used to sort hard drives based on their firmware version number information using a quick sorting algorithm, and to group hard drives with the same firmware version number into the same category.
[0033] The category tagging module is used to tag the category of each hard drive and establish a mapping relationship between each category of hard drive and the applicable log collection tools.
[0034] Furthermore, based on the category of the target hard drive, the corresponding log collection tool is invoked from the preset tool library to obtain the logs of the target hard drive, including:
[0035] Select the target hard drive from all hard drives on the server, and call the log collection tool that has a mapping relationship with the target hard drive from the tool library according to the category of the target hard drive;
[0036] The collected logs from the target hard drive are named according to the target log's serial number, log type, and collection time, and the named logs are saved to the specified path.
[0037] Thirdly, a terminal is provided, including:
[0038] Processor, memory, among which,
[0039] This memory is used to store computer programs.
[0040] The processor is used to retrieve and run the computer program from memory, causing the terminal to perform the terminal method described above.
[0041] Fourthly, a computer storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the methods described in the above aspects.
[0042] The beneficial effects of this invention are as follows:
[0043] The present invention provides a method, system, terminal, and storage medium for collecting hard disk logs of different firmware versions. By integrating log collection tools of different versions and utilizing a quick sorting algorithm and scripts, it achieves rapid sorting and classification of different firmware versions and rapid invocation of log collection tools, thereby greatly improving efficiency. At the same time, it avoids the confusion caused by manually selecting different tools when collecting logs from hard disks of different firmware versions, saves manpower, and improves the accuracy of data collection.
[0044] Furthermore, the design principle of this invention is reliable, the structure is simple, and it has a very wide range of application prospects. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0047] Figure 2 This is a schematic block diagram of a system according to an embodiment of the present invention.
[0048] Figure 3 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. Detailed Implementation
[0049] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0050] The key terms used in this invention will be explained below.
[0051] Solid State Drive (SSD): Also known as a solid-state drive, it is a hard drive made of solid-state electronic storage chip arrays. Common SSD controllers on the market include LS IDiskForce, IndiLinx, JMicron, Marvell, Phison, Sandics, Goldindisk, Samsung, and Intel. The controller chip is the brain of the SSD; its functions are twofold: firstly, to rationally allocate the data load across the various flash memory chips; and secondly, to handle the entire data transfer, connecting the flash memory chips to the external SATA interface. Different controllers vary greatly in capability, data processing power, algorithms, and read / write control of the flash memory chips, directly resulting in performance differences of up to several times between SSD products.
[0052] NVMe: NVM Express (NVMe), or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS), is a logical device interface specification. NVM stands for Non-Volatile Memory, a common form of flash memory in solid-state drives (SSDs). This specification primarily provides a low-latency, internally concurrent native interface for flash-based storage devices, and also provides native storage concurrency support for modern CPUs, computer platforms, and related applications, allowing host hardware and software to fully utilize the parallel storage capabilities of solid-state storage devices. Compared to AHC I in the era of mechanical hard disk drives (HDDs), NVMe / NVMe HCI reduces I / O operation latency, increases the number of operations performed simultaneously, and provides larger capacity operation queues. Based on the PCIe bus, NVMe devices can be used in various physical slots that support the PCIe bus, including standard-size PCIe expansion cards (usually with 4 PCIe lanes), 2.5-inch / 3.5-inch standard-size solid-state drives using the U.2 physical connection interface (SFF-8639), SATA Express bus (compatible with PCIe), M.2 form factor expansion cards, etc.
[0053] Firmware refers to the device drivers stored internally within the device. The firmware algorithm controls the read / write and transfer algorithms of the solid-state drive (SSD), rationally allocating data to the flash memory. Firmware acts as the coordinator between the various components within the hard drive, controlling its normal startup and operation, and is an indispensable and crucial part of the hard drive. Simply put, firmware is the "software within the hardware," and it performs the most basic and lowest-level work of a hard drive system. If you compare a hard drive to a computer host, firmware is equivalent to the BIOS and operating system programs within that host. It consists of boot commands, control statements, and execution statements written in assembly language. Within the hard drive, firmware is responsible for driving, controlling, decoding, transmitting, and detecting data, such as managing data storage locations, recording damaged sectors, and recording the hard drive's operating temperature or errors. Therefore, firmware is the soul of the hard drive; it determines the functionality and performance of the hardware device. Without firmware, a hard drive is just a collection of mechanical and electronic components, like a soulless corpse.
[0054] Firmware version: A code consisting of letters and numbers that represents a certain type of firmware.
[0055] SN code: also known as product serial number, is a unique identification number for a product.
[0056] Bubble sort is a relatively simple sorting algorithm in the field of computer science.
[0057] Currently, the general method for collecting logs related to NVMe SSDs is to use a log collection tool that matches the firmware version of the drive and execute specific collection commands to obtain the required information. However, when dealing with different drive types and firmware versions, different tools need to be used for collection, which can easily lead to confusion between the tools used and the commands executed, resulting in unsuccessful command execution when obtaining logs and reducing accuracy. Furthermore, this approach is time-consuming, labor-intensive, and inefficient.
[0058] Based on this, the present invention proposes a method for collecting hard disk logs of multiple firmware versions.
[0059] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention. Wherein, Figure 1 The executing entity can be a multi-firmware version hard disk log collection system.
[0060] like Figure 1 As shown, the method includes:
[0061] Step 110: Collect basic information of all hard drives on the server, including hard drive identification information and hard drive firmware version;
[0062] Step 120: Use the quicksort algorithm to sort and classify the basic information based on the hard drive firmware version;
[0063] Step 130: Based on the category of the target hard drive, call the corresponding log collection tool from the preset tool library to obtain the logs of the target hard drive.
[0064] To facilitate understanding of the present invention, the following description further illustrates the method for collecting hard disk logs of multiple firmware versions provided by the present invention, based on the principle of the method and the process of collecting hard disk logs of multiple firmware versions in the embodiments.
[0065] First, the target server is identified, which has NVMe SSDs with different firmware versions installed. To avoid the confusion and inefficiency caused by using various collection tools and commands, a script is provided for quickly collecting disk-related logs, including error logs, smart logs, and vendor logs. The specific steps are as follows: A unified tool library is established for different collection tools. The script is then executed to identify the SSD drive letter, serial number (SN), and firmware version information on the server. During script execution, a quicksort algorithm (an improvement on the traditional bubble sort algorithm, whose basic idea is to divide the data to be sorted into two independent parts through a single sort, where all data in one part is smaller than all data in the other part, and then quickly sort these two parts separately using the same method; the entire sorting process can be recursively performed to achieve an ordered sequence) is used to quickly classify the firmware version type. Then, the corresponding log collection tool can be quickly invoked to execute the corresponding command to collect logs. The acquired log information is saved to a pre-set data path and named "SN + Log Type + Date". Alternatively, the script can be used with appropriate parameters to obtain log information for a single specified disk and a specified log type.
[0066] The specific execution steps of this implementation method are as follows:
[0067] Prepare NVMe SSDs with different firmware versions: Connect SSDs with different firmware versions to the same server. Remote connection and transfer: Access the server containing the SSDs using the Secure Shell protocol (SSH) or an SSH client with the correct IP address. After logging in, store the scripts in an appropriate path. Establish a tool library: Organize and integrate log collection tools for different versions of NVMe SSDs for easy script usage.
[0068] Specifically, the methods for collecting hard disk logs across multiple firmware versions using script execution include:
[0069] S1. Collect basic information about all hard drives on the server, including hard drive identification information and hard drive firmware version.
[0070] The nvme list command identifies the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server.
[0071] Specifically, the script identifies and records the NVMe SSD information on the current server: using the nvme list command, it identifies the drive letter, serial number, and firmware version number of the current NVMe SSD and records the information.
[0072] S2. Use the quicksort algorithm to sort and classify basic information based on hard drive firmware version.
[0073] The quicksort algorithm is used to sort the hard drives based on their firmware version number information, and hard drives with the same firmware version number are grouped into the same category; the category of each hard drive is marked, and a mapping relationship between each category of hard drive and the applicable log collection tool is established.
[0074] Specifically, based on the recorded hard drive information, the firmware version numbers are quickly sorted and categorized using a quick sorting algorithm.
[0075] After classification, hard drives with the same firmware version number are classified as the same type, and a mapping relationship is established between firmware version number categories and the corresponding log collection tools in the tool library.
[0076] S3. Based on the category of the target hard drive, call the corresponding log collection tool from the preset tool library to obtain the logs of the target hard drive.
[0077] Select the target hard drive from all hard drives on the server, and call the log collection tool that is mapped to the target hard drive from the tool library according to the category of the target hard drive; name the collected logs of the target hard drive with the target log's SN code, log type and collection time, and save the named logs to the specified path.
[0078] Specifically, for each categorized firmware version, the script calls the corresponding log collection tool to collect logs, naming the logs with "SN code + log type + date," and finally packages the result files and saves them in a pre-defined path within the script. Because the files have already been categorized and sorted, fast traversal of all disks is possible.
[0079] For single-disk log collection or single-type log collection:
[0080] (1) First, identify the drive letter. Use the nvme list command to identify / dev / nvme*, and record the drive letter and the corresponding firmware version.
[0081] (2) Execute the script, add the parameter after the script: the corresponding drive letter or log type, and the script can determine the firmware version of the drive, call the corresponding collection tool, and collect the logs of the drive.
[0082] (3) You can obtain the logs of all hard drives by traversing all hard drives on the server.
[0083] The multi-version NVMe solid-state drive log collection method provided by the above implementation integrates different version log collection tools and utilizes a quick sorting algorithm and scripts to achieve quick sorting and classification of different firmware versions and quick invocation of log collection tools, thereby greatly improving efficiency. At the same time, it avoids the confusion caused by manually selecting different tools when collecting logs from hard drives with different firmware versions, saving manpower and improving the accuracy of data collection.
[0084] like Figure 2 As shown, the system 200 includes:
[0085] Information collection unit 210 is used to collect basic information of all hard drives on the server, including hard drive identification information and hard drive firmware version;
[0086] The hard disk classification unit 220 is used to sort and classify basic information based on the hard disk firmware version using a quick sorting algorithm;
[0087] The log acquisition unit 230 is used to call the corresponding log collection tool from the preset tool library according to the category to which the target hard drive belongs, so as to obtain the logs of the target hard drive.
[0088] Optionally, as an embodiment of the present invention, the system further performs:
[0089] Remotely log in to the server using the Secure Shell protocol and interactive tools;
[0090] The execution script is stored in a specified path on the server. The execution script is used to perform the steps of collecting basic hard disk information, classifying hard disks, and calling log collection tools.
[0091] The server builds a tool library containing various log collection tools, each applicable to different firmware versions of the hard drive.
[0092] Specifically, prepare NVMe SSDs with different firmware versions: connect SSDs with different firmware versions to the same server. Remote connection and transfer: access the server where the SSDs are located using the Secure Shell protocol (SSH) and SSHPasS interactive tools with the correct IP address, and store the scripts in an appropriate path after logging in. Establish a tool library: organize and integrate log collection tools for different versions of NVMe SSDs for easy script usage.
[0093] Optionally, as an embodiment of the present invention, the information collection unit includes:
[0094] The information collection module is used to identify the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server using the nvme list command.
[0095] Identify and record the NVMe SSD information on the current server: Use the nvme list command to identify the drive letter, serial number, and firmware version number of the current NVMe SSD, and record the information.
[0096] Optionally, as an embodiment of the present invention, the hard disk classification unit includes:
[0097] The version sorting module is used to sort hard drives based on their firmware version number information using a quick sorting algorithm, and to group hard drives with the same firmware version number into the same category.
[0098] The category tagging module is used to tag the category of each hard drive and establish a mapping relationship between each category of hard drive and the applicable log collection tools.
[0099] Based on the recorded hard drive information, the firmware version numbers are quickly sorted and categorized using the quicksort algorithm. The quicksort algorithm is an improvement over the traditional bubble sort algorithm. Its basic idea is to divide the data to be sorted into two independent parts in one pass of the sorting algorithm, where all data in one part is smaller than all data in the other part. Then, quicksort is applied to these two parts separately using the same method. The entire sorting process can be performed recursively until the entire data becomes an ordered sequence.
[0100] Optionally, as an embodiment of the present invention, according to the category to which the target hard drive belongs, the corresponding log collection tool is called from a preset tool library to obtain the logs of the target hard drive, including:
[0101] Select the target hard drive from all hard drives on the server, and call the log collection tool that has a mapping relationship with the target hard drive from the tool library according to the category of the target hard drive;
[0102] The collected logs from the target hard drive are named according to the target log's serial number, log type, and collection time, and the named logs are saved to the specified path.
[0103] Specifically, for each categorized firmware version, the script calls the corresponding log collection tool to collect logs, naming the logs with "SN code + log type + date," and finally packages the result files and saves them in a pre-defined path within the script. Because the files have already been categorized and sorted, fast traversal of all disks is possible.
[0104] The above system uses the following methods for collecting logs from a single disk or a single type of log:
[0105] (1) First, identify the drive letter. Use the nvme list command to identify / dev / nvme*, and record the drive letter and the corresponding firmware version.
[0106] (2) Execute the script, add the parameter after the script: the corresponding drive letter or log type, and the script can determine the firmware version of the drive, call the corresponding collection tool, and collect the logs of the drive.
[0107] The multi-version NVMe solid-state drive log collection method provided by this invention integrates different version log collection tools and utilizes a quick sorting algorithm and scripts to achieve rapid sorting and classification of different firmware versions and rapid invocation of log collection tools, thereby greatly improving efficiency. At the same time, it avoids the confusion caused by manually selecting different tools when collecting logs from hard drives with different firmware versions, saving manpower and improving the accuracy of data collection.
[0108] Figure 3 This is a schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention. The terminal 300 can be used to execute the multi-firmware version hard disk log collection method provided in the embodiment of the present invention.
[0109] The terminal 300 may include a processor 310, a memory 320, and a communication unit 330. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figure does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0110] The memory 320 can be used to store the execution instructions of the processor 310. The memory 320 can be implemented by any type of volatile or non-volatile memory terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the terminal 300 is able to perform some or all of the steps in the above method embodiments.
[0111] The processor 310 serves as the control center of the storage terminal, connecting various parts of the electronic terminal via various interfaces and lines. It executes software programs and / or modules stored in the memory 320, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 310 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0112] The communication unit 330 is used to establish a communication channel, enabling the storage terminal to communicate with other terminals. It can receive user data sent by other terminals or send user data to other terminals.
[0113] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0114] Therefore, this invention integrates different versions of log collection tools and utilizes a quick sorting algorithm and scripts to achieve rapid sorting and classification of different firmware versions and rapid invocation of log collection tools, thereby greatly improving efficiency. At the same time, it avoids the confusion caused by manually selecting different tools when collecting logs from hard drives with different firmware versions, saving manpower and improving the accuracy of data collection. The technical effects achieved by this embodiment can be found in the description above, and will not be repeated here.
[0115] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other medium capable of storing program code. It includes several instructions to cause a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0116] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
[0117] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or units may be electrical, mechanical, or other forms.
[0118] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0119] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0120] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the invention should also be covered within the protection scope of the invention. Therefore, the protection scope of the invention should be determined by the scope of the claims.
Claims
1. A method for collecting hard disk logs across multiple firmware versions, characterized in that, include: Prepare NVMe SSDs with different firmware versions: Connect SSDs with different firmware versions to the same server; Remote connection and transfer: Access the server where the SSD is located with the correct IP address through the Secure Shell protocol SSH and sshpass interactive tools, and store the script in an appropriate path after logging in; Build a tool library: Organize and integrate log collection tools for different versions of NVMe SSDs for easy script calling; Methods for collecting hard drive logs across multiple firmware versions include: S1. Collect basic information about all hard drives on the server, including hard drive identification information and hard drive firmware version; The nvme list command identifies the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server. The script identifies and records the NVMe SSD information on the current server: using the nvme list command, it identifies the drive letter, serial number, and firmware version number of the current NVMe SSD and records the information. S2. Use the quicksort algorithm to sort and classify basic information based on hard drive firmware version; The quicksort algorithm is used to sort the hard drives based on their firmware version number information, and hard drives with the same firmware version number are grouped into the same category; the category of each hard drive is marked, and a mapping relationship between each category of hard drive and the applicable log collection tool is established; Based on the recorded hard drive information, the firmware version numbers are quickly sorted and categorized using a quick sorting algorithm; After classification, hard drives with the same firmware version number are classified as the same type, and a mapping relationship is established between firmware version number categories and the corresponding log collection tools in the tool library. S3. Based on the category of the target hard drive, call the corresponding log collection tool from the preset tool library to obtain the logs of the target hard drive; Select the target hard drive from all hard drives on the server, and call the log collection tool that has a mapping relationship with the target hard drive from the tool library according to the category of the target hard drive; name the collected logs of the target hard drive with the target log's SN code, log type and collection time, and save the named logs to the specified path; For the categorized firmware versions, the script calls the corresponding log collection tool to collect logs, and names the corresponding logs with SN code + log type + date. Finally, the result file is packaged and saved in the path preset in the script. Since the files have been categorized and sorted, it can quickly traverse all disks. For single-disk log collection or single-type log collection: First, identify the drive letter. Use the nvme list command to identify / dev / nvme*, and record the drive letter and the corresponding firmware version. Execute the script by adding parameters such as the corresponding drive letter or log type. The script will then determine the firmware version of the drive and call the corresponding collection tool to collect the logs of the drive. You can obtain the logs of all hard drives by traversing all hard drives on the server.
2. A system for collecting hard disk logs across multiple firmware versions, applicable to the method for collecting hard disk logs across multiple firmware versions as described in claim 1, characterized in that, include: An information collection unit is used to collect basic information about all hard drives on the server, including hard drive identification information and hard drive firmware version. The hard drive classification unit is used to sort and classify basic information based on the hard drive firmware version using a quicksort algorithm; The log acquisition unit is used to call the corresponding log collection tool from the preset tool library according to the category of the target hard drive, so as to obtain the logs of the target hard drive; The information collection unit includes: The information collection module is used to identify the drive letter, serial number, and firmware version number of all NVMe solid-state drives in the server using the nvme list command; The hard disk classification unit includes: The version sorting module is used to sort hard drives based on their firmware version number information using a quick sorting algorithm, and to group hard drives with the same firmware version number into the same category. The category tagging module is used to tag the category of each hard drive and establish a mapping relationship between each category of hard drive and the applicable log collection tools.
3. A terminal, characterized in that, include: processor; Memory used to store the processor's execution instructions; The processor is configured to perform the method of claim 1.
4. A computer-readable storage medium storing a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in claim 1.