Disclosure of Invention
In view of the above, it is desirable to provide an apparatus, a method, a device and a storage medium for adjusting the disk sequence of a hard disk.
According to a first aspect of the present invention, there is provided an apparatus for adjusting disk order of a hard disk, the apparatus comprising:
the RAID card is provided with a plurality of physical ports, and each physical port corresponds to one hard disk serial number in the operating system;
the system comprises a plurality of hard disk slot positions, a plurality of data processing units and a plurality of data processing units, wherein the hard disk slot positions are configured for inserting hard disks, each hard disk slot position corresponds to a slot position serial number on a back plate, and the number of the hard disk slot positions is the same as that of physical ports of the RAID card;
the Expander card is characterized in that a plurality of input pins are connected with a plurality of physical ports in a one-to-one mode, and a plurality of output pins are connected with a plurality of hard disk slots in a one-to-one mode;
and the control assembly is configured to read the board card information of the RAID card, determine the hard disk serial number corresponding to each physical port of the RAID card according to the board card information, and adjust the mapping relation between the input pin and the output pin of the Expander card based on the hard disk serial number corresponding to each physical port, so that each pair of mutually communicated hard disk slot positions and slot position serial numbers corresponding to the physical ports are the same as the hard disk serial numbers.
In one embodiment, the control component comprises a baseboard management controller and an integrated south bridge;
the baseboard management controller and the Expander card are respectively connected with the integrated south bridge, and the baseboard management controller is connected with the RAID card through an I2C bus and configured to read the board card information of the RAID card;
the integrated south bridge is configured to read the board card information from the baseboard management controller, determine a hard disk serial number corresponding to each physical port of the RAID card according to the board card information, and adjust the mapping relation between input pins and output pins of the Expander card to enable the physical ports to be communicated to the hard disk slots corresponding to the slot serial numbers identical to the hard disk serial numbers.
In one embodiment, the apparatus further comprises a display;
the display is connected with the substrate management controller;
the integrated south bridge is also configured to display a BIOS setting menu on a display through a VGA interface of the baseboard management controller and display the hard disks corresponding to the RAID cards according to the sequence of the hard disk serial numbers under the BIOS setting menu.
In one embodiment, the baseboard management controller and the integrated south bridge are connected via an LPC bus or an SPI bus.
In one embodiment, the device further comprises a CPLD and an indicator light;
the CPLD is connected with the integrated south bridge through an I2C bus and is respectively connected with each hard disk and the indicator light through GPIO pins;
the CPLD is configured to decode according to the lighting data of the integrated south bridge to determine a target hard disk, and light or close the indicator lamp according to a signal sent by the target hard disk through a GPIO pin.
In one embodiment, the Active LED signal, the Locate LED signal, and the Fault LED signal of each hard disk are respectively connected to three GPIO pins of the CPLD, and the indicator lamps include three indicator lamps corresponding to the Active LED signal, the Locate LED signal, and the Fault LED signal.
In one embodiment, the hard disk is a mechanical hard disk or a solid state hard disk.
According to a second aspect of the present invention, there is provided a disk order adjusting method for a hard disk, the method including:
connecting a plurality of physical ports of the RAID card with a plurality of input pins of the Expander card in a one-to-one manner, wherein each physical port corresponds to a hard disk serial number in an operating system;
connecting a plurality of hard disk slot positions inserted with hard disks with a plurality of output pins of the Expander card one to one, wherein each hard disk slot position corresponds to a slot position serial number on the back plate, and the number of the hard disk slot positions is the same as that of the physical ports of the RAID card;
and reading the board card information of the RAID card by using a control assembly, determining the hard disk serial number of each physical port of the RAID card according to the board card information, and adjusting the mapping relation of the input pin and the output pin of the Expander card based on the hard disk serial number of each physical port so as to ensure that the serial numbers of the slot positions corresponding to each pair of mutually communicated hard disk slot positions and physical ports are the same as the serial number of the hard disk.
According to a third aspect of the present invention, there is also provided a computer apparatus comprising:
at least one processor; and
the storage stores a computer program which can be run on the processor, and the processor executes the disk sequence adjusting method of the hard disk when executing the program.
According to a fourth aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, performs the foregoing disk order adjustment method for a hard disk.
According to the disk sequence adjusting device for the hard disk, the Expander card is arranged between the RAID card and the hard disk slots, the input pins of the Expander card are connected to the multiple physical ports of the RAID card in a one-to-one connection mode, the output pins of the Expander card are connected to the hard disk slots in a one-to-one connection mode, the control assembly is used for reading the card information of the RAID card to determine the hard disk sequence number of each physical port, and the mapping relation between the input pins and the output pins of the Expander card is adjusted based on the hard disk sequence number of each physical port, so that the slot sequence number corresponding to each pair of mutually communicated hard disk slots and physical ports is the same as the hard disk sequence number, manual wire changing or firmware of the RAID card is not needed, various types of back plates and RAID cards are compatible, good universality is achieved, and great convenience is brought to the use and maintenance of the RAID function of the hard disk.
In addition, the invention also provides a method for adjusting the disk sequence of the hard disk, a computer device and a computer readable storage medium, which can also achieve the technical effects and are not described herein again.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In an embodiment, referring to fig. 1 and fig. 2, the present invention provides an apparatus for adjusting a disk sequence of a hard disk, specifically, the apparatus includes:
the RAID card is provided with a plurality of physical ports, and each physical port corresponds to one hard disk serial number in the operating system;
specifically, a RAID card is a board card for implementing a RAID function, and is generally composed of a series of components such as an I/O processor, a SCSI controller, a SCSI connector, and a temporary storage. Different RAID cards support different RAID functions. The first function of the RAID card is to allow a plurality of disk drives to transmit data simultaneously, and these disk drives are logically one disk drive, so that the rate of a single disk drive can be several times, several tens of times, or even hundreds of times by using RAID. The second important function is that it can provide fault tolerance. The third and most important function is to ensure data security. The hard disk serial number is the hard disk sequence displayed by the hard disk under the BIOS setup menu (or OS), so that the user can easily know the information such as the hard disk position, the hard disk model, the hard disk capacity and the like corresponding to the hard disk slot at a glance, and the user can conveniently group the RAID function through the hard disk serial number. For example, assume that there are 8 hard disks, and the hard disk serial numbers corresponding to the eight hard disks may behard disk 0, hard disk 1,hard disk 2, hard disk 3, hard disk 4, hard disk 5, hard disk 6, and hard disk 7.
The system comprises a plurality of hard disk slot positions, a plurality of data processing units and a plurality of data processing units, wherein the hard disk slot positions are configured for inserting hard disks, each hard disk slot position corresponds to a slot position serial number on a back plate, and the number of the hard disk slot positions is the same as that of physical ports of the RAID card; the slot number refers to an arrangement serial number of the slot on the hard disk backplane, for example, it is assumed that a certain server backplane includes 8 slots (slots), and usually the 8 slots are sequentially marked asslot 0, slot 1,slot 2, slot 3, slot 4, slot 5, slot 6, and slot 7.
The Expander card is characterized in that a plurality of input pins are connected with a plurality of physical ports in a one-to-one mode, and a plurality of output pins are connected with a plurality of hard disk slots in a one-to-one mode;
and the control assembly is configured to read the board card information of the RAID card, determine the hard disk serial number corresponding to each physical port of the RAID card according to the board card information, and adjust the mapping relation between the input pin and the output pin of the Expander card based on the hard disk serial number corresponding to each physical port, so that each pair of mutually communicated hard disk slot positions and slot position serial numbers corresponding to the physical ports are the same as the hard disk serial numbers. The slot serial number is the same as the hard disk serial number, which means that thehard disk 0 corresponds to theslot 0, the slot 1 corresponds to the slot 1 … …, and so on, that is, the slot serial number should be understood as corresponding in a broad sense.
According to the disk sequence adjusting device for the hard disk, the Expander card is arranged between the RAID card and the hard disk slots, the input pins of the Expander card are connected to the multiple physical ports of the RAID card in a one-to-one connection mode, the output pins of the Expander card are connected to the hard disk slots in a one-to-one connection mode, the control assembly is used for reading the card information of the RAID card to determine the hard disk sequence number of each physical port, and the mapping relation between the input pins and the output pins of the Expander card is adjusted based on the hard disk sequence number of each physical port, so that the slot sequence number corresponding to each pair of mutually communicated hard disk slots and physical ports is the same as the hard disk sequence number, manual wire changing or firmware of the RAID card is not needed, various types of back plates and RAID cards are compatible, good universality is achieved, and great convenience is brought to the use and maintenance of the RAID function of the hard disk.
In yet another embodiment, referring again to fig. 1 and 2, the control components include a Baseboard Management Controller (BMC) and an integrated south bridge (PCH), which is a series of chipsets introduced by intel in 2008);
the baseboard management controller and the Expander card are respectively connected with the integrated south bridge, and the baseboard management controller is connected with the RAID card through an I2C bus and configured to read the board card information of the RAID card;
the integrated south bridge is configured to read the board card information from the baseboard management controller, determine a hard disk serial number corresponding to each physical port of the RAID card according to the board card information, and adjust the mapping relation between input pins and output pins of the Expander card to enable the physical ports to be communicated to the hard disk slots corresponding to the slot serial numbers identical to the hard disk serial numbers.
In yet another embodiment, the device further comprises a display;
the display is connected with the substrate management controller;
the integrated south bridge is also configured to display a BIOS setting menu on a display through a VGA interface of the baseboard management controller and display the hard disks corresponding to the RAID cards according to the sequence of the hard disk serial numbers under the BIOS setting menu.
In yet another embodiment, the baseboard management controller and the integrated south bridge are connected by an LPC bus or an SPI bus.
In yet another embodiment, the device further comprises a CPLD and an indicator light;
the CPLD is connected with the integrated south bridge through an I2C bus and is respectively connected with each hard disk and the indicator light through GPIO pins;
the CPLD is configured to decode according to the lighting data of the integrated south bridge to determine a target hard disk, and light or close the indicator lamp according to a signal sent by the target hard disk through a GPIO pin.
In another embodiment, the Active LED signal, the Locate LED signal, and the Fault LED signal of each hard disk are respectively connected to three GPIO pins of the CPLD, and the indicator lamps include three indicator lamps corresponding to the Active LED signal, the Locate LED signal, and the Fault LED signal. By way of specific example, the indicator lights may include green, red, yellow; certainly, in order to facilitate the discovery of users under the condition of faults, one of the indicator lamps can be replaced by a buzzer, and the buzzer can automatically give an alarm when the Fault LED signal is generated by the hard disk.
In yet another embodiment, the hard disk is a mechanical hard disk or a solid state hard disk.
In another embodiment, to facilitate understanding of the technical solution of the present invention, two RAID cards are taken as an example for detailed description, wherein the a RAID card (for short, a type card) and the B RAID card (for short, B type card) are provided by two different manufacturers, each of the a type card and the B type card has 8 physical ports denoted as phy0, phy1, and … … phy7, and the serial numbers of the hard disks corresponding to the 8 physical ports in the system are 0, 2, and … … 7, and the difference between the a type card and the B type card is: the hard disk serial numbers corresponding to the physical ports of the type a cards are sorted in a positive order (i.e., from 0 to 7), while the hard disk serial numbers corresponding to the physical ports of the type B cards are sorted in a reverse order (i.e., from 7 to 0), and the specific configuration modes of the device of the present invention for the type a cards and the type B cards are as follows:
the first scenario assumes that the server is collocated with a type a RAID card:
referring to fig. 1, when the system is powered on and powered on, the BMC may actively read the manufacturer information (vendor ID, device ID) on the RAID card through the I2C interface, then the PCH reads the RAID card information read by the BMC through the LPC (or SPI) interface, and then the PCH obtains the hard disk serial number corresponding to the physical port of the RAID card by comparing the information of the manufacturer RAID card a through the internal BIOS estimation. It should be noted that the BIOS firmware inside the PCH needs to write information of the corresponding relationship of the physical port of each RAID card supported by the server in advance, so that the input/output mapping relationship of the Expander card can be dynamically changed into a correct disk order that matches the hard disk slot order on the hard disk backplane of the server by changing the temporary memory of the internal firmware.
The corresponding relation between a physical port defined by the internal firmware of the type A card and a physical input pin of an Expander card of the server is assumed to be shown in table 1;
TABLE 1 correspondence between physical ports of type A cards and input pins of Expander cards
| RAID card physical port | Expander cardinput pin |
| Phy |
| 0 | Phy0 |
| Phy1 | Phy1 |
| Phy2 | Phy2 |
| Phy3 | Phy3 |
| Phy4 | Phy4 |
| Phy5 | Phy5 |
| Phy6 | Phy6 |
| Phy7 | Phy7 |
Assume that the mapping relationship between the input pins and the output pins of the initial settings estimated inside the Expander card of the server is shown in table 2;
TABLE 2 Expander card input pin and output pin mapping relationship
| Expander card input pin | Expander cardoutput pin |
| Phy |
| 0 | Phy8 |
| Phy 1 | Phy9 |
| Phy |
| 2 | Phy 10 |
| Phy 3 | Phy 11 |
| Phy 4 | Phy 12 |
| Phy 5 | Phy 13 |
| Phy 6 | Phy 14 |
| Phy 7 | Phy 15 |
At this time, the corresponding relationship between the output pin port initially set in the inside firmware of the Expander card of the server and the slot position serial number of the hard disk board is shown in table 3;
TABLE 3 Expander card output pin and slot number correspondence on backplane
| Expander output pin | Number of slot on back board |
| Phy 8 | Slot 1 |
| Phy 9 | Slot 2 |
| Phy 10 | Slot 3 |
| Phy 11 | Slot 4 |
| Phy 12 | Slot 5 |
| Phy 13 | Slot 6 |
| Phy 14 | Slot 7 |
| Phy 15 | Slot 8 |
Therefore, it can be seen that the correspondence between the physical port of the type a card and the serial number of the slot of the hard disk backplane on the server is shown in table 4:
TABLE 4A type card physical port and backboard slot number correspondence
Because the sequence correspondence relationship between the physical port defined by the internal firmware of the type a RAID card of the above example and the hard disk slot on the hard disk backplane designed by the server is consistent, the BIOS firmware determines that the physical output pin sequence initially set by the internal firmware of the Expander card does not need to be dynamically changed, and the PCH also transmits the correct hard disk sequence to a display (monitor) through a VGA interface of the BMC in an image information manner, so that the correct disk sequence corresponding to the hard disk of the RAID card and the hard disk of the server backplane can be displayed under the BIOS setting menu (or OS).
The second scenario assumes that the server is collocated with a type B RAID card:
referring to FIG. 2, the physical port defined by the internal solidification of the pseudo-type B RAID card corresponds to the input pin of the Expander card of the server as follows
TABLE 5 correspondence between physical ports of type B cards and input pins of Expander cards
| RAID card physical port | Expander card input pin |
| Phy 7 | Phy0 |
| Phy 6 | Phy1 |
| Phy 5 | Phy2 |
| Phy 4 | Phy3 |
| Phy 3 | Phy4 |
| Phy |
| 2 | Phy5 |
| Phy 1 | Phy6 |
| Phy |
| 0 | Phy7 |
The correspondence between the input pins and the output pins of the initial setting estimated in the Expander card of the server is assumed to be shown in table 2; at this time, the corresponding relationship between the physical port of the type B RAID card and the slot position of the hard disk backplane on the server is shown in table 6;
TABLE 6 correspondence between physical ports of type B cards and slot numbers of backplane
From table 6, the disk order corresponding to the hard disk backplane on the server is out of order because the physical port defined by the internal firmware of the type B RAID card corresponds to the physical output pin through the initial setting of the internal firmware of the Expander card.
According to the technology, the BMC can actively read factory information (supplier ID and equipment ID) on the RAID card through the I2C interface, then the PCH reads the RAID card information read by the BMC through the LPC (or SPI) interface, and then the PCH compares the information of the RAID card of the B factory through the internal BIOS firmware to obtain the corresponding hard disk serial number of the physical port of the RAID card in the system.
Then the PCH dynamically changes the sequence of the physical output pins into a correct disk sequence conforming to the sequence of the hard disk slots of the hard disk backplane of the server by dynamically changing the register through the firmware inside the Expander card via the I2C interface, and the mapping relationship between the physical input pins and the output pins of the dynamically changed firmware inside the Expander card is shown in table 7 below;
furthermore, after the firmware inside the Expander card modifies the corresponding relationship between the physical port of the type B RAID card and the slot number of the backplane on the server, the slot number is adjusted as shown in table 8, and the correct disk order corresponding to the hard disk of the RAID card and the hard disk of the server backplane can be displayed under the BIOS setting menu (or OS).
Table 7 mapping relationship between input pins and output pins of Expander card after adjustment
| Expander card input pin | Expander cardoutput pin |
| Phy |
| 0 | Phy8 |
| Phy 1 | Phy9 |
| Phy |
| 2 | Phy 10 |
| Phy 3 | Phy 11 |
| Phy 4 | Phy 12 |
| Phy 5 | Phy 13 |
| Phy 6 | Phy 14 |
| Phy 7 | Phy 15 |
TABLE 8 corresponding relationship between physical ports of type B cards and slot numbers of backplane
By combining the listed disk sequence adjusting embodiments of the type A card and the type B card, the device can read the RAID card manufacturer information by the BMC on the server, obtain the relation between the physical port of the RAID card and the hard disk sequence number in the system by comparing the BIOS firmware in the PCH, and dynamically adjust the mapping relation between the input pin and the output pin by changing the temporary storage of the firmware in the Expander card, so that the corresponding relation of the physical ports of the RAID cards of different manufacturers or different types can accord with the hard disk slot position sequence designed by the hard disk backboard of the server, thereby further realizing the automatic dynamic reforming of the hard disk sequence. The original slot position of the backboard is designed and finished, and the slot position on the backboard is designed for the RAID card of the type A, namely the RAID card of the type A can be directly used to realize the RAID function of 8 hard disks on the backboard when the RAID card of the type B is not used, when the RAID card of the type B is adopted, the device using the method only needs to modify the firmware of the RAID card of the type B connected with the RAID card of the type A, and the server using the RAID card of the type A and the RAID card of the type B is matched with and modifies the configuration of the RAID card of the type A to realize the exchange of RAID card types of different types.
Compared with the traditional method for adjusting the disk sequence of the hard disk by updating the firmware of the RAID card, the technical scheme of the invention does not need to consume excessive manpower and time, and can avoid the problem of update error or update failure of the firmware of the RAID. Simultaneously compare with the different cable mode adjustment dish preface mode of RAID card collocation, not only solved and increased the big problem of work load that the cable leads to, but also avoided producing the risk that line assembly personnel can cause hard disk dish preface because of collocation wrong RAID card cable.
In another embodiment, referring to fig. 4, the present invention further provides a method for adjusting a disk sequence of a hard disk, where the method includes the following steps:
s100, connecting a plurality of physical ports of the RAID card with a plurality of input pins of the Expander card in a one-to-one manner, wherein each physical port corresponds to a hard disk serial number in an operating system;
s200, connecting a plurality of hard disk slot positions inserted with hard disks with a plurality of output pins of an Expander card in a one-to-one manner, wherein each hard disk slot position corresponds to a slot position serial number on a backboard, and the number of the hard disk slot positions is the same as that of the physical ports of the RAID card;
s300, reading the board card information of the RAID card by using a control assembly, determining the hard disk serial number of each physical port of the RAID card according to the board card information, and adjusting the mapping relation of the input pin and the output pin of the Expander card based on the hard disk serial number of each physical port so as to enable the serial numbers of the hard disk slot position and the slot position corresponding to each pair of mutually communicated physical ports to be the same as the serial number of the hard disk.
In another embodiment, usually, firmware in the Expander card defaults to a mapping relationship between a set of input pins and output pins, so that there is a case where a part of RAID cards can be directly used without modifying firmware of the Expander card, and for this, the disk order adjusting method for another hard disk provided by the present invention includes the following steps:
firstly, after the system is powered on, actively reading information provider ID (identity) and equipment ID (identity) of a manufacturer, a model and the like of a RAID card on the system through an I2C interface by the aid of a BMC (baseboard management controller);
secondly, reading RAID card information read by the BMC through an LPC or SPI interface by the PCH;
thirdly, comparing the Physical ports (Physical ports, Phy for short, namely hardware high-speed signal link paths) of the RAID card with the corresponding relation of the Physical input ports of the Expander by using the BIOS firmware in the PCH, and determining the hard disk serial number corresponding to each Physical port in the system;
step four, the PCH dynamically changes the output pin sequence into a correct disk sequence which is in accordance with the hard disk slot position sequence on the hard disk backboard of the server by the firmware in the Expander card through the I2C interface in a mode of dynamically changing a temporary storage;
and step five, the PCH also transmits image information through a VGA interface of the BMC, and displays the correct hard disk sequence corresponding to the RAID card under a BIOS setting menu (or OS).
And sixthly, transmitting the lighting data of the hard disk to the CPLD for lamp number decoding through the VPP and SGPIO interfaces by the PCH, transmitting the lighting data to each hard disk slot position on a hard disk backboard of the system through the CPLD via the GPIO interface, and realizing the lighting function (Active LED/Locate LED/Fault LED) according to a corresponding hard disk sequence.
According to another aspect of the present invention, a computer device is provided, the computer device may be a server, and the internal structure thereof is shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program realizes the above-mentioned disk sequence adjusting method of the hard disk when being executed by the processor.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.