A loading control method, device, equipment and medium of a hard disk device

By acquiring physical slot information and generating an initial memory file system, the problem of hard disk device drive letter drift in Linux servers was solved, ensuring that hard disk devices are loaded in a fixed order after restarting, thus achieving drive letter stability.

CN118838535BActive Publication Date: 2026-07-24NETTRIX INFORMATION IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETTRIX INFORMATION IND CO LTD
Filing Date
2023-04-24
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

The drive letter of a hard disk device in a Linux server may drift after the operating system restarts, making system maintenance and service deployment difficult.

Method used

By obtaining physical slot information, the driver loading order of hard drive devices is determined, and an initial memory file system is generated to fix the loading order of hard drive devices and avoid drive letter drift.

Benefits of technology

It enables the hardware device drive letter to be fixed when the operating system restarts, ensuring the smooth operation of system maintenance and service deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118838535B_ABST
    Figure CN118838535B_ABST
Patent Text Reader

Abstract

The application discloses a loading control method, device and equipment of a hard disk device and a medium. The method comprises the following steps: acquiring physical slot information; determining the drive loading sequence of the hard disk device inserted into the physical slot according to the physical slot information, generating an initialization memory file system of a server according to the drive loading sequence, and controlling the loading of the hard disk device according to the initialization memory file system. In the embodiment, the drive loading sequence of the hard disk device is determined according to the physical slot information, the initialization memory file system of the server is generated according to the drive loading sequence, the physical slot is bound to the disk symbol of the hard disk, the problem that the hard disk drive loading sequence of the Linux system is not fixed and the disk symbol drifts can be solved, the loading control of the hard disk device is realized according to the drive loading sequence when the operating system starts, and the fixed disk symbol is allocated to the hard disk device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a loading control method, apparatus, device, and medium for a hard disk device. Background Technology

[0002] With the development of digital technology, Linux servers are being deployed in more and more application scenarios due to their open-source nature and high security.

[0003] In a Linux server, there are multiple Small Computer System Interface (SCSI) hard drive controllers. During the operating system startup process, the Linux kernel assigns drive letters to these hard drives in the order they are scanned. For example, based on the order the hardware devices are scanned, drive letters are assigned sequentially as / dev / sda, / dev / sdb, / dev / sdc, etc. However, the Linux kernel does not have a fixed hard drive scanning order; that is, the Linux kernel cannot guarantee that the order in which hard drives are scanned and drivers are matched will be the same each time. This causes the drive letters of the hard drive devices to change with each operating system restart, a phenomenon known as drive letter drift. For example, during the last operating system startup, hard drive 1 and hard drive 2 were assigned drive letters / dev / sda and / dev / sdb, respectively. However, upon a restart, hard drive 1 and hard drive 2 are assigned drive letters / dev / sdb and / dev / sda, respectively.

[0004] Currently, in scenarios such as system maintenance, service deployment, or reliability testing, drive letters are used as path identifiers for hard drives. If a drive letter is misaligned, it becomes impossible to accurately locate the hard drive device based on the drive letter, affecting the smooth progress of system maintenance, service deployment, or reliability testing. Summary of the Invention

[0005] This invention provides a loading control method, apparatus, device, and medium for hard disk devices, which can solve the problem of drive letter drift.

[0006] According to one aspect of the present invention, a loading control method for a hard disk device is provided, comprising:

[0007] Obtain physical slot information;

[0008] The driver loading order of the hard disk devices that have been inserted into the physical slots is determined based on the physical slot information, and the server's initial memory file system is generated based on the driver loading order.

[0009] The disk device is loaded and controlled according to the initialized memory file system.

[0010] Optionally, obtaining the physical slot information includes:

[0011] The system retrieves the physical slot identifiers and bus addresses associated with the physical slots, as well as the slot order, stored in the server's firmware. The slot order includes both the physical slot order of the server and the physical slot order of the hard drive controller. This design pre-determines the association between physical slots and bus addresses. Since inserting a hard drive into a physical slot stores a record of the device identifier and bus address in the operating system, a correspondence between physical slots and hard drive devices can be established based on the bus address, facilitating the sorting of hard drive devices based on their slot order.

[0012] Optionally, determining the driver loading order of hard disk devices inserted into physical slots based on the physical slot information includes:

[0013] In the case that the server contains at least two hard disk controllers, the first sorting result of the at least two hard disk controllers is determined according to the slot order of the physical slots of the server;

[0014] Based on the first sorting result and the slot order of each hard disk controller's physical slot, determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controllers;

[0015] The driver loading order of the hard disk device is determined based on the second sorting result.

[0016] If multiple hard drive controllers are inserted into the physical slots of the server, the first sorting result of the hard drive controllers is determined according to the slot order of the physical slots of the server. Then, the second sorting result of the hard drive devices is determined according to the first sorting result and the slot order of each hard drive controller. Thus, the driver loading order is determined according to the second sorting result, thereby fixing the hard drive driver loading order and avoiding drive letter drift.

[0017] Optionally, determining the first sorting result of the at least two hard disk controllers based on the slot order of the server's physical slots includes:

[0018] Obtain the device identifier and bus address of the hard drive controller that has been inserted into the physical slot of the server;

[0019] Based on the bus address of each hard disk controller, the physical slot identifier and bus address of the associated storage are matched to determine the first correspondence between the device identifier of the hard disk controller and the physical slot identifier of the server.

[0020] Based on the first correspondence and the slot order of the server physical slots, the first sorting result of the at least two hard disk controllers is determined.

[0021] The correspondence between the hard disk controllers inserted into the physical slots of the server and the physical slots of the server is established by using the bus address, so as to determine the sorting result of the hard disk controllers according to the slot order of the physical slots of the server.

[0022] Optionally, the step of determining the second sorting result of the hard disk devices inserted into the physical slots of the hard disk controllers based on the first sorting result and the slot order of each physical slot of the hard disk controller includes:

[0023] Obtain the device identifier and bus address of the hard drive device that has been inserted into the physical slot of the hard drive controller;

[0024] Based on the bus address of the hard disk device, the physical slot identifier and bus address of the associated storage are matched to determine the second correspondence between the device identifier of the hard disk device and the physical slot identifier of the hard disk controller;

[0025] Based on the first sorting result, the second correspondence, and the slot order of the physical slots of the hard disk controller, the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller is determined.

[0026] The bus address establishes the correspondence between the inserted hard disk devices and the physical slots of the hard disk controller, thereby determining the sorting result of the hard disk devices based on the slot order of the physical slots of the hard disk controller.

[0027] Optionally, determining the driver loading order of hard disk devices inserted into physical slots based on the physical slot information includes:

[0028] In the case where the server contains a hard disk controller, the third sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller is determined according to the slot order of the physical slots of the hard disk controller.

[0029] The driver loading order of the hard disk device is determined based on the third sorting result.

[0030] If a hard drive controller is inserted into a physical slot of the server, the driver loading order of the hard drive device is determined according to the slot order of the physical slot of the hard drive controller, thereby fixing the hard drive driver loading order and avoiding drive letter drift.

[0031] Optionally, the step of controlling the loading of the hard disk device according to the initialized memory file system includes:

[0032] Update the original initial memory file system of the server according to the initial memory file system;

[0033] The updated initial memory file system loads the drivers sequentially and determines the drive letter of the corresponding hard disk device.

[0034] The advantage of this design is that it updates the server's original initial memory file system based on the newly generated initial memory file system, thereby enabling the loading of drivers in the new memory file system's corresponding driver loading order and the allocation of drive letters.

[0035] According to another aspect of the present invention, a loading control device for a hard disk device is provided, comprising:

[0036] The slot information acquisition module is used to acquire physical slot information;

[0037] The loading order determination module is used to determine the driver loading order of hard disk devices that have been inserted into physical slots based on the physical slot information, and to generate the server's initial memory file system based on the driver loading order.

[0038] The loading control module is used to control the loading of the hard disk device according to the initialized memory file system.

[0039] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0040] At least one processor; and

[0041] A memory communicatively connected to the at least one processor; wherein,

[0042] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the loading control method for a hard disk device according to any embodiment of the present invention.

[0043] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the loading control method of the hard disk device according to any embodiment of the present invention.

[0044] The technical solution of this invention obtains physical slot information; determines the driver loading order of hard disk devices inserted into physical slots based on the physical slot information; generates an initial memory file system for the server based on the driver loading order; and controls the loading of hard disk devices based on the initial memory file system. This ensures that the server's hard disk drivers and each hard disk are loaded according to the slot order each time the operating system restarts, effectively solving the problem of drive letter drift and fixing the drive letters of hardware devices when the operating system restarts.

[0045] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0047] Figure 1 This is a flowchart of a loading control method for a hard disk device according to Embodiment 1 of the present invention;

[0048] Figure 2 This is a flowchart of another loading control method for a hard disk device provided according to Embodiment 2 of the present invention;

[0049] Figure 3 This is a flowchart of another loading control method for a hard disk device according to Embodiment 3 of the present invention;

[0050] Figure 4 This is a flowchart of another loading control method for a hard disk device according to Embodiment 4 of the present invention;

[0051] Figure 5 This is a schematic diagram of the structure of a loading control device for a hard disk device according to Embodiment 5 of the present invention;

[0052] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the loading control method for a hard disk device according to an embodiment of the present invention. Detailed Implementation

[0053] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0054] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0055] To facilitate understanding, the technical terms that may appear in this invention will be explained first.

[0056] BIOS is an abbreviation for Basic Input Output System. It is a set of programs embedded in a read-only memory (ROM) chip on the motherboard of the computer. It stores the computer's basic input and output programs, power-on self-test programs, and system startup programs.

[0057] SCSI is an abbreviation for Small Computer System Interface, which is a type of hard drive interface widely used in servers.

[0058] SMBIOS is an abbreviation for System Management BIOS, which is a uniform specification that motherboard or system manufacturers must follow to display product management information in a standard format. It stores information about computer systems and components.

[0059] UUID stands for Universally Unique Identifier. It is a name assigned to a single object to ensure that the name is unique in both time and space.

[0060] In server operation and maintenance, the drive letter of a hard drive may change with each operating system restart. This is because the order in which hard drive drivers are loaded and the hard drive scanning order are not fixed. Since Linux does not have a fixed driver loading order, hard drive initialization in Linux is a parallel and asynchronous process. Normally, hard drives are initialized sequentially according to the order in which they are recognized; however, the drive letter is determined by the order in which drivers respond after loading. Drive letter changes may occur during computer restarts, device hot-swapping, and re-recognition after a reset, making the correspondence between drive letters and physical drive bays completely unpredictable.

[0061] In related technologies, the problem of drive letter drift can be solved by setting identifiers for hard drive devices. For example, UUIDs (Universally Unique Identifiers) can be used to fix the drive letter assignment of a single hard drive when the operating system starts. Since UUIDs are the identifiers of each individual hard drive, they can only be bound to that specific hard drive. When the hard drive is replaced, this solution fails and cannot achieve the function of corresponding physical slots and drive letters.

[0062] In related technologies, udev rules can be used to alias unique device identifiers such as SERIAL_ID (the hard drive serial number defined by the hard drive manufacturer) in hard drive attributes. However, this method does not modify the hard drive device name; instead, it adds an alias while keeping the hard drive device name assigned by the kernel (real-time operating system) unchanged. It cannot modify the kernel name of the hard drive, and the problem of drive letter drift is not effectively solved. Because udev operates in user space, it only adds aliases and cannot modify the hard drive device's drive letter. If drive letter drift occurs, it will point to the wrong hard drive device.

[0063] Example 1

[0064] Figure 1 This is a flowchart illustrating a method for loading control of a hard disk device according to Embodiment 1 of the present invention. This embodiment is applicable to situations where loading control of a hard disk device is performed during the system startup phase. This method can be executed by a device for loading control of a hard disk device, which can be implemented in hardware and / or software and can be integrated into an electronic device. Figure 1 As shown, the method includes:

[0065] S110, Obtain physical slot information.

[0066] In this embodiment, since SMBIOS is a unified specification that motherboard or system manufacturers must follow to display product management information in a standard format, various DMI (Desktop Management Interface) types are defined in the SMBIOS specification. The main component of a DMI is a MIF (Management Information Format, database). This database can include information about the computer system and its components. Therefore, through DMI information, users can obtain serial numbers, computer manufacturers, serial port information, system slot information, and other system component information. Specifically, physical slot information can be the 9th DMI type defined by the SMBIOS specification.

[0067] In this embodiment, the physical slot can be a slot on a server or a hard disk controller; the physical slot on the server can be used to insert a hard disk device or a hard disk controller, etc., and the physical slot on the hard disk controller can be used to insert a hard disk device.

[0068] For example, obtaining physical slot information may include: obtaining the physical slot identifier and bus address associated with the storage in the server firmware, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots.

[0069] In this embodiment, when developing the server firmware, the physical slot identifier and bus address can be pre-stored in the server firmware according to the machine configuration.

[0070] Specifically, the physical slot identifier can be the slot number corresponding to the physical slot; the format of the physical slot identifier can be Slot(n)-(xxxx), where (n) is the slot number that matches the slot order of the physical slot; (xxxx) is the description information of the device inserted in the physical slot, for example, the description information can be SSD (Solid State Disk) information.

[0071] In this embodiment, the bus address can be a PCI (Peripheral Component Interconnect) address. If a device is inserted into a physical slot, the PCI address can be the PCI address of that device. The PCI address format can be (Segment):(Bus):(Device):(Function), where the PCI bus segment can be composed of the address space that a PCI device can directly access. In a processor system, there may be multiple host bridges, and therefore multiple PCI bus segments. Specifically, in Linux, the PCI path can be identified using bus segment:bus number:device number:function number (Bus:Device:Function).

[0072] In this embodiment, the hard disk device can be understood as a SCSI device. A hard disk controller can be configured with one or more SCSI interfaces for inserting SCSI hard disks. Specifically, in Linux, SCSI devices can be identified using the following format: Host Adapter Number: Channel Number: Target Device Number (Id): Logical Unit Number (Lun).

[0073] S120. Determine the driver loading order of the hard disk devices that have been inserted into the physical slots based on the physical slot information, and generate the server's initial memory file system based on the driver loading order.

[0074] In this embodiment, in a Linux system, the / sys file system can provide an interface between the operating system and hardware devices. For example, a script can be executed to obtain the SCSI device number and PCI path of the SCSI hard drive inserted in the current physical slot through the / sys / class / scsi_disk interface.

[0075] In this embodiment, the physical slot identifier and bus address are stored in the server firmware. When a SCSI device is inserted into a physical slot, the SCSI device number and PCI address are stored in the operating system. The server can execute a script to obtain the SCSI device number and PCI path of the SCSI hard drive inserted in the current physical slot through a configured interface. For example, the SCSI device number <host adapter number: storage bus number: target device number: logical unit number> and its corresponding PCI address <bus domain: bus number: device number: function number> are obtained from the Linux kernel. The physical slot identifier and its corresponding PCI address <bus domain: bus number: device number: function number> are obtained from the SMBIOS information. The PCI is mapped to the SCSI device number, and the SCSI devices are sorted according to the physical slot order. The dracut is used to generate an initialization memory file system (initramfs) to determine the driver loading order.

[0076] It should be noted that SCSI devices refer to hard disk devices that conform to the SCSI hard disk interface protocol. The hard disk devices in this embodiment are not limited to SCSI devices; they can also be hard disk devices conforming to other hard disk interface protocols. This invention does not impose specific limitations. For example, IDE (Integrated Drive Electronics) devices and NVME (Non-Volatile Memory Express) devices, etc.

[0077] In this embodiment, initializing the memory file system (initramfs, initram file system) can provide an environment early in the operating system startup to accomplish tasks that are difficult to perform during kernel startup. For example, dracut is an event-driven application for initializing the memory file system. dracut creates an initializing memory file system image by copying tools and files from the installed system and combining them with the dracut framework.

[0078] For example, the server can detect when a physical slot is inserted into a hard drive controller. The hard drive controller has multiple physical slots for inserting hard drives. When the server detects the hard drive controller, it can obtain the physical slot identifier and PCI address from the firmware, and also obtain the device number and PCI address corresponding to the inserted device from the operating system. The device number and slot number can be mapped using the PCI address. Since the SMBIOS specification stores physical slot information and the physical slot order, after mapping the slot number to the hard drive device, the inserted devices can be sorted according to the physical slot order. This determines the driver loading order for each hard drive device. Based on this driver loading order, a script can generate the server's initial memory file system.

[0079] S130. Load control of the hard disk device according to the initialized memory file system.

[0080] In this embodiment, when the Linux system restarts, the loading control of the hard disk device can be performed according to the initialized memory file system. This loading control of the hard disk device may include sequentially loading the hard disk device and its driver, assigning a drive letter to the hard disk device, etc.

[0081] For example, controlling the loading of a hard disk device according to the initialization memory file system may include: updating the original initialization memory file system of the server according to the initialization memory file system; sequentially loading the driver through the updated initialization memory file system and determining the drive letter of the corresponding hard disk device.

[0082] In this embodiment, the script retrieves the physical slot identifier and bus address of the associated storage in the firmware. Additionally, the script retrieves the device identifier and bus address of the currently inserted hard disk device, and determines the correspondence between the physical slot identifier and the device identifier based on the bus address. Then, it retrieves the physical slot order of the drive letter, i.e., the driver loading order, according to the slot order, and generates a driver loading script based on the driver loading order and the configured kernel interface. The configured kernel interface can be the operating system information provided by the / proc file system in Linux and the interface for user operations on the kernel. For example, the configured kernel interface includes an interface for operating the hard disk device driver, thereby controlling the kernel to load or unload the hard disk device and its driver.

[0083] The driver loading script is updated in dracut and the initialization memory file system is regenerated. The original initialization memory file system in the server is updated according to the newly generated initialization memory file system, so that the operating system is processed by the initialization memory file system at each boot stage, executes the loaded driver loading script and kernel module, loads the hard disk device and its driver according to the physical slot order in SMBIOS type 9, and assigns a drive letter.

[0084] Optionally, an initial memory file system can also be generated using the Genkernel tool; this embodiment does not impose specific restrictions on this.

[0085] This invention provides an embodiment that obtains physical slot information; determines the driver loading order of hard disk devices inserted into physical slots based on the physical slot information; generates an initial memory file system for the server based on the driver loading order; and controls the loading of hard disk devices based on the initial memory file system to solve the problem of drive letter drifting. This allows the drive letter of hardware devices to be fixed when the operating system restarts, and the purpose of fixing the kernel name can be achieved simply by storing the physical slot information and PCI address in the server firmware without recompiling the kernel.

[0086] Example 2

[0087] Figure 2 This is a flowchart of another hard disk device loading control method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further refines the step of "determining the driver loading order of hard disk devices inserted into physical slots according to the physical slot information," as follows: Figure 2 As shown, the method in this embodiment may include:

[0088] S210. Obtain the physical slot identifier and bus address associated with the storage in the server firmware, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots.

[0089] S220. When the server contains at least two hard disk controllers, determine the first sorting result of the at least two hard disk controllers according to the slot order of the server's physical slots.

[0090] In this embodiment, since the server contains at least two hard disk controllers, the server can obtain the physical slot identifiers and bus addresses of the at least two inserted hard disk controllers from the firmware; it can also obtain the device identifiers and bus addresses of the at least two inserted hard disk controllers from the operating system; the correspondence between the device identifiers and physical slot identifiers of the at least two hard disk controllers can be obtained through the bus address, and the at least two hard disk controllers can be sorted according to the physical slot order, and the loading order of the at least two hard disk controllers can be obtained based on the sorting result.

[0091] For example, determining the first sorting result of at least two hard disk controllers based on the slot order of the server's physical slots may include: obtaining the device identifier and bus address of the hard disk controllers already inserted in the server's physical slots; matching the physical slot identifier and bus address of the associated storage with the bus address of each hard disk controller to determine a first correspondence between the device identifier of the hard disk controller and the physical slot identifier of the server; and determining the first sorting result of at least two hard disk controllers based on the first correspondence and the slot order of the server's physical slots.

[0092] For example, the device identifiers a and b of the two inserted hard drive controllers can be obtained from the operating system, along with the PCI address n corresponding to device identifier a and the PCI address m corresponding to device identifier b. The physical slot identifier x corresponding to PCI address n and the physical slot identifier y corresponding to PCI address m can be obtained from the firmware. Based on the PCI addresses, a mapping between device identifier a and physical slot identifier x, and between device identifier b and physical slot identifier y, can be established. This forms the first mapping between the device identifiers of each hard drive controller and the physical slot identifiers of the server. If the slot order of the server's physical slots is x before y, then the hard drive controller with device identifier a will be listed before the hard drive controller with device identifier b.

[0093] S230. Based on the first sorting result and the slot order of each hard disk controller's physical slot, determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller.

[0094] For example, determining the second sorting result of hard disk devices inserted into the physical slots of the hard disk controller based on the first sorting result and the slot order of each physical slot of the hard disk controller may include: obtaining the device identifier and bus address of the hard disk devices inserted in the physical slots of the hard disk controller; matching the physical slot identifier and bus address of the associated storage with the bus address of the hard disk devices to determine a second correspondence between the device identifier of the hard disk devices and the physical slot identifier of the hard disk controller; and determining the second sorting result of hard disk devices inserted into the physical slots of the hard disk controller based on the first sorting result, the second correspondence, and the slot order of the physical slots of the hard disk controller.

[0095] For example, the device identifiers of the hard drives already inserted on the hard drive controller with device identifier 'a' can be obtained from the operating system, including 'o', 'p', and 'q', with PCI addresses 'r', 's', and 't', respectively. The physical slot identifiers u (corresponding to PCI address 'r'), v (corresponding to PCI address 's'), and w (corresponding to PCI address 't') are obtained from the firmware. Based on the PCI addresses, a correspondence is established between device identifier 'o' and physical slot identifier u, device identifier 'p' and physical slot identifier v, and device identifier 'q' and physical slot identifier w, respectively. This constitutes the second correspondence between the device identifiers and physical slot identifiers of the hard drives already inserted on the hard drive controller with device identifier 'a'. A similar method is used to determine the second correspondence between the device identifiers and physical slot identifiers of the hard drives already inserted on the hard drive controller with device identifier 'b'.

[0096] In this embodiment, the order of hard disk devices on the hard disk controller with device identifier a and the hard disk controller with device identifier b can be determined according to the second correspondence and the slot order of the physical slots of the hard disk controller. Since the hard disk controller with device identifier a is listed before the hard disk controller with device identifier b, the second order result of the hard disk devices can be determined.

[0097] S240. Determine the driver loading order of the hard disk devices based on the second sorting result.

[0098] In this embodiment, the second sorting result of the hard disk device is used as the driver loading order of the hard disk device. For example, if the second sorting result of the hard disk device includes, from first to last: device identifier c → device identifier d → device identifier e → device identifier f → device identifier g, then the driver loading order from first to last is: driver for hard disk device with device identifier c → driver for hard disk device with device identifier d → driver for hard disk device with device identifier e → driver for hard disk device with device identifier f → driver for hard disk device with device identifier g.

[0099] S250: Generate the server's initial memory file system according to the driver loading order.

[0100] S260. Load control of the hard disk device according to the initialized memory file system.

[0101] For example, controlling the loading of a hard disk device according to the initialization memory file system may include: updating the original initialization memory file system of the server according to the initialization memory file system; sequentially loading the driver through the updated initialization memory file system and determining the drive letter of the corresponding hard disk device.

[0102] In this embodiment of the invention, when multiple hard disk controllers are inserted into physical slots of a server, a first sorting result of the hard disk controllers is determined based on the slot order of the server's physical slots. Then, a second sorting result of the hard disk devices is determined based on the first sorting result and the slot order of each hard disk controller's physical slot. Thus, the driver loading order is determined based on the second sorting result, thereby fixing the hard disk driver loading order and preventing drive letter drift. This ensures that the drive letter of the hardware devices is fixed when the operating system restarts, and the purpose of fixing the kernel name can be achieved simply by storing the physical slot information and PCI address in the server firmware without recompiling the kernel.

[0103] Example 3

[0104] Figure 3This is a flowchart of another hard disk device loading control method provided in Embodiment 3 of the present invention. Based on the above embodiments, this embodiment further refines the "determining the driver loading order of hard disk devices inserted into physical slots according to physical slot information," including: when the server contains a hard disk controller, determining a third sorting result of the hard disk devices inserted into the physical slots of the hard disk controller according to the slot order of the physical slots of the hard disk controller; and determining the driver loading order of the hard disk devices according to the third sorting result. Terms identical to those in the above embodiments are not repeated here. Correspondingly, as... Figure 3 As shown, the method in this embodiment may include:

[0105] S310. Obtain the physical slot identifier and bus address associated with the storage in the server firmware, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots.

[0106] S320. In the case that the server contains a hard disk controller, determine the third sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller according to the slot order of the physical slots of the hard disk controller.

[0107] In this embodiment, when the server includes a hard disk controller, the device identifier and bus address of the hard disk device already inserted in the physical slot of the hard disk controller can be obtained; the device identifier of the hard disk device and the bus address of the associated storage can be matched according to the bus address of the hard disk device to determine the third correspondence between the device identifier of the hard disk device and the physical slot identifier of the hard disk controller; and the third sorting result of the hard disk devices already inserted in the physical slot of the hard disk controller can be determined according to the third correspondence and the slot order of the physical slot of the hard disk controller.

[0108] S330. Determine the driver loading order of the hard disk devices based on the third sorting result.

[0109] S340. Generate the server's initial memory file system according to the driver loading order.

[0110] S350: Load control of the hard disk device according to the initialized memory file system.

[0111] For example, controlling the loading of a hard disk device according to the initialization memory file system may include: updating the original initialization memory file system of the server according to the initialization memory file system; sequentially loading the driver through the updated initialization memory file system and determining the drive letter of the corresponding hard disk device.

[0112] In this embodiment of the invention, when a hard disk controller is inserted into a physical slot of a server, the driver loading order of the hard disk device is determined according to the slot order of the physical slot of the hard disk controller, thereby fixing the hard disk driver loading order and avoiding drive letter drift; the drive letter of the hardware device is fixed when the operating system restarts, and the kernel name can be fixed simply by storing the physical slot information and PCI address in the server firmware without recompiling the kernel.

[0113] Example 4

[0114] Figure 4 This is a flowchart of another hard disk device loading control method provided in Embodiment 4 of the present invention. This embodiment is a detailed refinement based on the above embodiments. In this embodiment, several specific optional implementation methods are given for determining the driver loading order of hard disk devices inserted into physical slots based on physical slot information. Terms that are the same as those in the above embodiments are not repeated here. Correspondingly, such as Figure 4 As shown, the method in this embodiment may include:

[0115] S401. Obtain the physical slot identifier and bus address associated with the storage in the server firmware, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots.

[0116] S402. Obtain the number of hard disk controllers that have been inserted into the physical slots of the server, and execute S403 or S410 based on the number.

[0117] S403. If the server contains at least two hard disk controllers, obtain the device identifier and bus address of the hard disk controller that has been inserted into the physical slot of the server.

[0118] S404. Match the physical slot identifier and bus address of the associated storage according to the bus address of each hard disk controller to determine the first correspondence between the device identifier of the hard disk controller and the physical slot identifier of the server.

[0119] S405. Based on the first correspondence and the slot order of the server physical slots, determine the first sorting result of at least two hard disk controllers.

[0120] S406. Obtain the device identifier and bus address of the hard disk device that has been inserted into the physical slot of the hard disk controller.

[0121] S407. Match the physical slot identifier and bus address of the associated storage with the bus address of the hard disk device to determine the second correspondence between the device identifier of the hard disk device and the physical slot identifier of the hard disk controller.

[0122] S408. Based on the first sorting result, the second correspondence, and the slot order of the physical slots of the hard disk controller, determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller.

[0123] S409. Determine the driver loading order of the hard disk devices according to the second sorting result, and execute S412.

[0124] S410. In the case that the server contains a hard disk controller, determine the third sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller according to the slot order of the physical slots of the hard disk controller.

[0125] S411. Determine the driver loading order of the hard disk devices based on the third sorting result, and execute S412.

[0126] S412. Generate the server's initial memory file system according to the driver loading order.

[0127] S413. Load control of the hard disk device according to the initialized memory file system.

[0128] This invention provides an embodiment that obtains physical slot information; determines the driver loading order of hard disk devices inserted into physical slots based on the physical slot information; generates an initial memory file system for the server based on the driver loading order; and controls the loading of hard disk devices based on the initial memory file system to solve the problem of drive letter drifting. This allows the drive letter of hardware devices to be fixed when the operating system restarts, and the purpose of fixing the kernel name can be achieved simply by storing the physical slot information and PCI address in the server firmware without recompiling the kernel.

[0129] Example 5

[0130] Figure 5 This is a schematic diagram of the structure of a loading control device for a hard disk device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes:

[0131] The slot information acquisition module 501 is used to acquire physical slot information;

[0132] The loading order determination module 502 is used to determine the driver loading order of the hard disk devices that have been inserted into the physical slots based on the physical slot information, and to generate the server's initial memory file system based on the driver loading order.

[0133] The loading control module 503 is used to control the loading of the hard disk device according to the initialized memory file system.

[0134] Optionally, the slot information acquisition module 501 includes:

[0135] The sequence acquisition unit is used to acquire the physical slot identifier and bus address associated with the storage in the firmware of the server, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the physical slots of the server and the slot order of the physical slots of the hard disk controller.

[0136] Optionally, the sequential acquisition unit includes:

[0137] The first sorting result determination subunit is used to determine the first sorting result of the at least two hard disk controllers according to the slot order of the physical slots of the server when the server contains at least two hard disk controllers;

[0138] The second sorting result determination subunit is used to determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controllers based on the first sorting result and the slot order of each physical slot of the hard disk controllers.

[0139] The loading order determination subunit is used to determine the driver loading order of the hard disk device based on the second sorting result.

[0140] Optionally, the first sorting result determines the sub-unit, specifically for:

[0141] Obtain the device identifier and bus address of the hard drive controller that has been inserted into the physical slot of the server;

[0142] Based on the bus address of each hard disk controller, the physical slot identifier and bus address of the associated storage are matched to determine the first correspondence between the device identifier of the hard disk controller and the physical slot identifier of the server.

[0143] Based on the first correspondence and the slot order of the server physical slots, the first sorting result of the at least two hard disk controllers is determined.

[0144] Optionally, the second sorting result determines the sub-unit, specifically for:

[0145] Obtain the device identifier and bus address of the hard drive device that has been inserted into the physical slot of the hard drive controller;

[0146] Based on the bus address of the hard disk device, the physical slot identifier and bus address of the associated storage are matched to determine the second correspondence between the device identifier of the hard disk device and the physical slot identifier of the hard disk controller;

[0147] Based on the first sorting result, the second correspondence, and the slot order of the physical slots of the hard disk controller, the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller is determined.

[0148] Optionally, the sequential acquisition unit includes:

[0149] The third sorting result determination subunit is used to determine the third sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller, based on the slot order of the physical slots of the hard disk controller when the server contains a hard disk controller.

[0150] The driver loading order determination subunit is used to determine the driver loading order of the hard disk device based on the third sorting result.

[0151] Optionally, the loading control module 503 includes:

[0152] The update unit is used to update the original initial memory file system of the server according to the initial memory file system;

[0153] The drive letter determination unit is used to load the driver sequentially through the updated initial memory file system and determine the drive letter of the corresponding hard disk device.

[0154] The loading control device for a hard disk device provided in this embodiment of the invention can execute the loading control method for a hard disk device provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0155] Example 6

[0156] Figure 6 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0157] like Figure 6As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0158] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0159] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a loading control method for a hard disk device.

[0160] In some embodiments, a loading control method for a hard disk device may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the loading control method for a hard disk device described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a loading control method for a hard disk device by any other suitable means (e.g., by means of firmware).

[0161] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0162] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0163] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0164] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0165] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0166] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0167] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0168] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A loading control method for a hard disk device, characterized in that, include: Obtain the physical slot identifier and bus address associated with the storage in the server firmware, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots. The driver loading order of the hard disk devices that have been inserted into the physical slots is determined based on the physical slot information, and the server's initial memory file system is generated based on the driver loading order. The loading control of the hard disk device is performed according to the initialization of the memory file system; The step of determining the driver loading order of hard disk devices inserted into physical slots based on the physical slot information includes: In the case that the server contains at least two hard disk controllers, the first sorting result of the at least two hard disk controllers is determined according to the slot order of the physical slots of the server; Based on the first sorting result and the slot order of each hard disk controller's physical slot, determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controllers; The driver loading order of the hard disk device is determined based on the second sorting result; The loading control of the hard disk device includes: Load the hard disk device and its driver in sequence, and assign a drive letter to the hard disk device.

2. The method according to claim 1, characterized in that, The step of determining the first sorting result of the at least two hard disk controllers based on the slot order of the server physical slots includes: Obtain the device identifier and bus address of the hard drive controller that has been inserted into the physical slot of the server; Based on the bus address of each hard disk controller, the physical slot identifier and bus address of the associated storage are matched to determine the first correspondence between the device identifier of the hard disk controller and the physical slot identifier of the server. Based on the first correspondence and the slot order of the server physical slots, the first sorting result of the at least two hard disk controllers is determined.

3. The method according to claim 1, characterized in that, The second sorting result for determining the hard drive devices inserted into the physical slots of the hard drive controllers based on the first sorting result and the slot order of each physical slot of the hard drive controller includes: Obtain the device identifier and bus address of the hard drive device that has been inserted into the physical slot of the hard drive controller; Based on the bus address of the hard disk device, the physical slot identifier and bus address of the associated storage are matched to determine the second correspondence between the device identifier of the hard disk device and the physical slot identifier of the hard disk controller; Based on the first sorting result, the second correspondence, and the slot order of the physical slots of the hard disk controller, the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller is determined.

4. The method according to claim 1, characterized in that, The step of determining the driver loading order of hard disk devices inserted into physical slots based on the physical slot information includes: In the case where the server contains a hard disk controller, the third sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controller is determined according to the slot order of the physical slots of the hard disk controller. The driver loading order of the hard disk device is determined based on the third sorting result.

5. The method according to any one of claims 1-4, characterized in that, The step of controlling the loading of the hard disk device according to the initialized memory file system includes: Update the original initial memory file system of the server according to the initial memory file system; The updated initial memory file system loads the drivers sequentially and determines the drive letter of the corresponding hard disk device.

6. A loading control device for a hard disk device, characterized in that, include: The slot information acquisition module is used to acquire physical slot information; The loading order determination module is used to determine the driver loading order of hard disk devices that have been inserted into physical slots based on the physical slot information, and to generate the server's initial memory file system based on the driver loading order. A loading control module is used to control the loading of the hard disk device according to the initialized memory file system; The slot information acquisition module includes: The sequence acquisition unit is used to acquire the physical slot identifier and bus address associated with the storage in the firmware of the server, as well as the slot order of the physical slots, wherein the slot order of the physical slots includes the slot order of the server physical slots and the slot order of the hard disk controller physical slots. The sequential acquisition unit includes: The first sorting result determination subunit is used to determine the first sorting result of the at least two hard disk controllers according to the slot order of the physical slots of the server when the server contains at least two hard disk controllers; The second sorting result determination subunit is used to determine the second sorting result of the hard disk devices that have been inserted into the physical slots of the hard disk controllers based on the first sorting result and the slot order of each physical slot of the hard disk controllers. The loading order determination subunit is used to determine the driver loading order of the hard disk device based on the second sorting result; The loading control of the hard disk device includes: Load the hard disk device and its driver in sequence, and assign a drive letter to the hard disk device.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the loading control method of the hard disk device according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the loading control method for the hard disk device according to any one of claims 1-5.