Hard disk monitoring method and device, equipment and medium

By establishing the correspondence between the physical drive letter, address code, and logical drive letter of the hard drive during the startup phase, and using the management controller to determine the identification information, the hard drive monitoring and management process is simplified, solving the problems of high complexity and low operation and maintenance efficiency in existing technologies, and realizing the accurate acquisition and configuration of hard drive status information.

CN121478591APending Publication Date: 2026-02-06INSPUR (SHANDONG) COMPUTER TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511675889.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing hard drive monitoring and management tools are complex, have low operational efficiency, require in-depth understanding of PCIe topology, and have high technical requirements, making it difficult to accurately correspond hard drive logical drive letters and physical locations.

Method used

By establishing the correspondence between the physical drive letter, address code, and logical drive letter of the hard drive during the boot phase, and using the management controller to determine the identification information, the hard drive monitoring and management process is simplified, and a simplified set of user commands and instructions is provided.

Benefits of technology

It reduces the complexity of hard drive monitoring and management, improves operation and maintenance efficiency, enables accurate acquisition and configuration of hard drive status information, and reduces operation and maintenance time and technical barriers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478591A_ABST
    Figure CN121478591A_ABST
Patent Text Reader

Abstract

The invention provides a hard disk monitoring method, device and equipment and a medium, which are applied to the technical field of storage, and the method comprises the following steps: acquiring a user command for a target hard disk; wherein the user command carries first identification information of the target hard disk, the first identification information is a physical drive letter, an address code or a logic drive letter, and the address code comprises a bus number, a device number and a function number; under the condition that a target instruction corresponding to the user command needs second identification information of the target hard disk, the second identification information corresponding to the first identification information is determined based on a preset corresponding relation, and the preset corresponding relation is a corresponding relation among a physical drive, an address code and a logic drive of the target hard disk; the first identification information and the second identification information are different types of identification information, and calling the target instruction based on the second identification information to obtain state information of the target hard disk or configure the target hard disk. Therefore, the complexity of hard disk monitoring management can be reduced, and the operation and maintenance efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of storage technology, and in particular to a hard disk monitoring method, apparatus, device, and medium. Background Technology

[0002] Currently, existing hard drive monitoring and management tools typically only operate on the logical drive letter of the hard drive. Knowing only other information about the hard drive requires considerable time to perform the mapping, and the mapping may be inaccurate. Using PCIe (Peripheral Component Interconnect Express, a high-speed bus) registers for monitoring and management is cumbersome, error-prone, and requires a deep understanding of PCIe topology, placing high technical demands on maintenance personnel.

[0003] Therefore, how to reduce the complexity of hard drive monitoring and management and improve operational efficiency is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of this invention is to provide a hard disk monitoring method, apparatus, device, and medium that can reduce the complexity of hard disk monitoring and management and improve operational efficiency. The specific solution is as follows:

[0005] In a first aspect, the present invention provides a hard disk monitoring method, comprising:

[0006] Obtain a user command for the target hard drive; wherein the user command carries first identification information of the target hard drive, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number;

[0007] When the target instruction corresponding to the user command requires the second identification information of the target hard disk, the second identification information corresponding to the first identification information is determined based on a preset correspondence. The preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk. The first identification information and the second identification information are identification information of different types. The second identification information is a physical drive letter, address code, or logical drive letter.

[0008] The target instruction is invoked based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0009] Optionally, before retrieving user commands, the following may also be included:

[0010] During the startup phase, the basic input / output system establishes the initial correspondence between the physical drive letter and the address code of each hard drive.

[0011] A second correspondence is established between the logical drive letter of each hard drive and the address code through the operating system;

[0012] Based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive.

[0013] Optionally, during the boot phase, the basic input / output system establishes a first correspondence between the physical drive letter and address code of each hard drive, including:

[0014] During the startup phase, the basic input / output system enumerates each hard drive on the bus and assigns a unique address code to each hard drive to identify it. It then obtains the port identifier corresponding to the physical drive letter of each hard drive and establishes a first correspondence between the physical drive letter and the address code of each hard drive based on the port identifier.

[0015] Optionally, after establishing the initial correspondence between the physical drive letter and address code of each hard drive during the boot phase via the Basic Input / Output System, the following is also included:

[0016] Save the first correspondence to the target table;

[0017] Accordingly, a second correspondence is established between the logical drive letter and the address code of each hard drive through the operating system; based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive, including:

[0018] The operating system enumerates each hard drive on the bus and creates a logical drive letter for each hard drive, establishing a second correspondence between the logical drive letter and the address code of each hard drive.

[0019] Obtain the first correspondence from the target table;

[0020] Based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive.

[0021] Optionally, after constructing a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard disk based on the first correspondence and the second correspondence, the method further includes:

[0022] The preset correspondence is transmitted to the management controller;

[0023] Accordingly, determining the second identifier information corresponding to the first identifier information based on a preset correspondence includes:

[0024] The management controller determines the second identification information corresponding to the first identification information based on a preset correspondence.

[0025] Optionally, the user command is a command to obtain the hard drive status, the first identification information is the physical drive letter, and the management controller determines the second identification information corresponding to the first identification information based on a preset correspondence, including:

[0026] The management controller determines the address code corresponding to the physical drive letter of the target hard drive based on a preset correspondence.

[0027] Accordingly, invoking the target instruction based on the second identification information includes:

[0028] Based on the address encoding, the target register access instruction is invoked to obtain the status information of the target hard disk.

[0029] Optionally, the user command is a command to configure the hard drive light, the first identification information is the physical drive letter, and the management controller determines the second identification information corresponding to the first identification information based on a preset correspondence, including:

[0030] The management controller determines the address code corresponding to the physical drive letter of the target hard drive based on a preset correspondence.

[0031] Accordingly, invoking the target instruction based on the second identification information includes:

[0032] The hard disk light configuration instruction is invoked based on the address encoding to configure the hard disk light of the target hard disk to a specified state.

[0033] In a second aspect, the present invention provides a hard disk monitoring device, comprising:

[0034] The user command acquisition module is used to acquire user commands for a target hard drive; wherein, the user command carries first identification information of the target hard drive, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number;

[0035] The identification information determination module is used to determine the second identification information corresponding to the first identification information based on a preset correspondence when the target instruction corresponding to the user command requires the second identification information of the target hard disk. The preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk. The first identification information and the second identification information are identification information of different types, and the second identification information is a physical drive letter, address code, or logical drive letter.

[0036] The target instruction invocation module is used to invoke the target instruction based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0037] Thirdly, the present invention provides an electronic device, comprising:

[0038] Memory, used to store computer programs;

[0039] A processor for executing the computer program to implement the steps of the aforementioned hard disk monitoring method.

[0040] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned hard disk monitoring method.

[0041] Fifthly, the present invention provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the aforementioned hard disk monitoring method.

[0042] As can be seen from the above scheme, the present invention provides a hard disk monitoring method, including: acquiring a user command for a target hard disk; wherein the user command carries first identification information of the target hard disk, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number; when the target instruction corresponding to the user command requires second identification information of the target hard disk, determining the second identification information corresponding to the first identification information based on a preset correspondence, wherein the preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk, the first identification information and the second identification information being identification information of different types, and the second identification information being a physical drive letter, address code, or logical drive letter; invoking the target instruction based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0043] As can be seen, in this invention, the correspondence between the physical drive letter, address code, and logical drive letter of the hard drive is pre-defined. Users can input commands carrying any type of hard drive identification information from the physical drive letter, address code, or logical drive letter. The identification information required for the target instruction to obtain hard drive status information or perform configuration can be determined based on the pre-defined correspondence, thereby enabling the invocation of the target instruction. In this way, by pre-constructing the correspondence between the physical drive letter, address code, and logical drive letter of the hard drive, users can accurately correspond by inputting any type of identification information they know, and then invoke the corresponding target instruction to obtain the status information of the target hard drive or configure the target hard drive. This eliminates the need to spend a lot of time matching information or delve into low-level knowledge, reducing the complexity of hard drive monitoring and management and improving operational efficiency.

[0044] Correspondingly, the hard disk monitoring device, equipment, medium, and product provided by the present invention also have the above-mentioned technical effects. Attached Figure Description

[0045] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 A flowchart of a hard disk monitoring method provided in an embodiment of the present invention;

[0047] Figure 2 This is a hardware schematic diagram of an application system for a hard disk monitoring method provided in an embodiment of the present invention;

[0048] Figure 3 This is a flowchart illustrating the establishment of a preset correspondence according to an embodiment of the present invention;

[0049] Figure 4 A hard disk monitoring flowchart provided in an embodiment of the present invention;

[0050] Figure 5 This is a schematic diagram of the structure of a hard disk monitoring device provided in an embodiment of the present invention;

[0051] Figure 6 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.

[0053] The terms "comprising" and "having," and any variations thereof, in the specification and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.

[0054] With the development of storage technology, high-speed bus technology, and CPU (Central Processing Unit) platforms, server configurations combining CPUs with NVMe (Non-Volatile Memory Express) hard drive storage are becoming increasingly common, leading to more and higher demands on hard drive monitoring and management. In modern server systems, developers and maintenance personnel often need to quickly locate specific hard drives for tasks such as identification, diagnosis, or replacement. Traditionally, this is done by using hard drive indicator lights (positioning lights, activity lights, fault lights) and analyzing the PCIe topology and related registers. This method is cumbersome, requires a certain level of technical expertise, is inefficient, and prone to errors.

[0055] In existing technologies, querying or managing NVMe hard drives typically requires using OS (Operating System) tools (such as nvme-cli) to read the hard drive's SMART (Self-Monitoring, Analysis, and Reporting Technology) information, or at a lower level, manually reading and writing complex PCIe configuration space registers to obtain device status and perform control. Another approach is through a BMC (Baseboard Management Controller), but existing BMC solutions often rely on intermediate devices (such as RAID (Redundant Array of Independent Disks) cards) protocols (e.g., SGPIO). Existing NVMe tools usually only operate on the hard drive's logical drive letter, requiring knowledge of only the target hard drive's physical drive bay or PCIe configuration space registers. In the case of BDF information, significant time is required for mapping. Monitoring and management using PCIe registers is cumbersome, error-prone, and requires in-depth understanding of PCIe topology, placing high technical demands on maintenance personnel. While monitoring and management using RAID card tools is relatively mature, tools for NVMe hard drives directly connected to the CPU are scarce, and they generally lack accurate and convenient mappings to physical drive bay numbers. Therefore, this invention provides a hard drive monitoring solution that reduces the complexity of hard drive monitoring and management and improves operational efficiency.

[0056] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0057] Next, a hard disk monitoring method provided by an embodiment of the present invention will be described in detail. Figure 1 This is a flowchart of a hard disk monitoring method provided in an embodiment of the present invention. The hard disk monitoring method includes:

[0058] Step S11: Obtain a user command for the target hard drive; wherein the user command carries the first identification information of the target hard drive, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number.

[0059] Among them, user commands can be user commands under the operating system, custom user commands, carry the identification information of the target hard drive, and represent the execution target of the user command, such as obtaining the health status of the hard drive.

[0060] A physical drive letter, or physical drive bay number, is a sequential number assigned to the hard drive backplane according to a predefined rule. For example, when viewed from the front of the computer case, the numbers are assigned from left to right and top to bottom. The address code is the BDF (Bus, Device, Function), which represents the bus number, device number, and function number assigned to a PCIe device in the system. A logical drive letter is a drive letter created by the operating system for each bus device after enumerating it.

[0061] Step S12: If the target instruction corresponding to the user command requires the second identification information of the target hard disk, determine the second identification information corresponding to the first identification information based on the preset correspondence relationship, wherein the preset correspondence relationship is the correspondence relationship between the physical drive letter, address code and logical drive letter of the target hard disk, the first identification information and the second identification information are identification information of different types, and the second identification information is a physical drive letter, address code or logical drive letter.

[0062] In this embodiment, the target instruction is an instruction used to obtain the status information of the target hard drive or to configure the target hard drive. It corresponds to a user command. For example, an instruction to read and call registers to obtain temperature information requires access based on a BDF (Browser Defender). If the user command contains a physical drive letter, the corresponding BDF can be determined based on a preset correspondence. The status information may include health status, temperature, etc., and the configuration may include configuring the status of the hard drive LEDs.

[0063] Furthermore, if the target instruction corresponding to the user command does not require the second identification information of the target hard disk, then the target instruction is invoked based on the first identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0064] In this embodiment of the invention, before obtaining user commands, the process may further include: establishing a first correspondence between the physical drive letter and the address code of each hard disk during the startup phase through the basic input / output system; establishing a second correspondence between the logical drive letter and the address code of each hard disk through the operating system; and constructing a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard disk based on the first correspondence and the second correspondence.

[0065] That is, during the startup phase, the basic input / output system establishes a first correspondence between the physical drive letter and the address code of each hard drive. After entering the operating system, it establishes a second correspondence between the logical drive letter and the address code of each hard drive. Then, based on the first correspondence and the second correspondence, it constructs a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard drive.

[0066] The process of establishing a first correspondence between the physical drive letter and the address code of each hard drive during the startup phase via the Basic Input / Output System (PIOS) may include: enumerating each hard drive on the bus during the startup phase via the PIOS, assigning a unique address code to each hard drive, obtaining the port identifier corresponding to the physical drive letter of each hard drive, and establishing a first correspondence between the physical drive letter and the address code of each hard drive based on the port identifier.

[0067] In this embodiment of the invention, the Basic Input / Output System (BIOS) enumerates PCIe devices during the startup phase and assigns a unique address code to each hard drive. The CPU's PCIe port is connected to the connector corresponding to each hard drive and then back to the BMC and CPU. This allows both the BMC and CPU to determine which physical drive bay is connected to which CPU port. This embodiment of the invention obtains the port identifier corresponding to each hard drive's physical drive letter and establishes a first correspondence between the physical drive letter and address code of each hard drive based on the port identifier.

[0068] Furthermore, after establishing a first correspondence between the physical drive letter and address code of each hard disk during the startup phase through the basic input / output system, the method further includes: saving the first correspondence to a target table; correspondingly, establishing a second correspondence between the logical drive letter and address code of each hard disk through the operating system; and constructing a preset correspondence between the physical drive letter, address code, and logical drive letter of each hard disk based on the first and second correspondences, including: enumerating each hard disk on the bus through the operating system and creating a logical drive letter for each hard disk, establishing a second correspondence between the logical drive letter and address code of each hard disk; obtaining the first correspondence from the target table; and constructing a preset correspondence between the physical drive letter, address code, and logical drive letter of each hard disk based on the first and second correspondences.

[0069] The target table can be an ACPI (Advanced Configuration and Power Management Interface) table. The operating system enumerates each hard drive on the bus and creates a logical drive letter for each hard drive, establishing a second correspondence between the logical drive letter and the address code for each hard drive. It can then locate the PCIe device corresponding to the logical drive letter, finding information including the logical drive letter and address code, and establishing the second correspondence between the logical drive letter and the address code based on this information.

[0070] Furthermore, after constructing a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard drive based on the first correspondence and the second correspondence, the method further includes: transmitting the preset correspondence to the management controller; correspondingly, determining the second identification information corresponding to the first identification information based on the preset correspondence includes: determining the second identification information corresponding to the first identification information based on the preset correspondence through the management controller.

[0071] In this embodiment of the invention, a preset correspondence can be transmitted to a management controller, wherein the management controller can be one of the following: BMC (Baseboard Management Controller), Integrated Light-Out (iLO) system, Integrated Dell Remote Access Control (IDRAC) card, or processing chip.

[0072] In this invention, at the hardware level, the necessary information is transmitted through hardware design (such as PCIe topology, I2C link, port ID, etc.). See [link to relevant documentation]. Figure 2 As shown, Figure 2 This is a hardware schematic diagram of an application system for a hard disk monitoring method provided in an embodiment of the present invention. First, for the hard disk backplane, the physical drive bay number (i.e., physical drive letter) of the hard disk is defined according to predetermined rules, such as numbering sequentially from left to right and top to bottom when viewed from the front window of the chassis. The CPU's port ID (i.e., the address signal representing each PCIe port of the CPU) is connected to the corresponding connector of each hard disk and then back to the BMC and CPU. In this way, both the BMC and the CPU can know which physical drive bay's hard disk is connected to which CPU's port. An IO expander chip can be used to save GPIO. The BMC uses I2C to connect to the hard disk connector for monitoring and management of the hard disk. An LPC (or eSPI, etc.) bus connection exists between the CPU and the BMC to support IPMI protocol data transmission. Figure 2The basic PCIe link from the CPU to the NVMe SSD is omitted. The transmission of PCIe port IDs is achieved through the MCIO connector on the motherboard (a high-speed connector typically used to transmit high-speed signals such as PCIe). This connector connects to the SSD via a cable and to the CPU or configuration resistor via onboard traces. The CPU's PCIe port ID (or address) configuration pin uses pull-up and pull-down resistors to configure the ID, with each port corresponding to a different ID value. The SSD slots also define the same port ID signal pins (the SSD's ID signal does not have pull-up or pull-down resistors; it simply receives and forwards the signal). These ID signals are then connected back to the CPU and BMC. When the motherboard connector and SSD connector are connected via cables, the ID value configured on the motherboard side can inform the CPU and BMC which PCIe port on the CPU corresponds to which SSD slot through the link: motherboard pull-up / pull-down resistor configuration ID --> motherboard connector --> SSD slot --> CPU / BMC.

[0073] At the firmware level, after the machine boots up, the BIOS enumerates PCIe devices, which involves bus detection, reading the configuration space, and building the topology. It then integrates the PCIe bus topology information (including device BDFs) into the ACPI table for the operating system to read. On the other hand, because the hardware topology allows the CPU and BMC to obtain the PCIe portID of each hard drive (i.e., which CPU's PCIe port the hard drive's PCIe resource comes from), the BIOS can use this portID and the enumerated PCIe topology information to parse the correspondence between the hard drive's physical drive bay and its BDF. This information is then transmitted to the BMC via the LPC bus using the IPMI protocol. The BMC can then present this information to the user on a web page.

[0074] Furthermore, at the software level, the software (i.e., OS, operating system) mainly performs two tasks: first, it completes the mapping of logical drive letters; second, it simplifies and integrates monitoring and management commands. Logical drive letter mapping: The following is the process after OS startup: After OS startup, it reads the ACPI table to obtain device information provided by the BIOS / UEFI. Then, to ensure accuracy and reliability, the kernel's PCI subsystem usually re-enumerates all PCIe buses and reads the configuration space of each device again to verify and build its internal device tree (e.g., the pci_dev structure linked list in Linux), but it is generally consistent with the topology enumerated during BIOS. Device nodes and partition nodes, i.e., logical drive letters, are created. In this invention, after creating logical drive letters, a new process is added whereby the OS re-binds the logical drive letters to the previously obtained BDF and physical drive bay signals.

[0075] The following is an example of the mapping between logical drive letters and BDFs:

[0076] # Find the PCI device corresponding to the logical drive letter

[0077] readlink / sys / class / block / nvme0n1

[0078] # Output similar to:

[0079] .. / .. / devices / pci0000:00 / 0000:00:01.0 / 0000:01:00.0 / nvme / nvme0n1

[0080] # Alternatively, you can perform a reverse search: to see which hard drive devices are associated with this PCI device.

[0081] ls -la / sys / bus / pci / devices / 0000:01:00.0 / nvme /

[0082] The above operations can be integrated into a single program, which is automatically executed by the OS to obtain the correspondence between logical drive letters and BDFs, and bind them to physical drive letters. For example: BDF (0000:01:00.0) is associated with a physical drive (such as M.2-1), and BDF (0000:01:00.0) is associated with a logical drive letter ( / dev / nvme0n1).

[0083] The above enumeration and binding process from firmware to OS layer can be found in [reference needed]. Figure 3 As shown, Figure 3 This is a flowchart illustrating a preset correspondence establishment method provided in an embodiment of the present invention. The kernel completes a three-layer binding according to a strategy, that is, binding logical drive letters, BDFs, and physical drive letters together.

[0084] Step S13: Invoke the target instruction based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0085] In other words, the target instruction is an instruction used to obtain the status information of the target hard disk or to configure the target hard disk.

[0086] In an optional implementation, the user command is a command to obtain the hard disk status, the first identification information is the physical drive letter, and the second identification information corresponding to the first identification information is determined by the management controller based on a preset correspondence, including: determining the address code corresponding to the physical drive letter of the target hard disk based on the preset correspondence by the management controller; correspondingly, the target instruction is invoked based on the second identification information, including: invoking a target register access instruction based on the address code to obtain the status information of the target hard disk.

[0087] In an optional implementation, the user command is a command to configure the hard drive light. The first identification information is the physical drive letter. The management controller determines the second identification information corresponding to the first identification information based on a preset correspondence, including: the management controller determines the address code corresponding to the physical drive letter of the target hard drive based on the preset correspondence; correspondingly, the target instruction is invoked based on the second identification information, including: invoking the hard drive light configuration instruction based on the address code to configure the hard drive light of the target hard drive to a specified state.

[0088] The specified status can include on or off, and the hard drive indicator can include a location indicator or a fault indicator. In an optional implementation, the user command is a command to obtain the hard drive status. The first identification information is the physical drive letter. The operating system can obtain the user command for the target hard drive, parse the user command, and send a request to the management controller based on the parsing result. Upon receiving the request, the management controller determines the address code corresponding to the physical drive letter based on a preset correspondence, calls the target register access instruction based on the address code, obtains the status information of the target hard drive, and returns the status information to the operating system. The operating system processes the information according to a preset format, generates status information in a preset format, and displays it on the user interface. In this way, users can obtain user-friendly display information and easily understand the hard drive status by entering simple user commands through the operating system.

[0089] This invention simplifies the instructions, presenting them as an nvme-tool program. This program primarily includes two functionalities: it integrates or invokes the corresponding binding relationships between physical drive bays, BDFs, and logical drive letters mentioned in the previous step. When entering instructions, users can input any one of the physical drive bays, BDFs, or logical drive letters based on known information, eliminating the need for manual comparison and matching. Through intuitive and easy-to-understand instructions, users can call the BMC's API (Application Programming Interface) or the OS's lspci commands to obtain NVMe hard drive information or perform configuration and management.

[0090] For example, the syntax structure of this program can be defined as follows: nvme-tool <slot <slot_number> / BDF / Logic disk drive> <command> [arguments].

[0091] Examples of commonly used commands are shown in Table 1:

[0092] Table 1

[0093]

[0094] In Table 1, accessing the BMC register requires first matching the BDF. Taking the goal of checking the health status of the server's third hard drive and illuminating the positioning indicator as an example, the traditional method and the simplified method of this invention are compared as follows:

[0095] The traditional method requires first locating the OS device node corresponding to the third disk, which is quite difficult. It typically involves consulting technical manuals and using commands like `ls` (e.g., `ls -l / dev / disk / by-path / | grep`) to match the bus path, a complex process. Further, you can check health information (using nvme-cli) using `sudo nvme smart-log / dev / nvme2n1 | grep -E "percentage_used|temperature|critical_warning"`. The output is a bunch of raw technical data that needs to be interpreted manually. To activate the LED: Generally, you need to use the raw ipmitool command and look up the BDF number. First, find the BDF number using `sudo lspci -t -nn | grep NVMe`. Assuming the output shows 0000:05:00.0, which indicates the 3rd disk, then send the IPMI OEM command to activate the LED. The command format varies depending on the manufacturer, for example: `sudo ipmitool raw 0x30 0x31 0x05 0x00 0x01 0x01`. The numbers in this command (0x30, 0x31...) may differ for different server models, making it prone to errors.

[0096] The simplified method of this invention is as follows: the program encapsulates the corresponding drive letter, drive bay, and BDF mapping, and automatically executes the corresponding read and configuration commands. First, the health status of drive bay 3 is checked using the following command: `sudo nvme-toolslot 3 health`. The output will resemble the following:

[0097] Slot #3 Health Status:

[0098] --------------------------

[0099] Model: Samsung SSD 980 PRO 1TB

[0100] Serial Number: S4B4NJ0N123456

[0101] Health: 98% Remaining

[0102] Temperature: 45 °C

[0103] Power On Hours: 1234 hours

[0104] Data Written: 15.7 TB

[0105] Status: OK

[0106] Furthermore, enter the following command to start the identification light for slot 3 flashing, making it easy to locate in the server room. The OS can automatically match the device BDF and call the ipmitool command to have the BMC turn on the light. Alternatively, the BMC can match and turn on the light itself: `sudo nvme-tool slot 3 locate on`. The user interface will output the following: "Identification LED for Slot #3 is now ON (Blinking)". The actual hard drive bay indicator light will then illuminate.

[0107] Further, see Figure 4 As shown, Figure 4 This invention provides a flowchart for hard disk monitoring.

[0108] OS tools parse commands: The nvme-tool program parses command lines, such as the example above where the user wants health information for slot 3.

[0109] Initiating an API call to BMC: nvme-tool calls the BMC's API or sends a request via ipmitool on the Linux system (which calls the BMC's IPMI interface). The request content is: "Get health information for drive bay 3".

[0110] BMC query mapping table: After receiving the request, BMC searches for the PCIe BDF number (e.g., 0000:05:00.0) corresponding to drive bay 3 in its internally stored mapping table (passed by the BIOS during startup).

[0111] BMC access to NVMe registers: BMC reads the SMART health information log of the NVMe hard drive via the I2C bus according to the NVMe management interface specification.

[0112] BMC returns data: BMC encapsulates the raw log data into formats such as JSON and returns it to the nvme-tool program on the OS.

[0113] Data formatting output: The nvme-tool program receives data, parses and extracts key information (such as percentages and temperatures), and formats it into a human-readable table format, which is then presented to the user.

[0114] Lighting: The BMC uses the existing ipmitool raw commands to control the lighting based on the matched BDF.

[0115] In summary, through the collaboration of hardware, firmware, and software, automatic matching and correspondence between physical drive bays, BDFs, and logical drive letters are achieved, and a simplified NVMe hard drive monitoring and management program is provided to users, improving problem localization and maintenance efficiency.

[0116] This invention proposes a simplified NVMe hard drive management scheme based on BMC-OS collaboration. It primarily addresses the difficulties in establishing the mapping between physical drive bays, logical drive letters, and PCIe BDF information, as well as the cumbersome operation commands and high technical barriers for users under the OS and BMC, thereby improving the efficiency of problem localization and maintenance. This invention establishes the mapping relationship between the NVMe hard drive's PCIe bus / device / function number (BDF) and physical drive bay number during the boot phase in the BIOS. After entering the OS, it obtains the mapping relationship between the BDF and logical drive letter. The BMC obtains the NVMe hard drive status through a standard sideband interface; the OS can operate on the PCIe registers. A simplified instruction set is developed under the OS, binding the BDF, logical drive letter, and physical drive bay. Information is shared between the BMC and the OS through standard interface protocols (such as IPMI). Thus, regardless of whether the user is under the OS or the BMC, as long as they know any of the BDF, logical drive letter, or physical drive bay information, they can obtain the corresponding NVMe drive information and perform management operations through simplified command operations or through the BMC web interface.

[0117] This invention may include the following modules: a mapping relationship establishment module (BIOS and OS side), which, during the initial system startup, has the BIOS traverse the PCIe bus to obtain the BDF number and then, based on information such as the port ID provided by the hardware, complete the mapping between the BDF and the physical drive bay, creating a mapping table. After the OS starts, it creates the mapping relationship between logical drive letters and BDFs. A mapping relationship transmission and storage module (BIOS, OS, and BMC interaction), which is mainly responsible for transmitting the hard drive mapping relationship between the BIOS and OS to the BMC via the IPMI transmission protocol (in this example, the physical bus uses LPC, but eSPI can also be used). The BMC can present this to the user through a web interface and invoke this mapping relationship when monitoring and managing the hard drive. A hardware access agent module (BMC side), where the BMC acts as a proxy for hardware operations, converting abstract drive bay operations into specific register read / write operations, achieving out-of-band management. A user interface module (OS side), which is the user-facing "interface," a set of simplified command-line tools or a graphical interface running on the operating system. Based on a simplified OS instruction set corresponding to physical drive bays, BDFs, and logical drive letters, the complexity of the underlying hardware and protocols is hidden, greatly improving the user experience.

[0118] This invention provides a method for establishing a precise mapping relationship between BDF, physical drive bays, and logical drive letters, a mechanism for transferring and solidifying the mapping relationship from BIOS and OS to BMC, and a simplified instruction program that can operate on physical drive bay numbers, BDF, and logical drive letters. The BIOS establishes the mapping relationship between the NVMe device's BDF and the physical drive bay number, while the OS adds the corresponding logical drive letter. The BIOS and OSpatch transfer this mapping relationship to the BMC for storage. Users can notify the BMC through simplified operation instructions under the OS, or directly operate on the BMC web page, based on known physical drive bay numbers, BDF, or logical drive letter information. The BMC then accesses the corresponding NVMe device according to the mapping relationship to perform monitoring and management. The architecture includes BIOS and OS modules for establishing and transferring the mapping relationship, a BMC module for storing the mapping and performing low-level hardware operations, and an operating system tool / instruction module for receiving user instructions and interacting with the BMC.

[0119] Thus, the simplified NVMe hard drive management solution based on BMC-OS collaboration proposed in this invention solves the core pain points of NVMe hard drive problem localization and daily operation and maintenance, transforming complex low-level hardware operations into a simple, secure, and efficient management experience. The main benefits include: significantly improving operation and maintenance efficiency, lowering the operational threshold, simplifying cumbersome multi-step operations into simple one-step commands, greatly shortening server hardware maintenance time, reducing the professional skill requirements for operation and maintenance personnel, and improving the utilization efficiency of human resources. It achieves operational accuracy and reliability, eliminating the risk of mistakenly killing healthy hard drives or missing faulty hard drives due to misjudgment of drive positions, ensuring that every operation and maintenance action is accurately applied to the target hardware, guaranteeing system stability and data security. It provides excellent uniformity and maintainability, offering a consistent operation interface for heterogeneous hardware environments. Traditionally, different server manufacturers and different models of BMCs have different IPMI OEM command formats. Operation and maintenance scripts are not universal, requiring the maintenance of multiple sets of scripts for different devices, resulting in high maintenance costs. This invention shields users from the implementation differences of the underlying BMC by providing a unified tool (such as nvme-tool) at the OS level. Regardless of the brand of the underlying hardware, users use the same set of commands for management, simplifying infrastructure management in large-scale, multi-brand data centers and achieving standardization and automation of operation and maintenance processes. It enhances out-of-band management capabilities and improves system resilience. Even in the event of a host operating system crash, become unresponsive, or not installed, hardware management can still be performed through the BMC, reducing abnormal scenarios where hardware cannot be managed due to system software issues. The simplified NVMe hard drive management solution based on BMC-OS collaboration provided by this invention allows users to quickly and accurately query and manage the status of all hard drives without understanding the details of the underlying hardware.

[0120] Figure 5 This is a schematic diagram of a hard disk monitoring device provided in an embodiment of the present invention. See also: Figure 5 As shown, the present invention provides a hard disk monitoring device, comprising:

[0121] User command acquisition module 11 is used to acquire user commands for a target hard disk; wherein, the user command carries first identification information of the target hard disk, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number;

[0122] The identification information determination module 12 is used to determine the second identification information corresponding to the first identification information based on a preset correspondence when the target instruction corresponding to the user command requires the second identification information of the target hard disk. The preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk. The first identification information and the second identification information are identification information of different types, and the second identification information is a physical drive letter, address code, or logical drive letter.

[0123] The target instruction invocation module 13 is used to invoke the target instruction based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

[0124] The device further includes a preset correspondence construction module, used to construct a preset correspondence before obtaining user commands. The preset correspondence construction module includes:

[0125] The first correspondence establishment submodule is used to establish the first correspondence between the physical drive letter and the address code of each hard disk during the startup phase through the basic input / output system;

[0126] The second correspondence establishment submodule is used to establish a second correspondence between the logical drive letter of each hard disk and the address code through the operating system;

[0127] The preset correspondence construction submodule is used to construct a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard disk based on the first correspondence and the second correspondence.

[0128] The first correspondence establishment submodule is specifically used to enumerate each hard disk on the bus during the startup phase through the basic input / output system, assign a unique address code to each hard disk, obtain the port identifier corresponding to the physical drive letter of each hard disk, and establish the first correspondence between the physical drive letter and the address code of each hard disk based on the port identifier.

[0129] The device may further include a first correspondence storage module, which is used to save the first correspondence to a target table after establishing a first correspondence between the physical drive letter and the address code of each hard disk during the startup phase through the basic input / output system.

[0130] The second correspondence establishment submodule is specifically used to: enumerate each hard disk on the bus through the operating system, create a logical drive letter for each hard disk, and establish a second correspondence between the logical drive letter and the address code of each hard disk.

[0131] The preset correspondence construction submodule is specifically used to obtain the first correspondence from the target table; and to construct a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard disk based on the first correspondence and the second correspondence.

[0132] Furthermore, the device also includes a correspondence transmission module, used to transmit the preset correspondence to the management controller after constructing a preset correspondence between the physical drive letter, the address code and the logical drive letter of each hard disk based on the first correspondence and the second correspondence;

[0133] Correspondingly, the identification information determination module 12 is specifically used to determine the second identification information corresponding to the first identification information based on a preset correspondence relationship through the management controller.

[0134] In an optional implementation, the user command is a command to obtain the hard disk status, the first identification information is the physical drive letter, and the identification information determination module 12 is specifically used to determine the address code corresponding to the physical drive letter of the target hard disk based on a preset correspondence through the management controller; correspondingly, the target instruction calling module 13 is specifically used to: call the target register access instruction based on the address code to obtain the status information of the target hard disk.

[0135] In an optional implementation, the user command is a command to configure the hard drive light, the first identification information is the physical drive letter, and the identification information determination module 12 is specifically used to determine the address code corresponding to the physical drive letter of the target hard drive based on a preset correspondence through the management controller; correspondingly, the target instruction is called based on the second identification information, and the target instruction calling module 13 is specifically used to: call the hard drive light configuration instruction based on the address code to configure the hard drive light of the target hard drive to a specified state.

[0136] Figure 5 The description of the features in the corresponding embodiments can be found in [reference needed]. Figure 1 The relevant descriptions of the corresponding embodiments will not be repeated here.

[0137] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present invention, such as... Figure 6 As shown, the electronic device includes: a memory 60 for storing computer programs;

[0138] The processor 61 is used to execute computer programs to implement the steps of the hard disk monitoring method as described in the above embodiments.

[0139] The processor 61 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 61 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 61 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 61 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 61 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0140] The memory 60 may include one or more computer-readable storage media, which may be non-transitory. The memory 60 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 60 is used to store at least the following computer program 601, which, after being loaded and executed by the processor 61, can implement the relevant steps of the hard disk monitoring method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 60 may also include an operating system 602 and data 603, and the storage method may be temporary or permanent storage. The operating system 602 may include Windows, Unix, Linux, etc. The data 603 may include, but is not limited to, instruction data.

[0141] In some embodiments, the electronic device may further include a display screen 62, an input / output interface 63, a communication interface 64, a power supply 65, and a communication bus 66.

[0142] Those skilled in the art will understand that Figure 6 The structures shown do not constitute a limitation on electronic devices and may include more or fewer components than those shown.

[0143] It is understood that if the hard disk monitoring method in the above embodiments is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the current technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, portable hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk, or optical disk, and other media capable of storing program code.

[0144] Based on this, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the hard disk monitoring method described above.

[0145] Furthermore, embodiments of the present invention also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the hard disk monitoring method described above.

[0146] The foregoing has provided a detailed description of a hard disk monitoring method, apparatus, device, and medium provided by embodiments of the present invention. The various embodiments are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0147] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0148] The above provides a detailed description of a hard disk monitoring method, apparatus, device, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the present invention.

Claims

1. A hard disk monitoring method, characterized in that, include: Obtain a user command for the target hard drive; wherein the user command carries first identification information of the target hard drive, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number; When the target instruction corresponding to the user command requires the second identification information of the target hard disk, the second identification information corresponding to the first identification information is determined based on a preset correspondence. The preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk. The first identification information and the second identification information are identification information of different types. The second identification information is a physical drive letter, address code, or logical drive letter. The target instruction is invoked based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

2. The hard disk monitoring method according to claim 1, characterized in that, Before retrieving user commands, the process also includes: During the startup phase, the basic input / output system establishes the initial correspondence between the physical drive letter and the address code of each hard drive. A second correspondence is established between the logical drive letter of each hard drive and the address code through the operating system; Based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive.

3. The hard disk monitoring method according to claim 2, characterized in that, During the boot phase, the Basic Input / Output System (PIS) establishes the initial correspondence between the physical drive letter and address code of each hard drive, including: During the startup phase, the basic input / output system enumerates each hard drive on the bus and assigns a unique address code to each hard drive to identify it. It then obtains the port identifier corresponding to the physical drive letter of each hard drive and establishes a first correspondence between the physical drive letter and the address code of each hard drive based on the port identifier.

4. The hard disk monitoring method according to claim 2, characterized in that, After establishing the initial correspondence between the physical drive letter and address code of each hard drive during the boot phase via the Basic Input / Output System, the process also includes: Save the first correspondence to the target table; Accordingly, a second correspondence is established between the logical drive letter and the address code of each hard drive through the operating system; based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive, including: The operating system enumerates each hard drive on the bus and creates a logical drive letter for each hard drive, establishing a second correspondence between the logical drive letter and the address code of each hard drive. Obtain the first correspondence from the target table; Based on the first correspondence and the second correspondence, a preset correspondence is constructed between the physical drive letter, the address code, and the logical drive letter of each hard drive.

5. The hard disk monitoring method according to claim 2, characterized in that, After constructing a preset correspondence between the physical drive letter, the address code, and the logical drive letter of each hard drive based on the first correspondence and the second correspondence, the method further includes: The preset correspondence is transmitted to the management controller; Accordingly, determining the second identifier information corresponding to the first identifier information based on a preset correspondence includes: The management controller determines the second identification information corresponding to the first identification information based on a preset correspondence.

6. The hard disk monitoring method according to claim 5, characterized in that, The user command is a command to obtain the hard drive status. The first identification information is the physical drive letter. The management controller determines the second identification information corresponding to the first identification information based on a preset correspondence, including: The management controller determines the address code corresponding to the physical drive letter of the target hard drive based on a preset correspondence. Accordingly, invoking the target instruction based on the second identification information includes: Based on the address encoding, the target register access instruction is invoked to obtain the status information of the target hard disk.

7. The hard disk monitoring method according to claim 5, characterized in that, The user command is a command to configure the hard drive light. The first identification information is the physical drive letter. The management controller determines the second identification information corresponding to the first identification information based on a preset correspondence, including: The management controller determines the address code corresponding to the physical drive letter of the target hard drive based on a preset correspondence. Accordingly, invoking the target instruction based on the second identification information includes: The hard disk light configuration instruction is invoked based on the address encoding to configure the hard disk light of the target hard disk to a specified state.

8. A hard disk monitoring device, characterized in that, include: The user command acquisition module is used to acquire user commands for a target hard drive; wherein, the user command carries first identification information of the target hard drive, the first identification information being a physical drive letter, address code, or logical drive letter, and the address code including a bus number, device number, and function number; The identification information determination module is used to determine the second identification information corresponding to the first identification information based on a preset correspondence when the target instruction corresponding to the user command requires the second identification information of the target hard disk. The preset correspondence is the correspondence between the physical drive letter, address code, and logical drive letter of the target hard disk. The first identification information and the second identification information are identification information of different types, and the second identification information is a physical drive letter, address code, or logical drive letter. The target instruction invocation module is used to invoke the target instruction based on the second identification information to obtain the status information of the target hard disk or to configure the target hard disk.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the hard disk monitoring method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the hard disk monitoring method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Hard disk information management system and hard disk information management method

    CN121879690A