A method, system, device, and storage medium for setting virtual disk slot addresses.

By obtaining the controller's boot sequence number and port address from the storage server, and setting the disk extender's sequence number and virtual slot address, the problems of disk disorder and drive letter drift in the storage server are solved, improving operation and maintenance efficiency.

CN116339633BActive Publication Date: 2026-03-06INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

The use of multiple controllers in a storage server can lead to disk disorder and drive letter drifting issues. Existing technologies have complex disk alias settings and poor operability in operation and maintenance.

Method used

By obtaining the boot sequence number and first port address of the controller connected to the disk expander, the first sequence number and virtual slot address of the disk expander are set sequentially. The unique identifier of the disk is determined by the SAS address, ensuring that the virtual slot address remains unchanged when the disk position remains unchanged.

Benefits of technology

This avoids disk disorder and drive letter drift issues, improving disk operation and maintenance efficiency and operability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339633B_ABST
    Figure CN116339633B_ABST
Patent Text Reader

Abstract

This application provides a method, system, device, and storage medium for setting virtual slot addresses for disks, relating to the field of computer technology. The method includes: obtaining the boot sequence number of a controller connected to each of the disk expanders; obtaining the address of a first port of the controller to which each of the disk expanders is connected; sequentially setting the first sequence number of each disk expander according to the boot sequence number and the first port address; obtaining the SAS address of each disk; and sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address. In this way, the virtual slot addresses of the disks are set sequentially, ensuring that the virtual slot addresses of each disk are not duplicated and can serve as unique identifiers for the disks. The SAS address is related to the disk's position on the disk expander, and the virtual slot address of the disk does not change, thus avoiding disk out-of-order or disk drift problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, system, device and storage medium for setting virtual disk slot addresses. Background Technology

[0002] Storage servers are designed for specific purposes, and therefore their configurations vary. Many storage servers now contain 60 to 108 disks, and to manage more disks, storage servers require more controllers.

[0003] Using multiple controllers simultaneously can easily lead to disk disorder or disk drive letter drifting. In existing technologies, storage servers set additional aliases for each disk, and each alias needs to correspond to a disk. When replacing a disk later, the alias needs to be reset each time, resulting in poor disk maintenance operability. Summary of the Invention

[0004] This application provides a method for setting virtual slot addresses on a disk, which can avoid disk out-of-order issues and improve disk operation and maintenance efficiency.

[0005] The embodiments of this application adopt the following technical solutions:

[0006] In a first aspect, embodiments of this application provide a method for setting a disk virtual slot address, the method comprising:

[0007] Obtain the boot sequence number of the controller connected to each disk expander;

[0008] Obtain the address of the first port of the controller to which each of the disk expanders is connected;

[0009] Based on the boot sequence number and the address of the first port, the first sequence number of each disk expander is set sequentially;

[0010] Obtain the SAS addresses of each disk;

[0011] Based on the first sequence number and the SAS address, the virtual slot addresses of each disk are set sequentially.

[0012] Optionally, the step of obtaining the boot sequence number of the controller connected to each disk expander includes:

[0013] Obtain the boot sequence number of the controller determined by the motherboard;

[0014] The boot sequence number is determined based on the boot order and the PCIe port address of the controller.

[0015] Optionally, the step of sequentially setting the first sequence number of each disk expander according to the boot sequence number and the address of the first port includes:

[0016] Based on the boot sequence number, determine the first sorting order of each of the disk expanders connected to the plurality of controllers;

[0017] According to the first sorting order, the first sequence number of each disk extender connected to the same controller is set sequentially according to the address of the first port.

[0018] Optionally, the step of sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address includes:

[0019] Based on the first sequence number, a second sorting order is determined for each of the disks connected to the plurality of disk expanders;

[0020] According to the second sorting order, the virtual slot addresses of each disk connected to the same disk extender are set sequentially based on the SAS address.

[0021] Optionally, the boot order is consistent with the order of the physical slot addresses of the disk.

[0022] Optionally, the step of sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address includes:

[0023] Obtain the initial slot address of the physical slot address;

[0024] Based on the first sequence number and the SAS address, the virtual slot addresses of each disk are set sequentially, starting from the initial slot address.

[0025] Optionally, the method further includes:

[0026] When the storage server requests the allocation of disk drive letters, the disks are loaded in the order of the virtual slot addresses;

[0027] The order of the virtual slot addresses is used to assign disk drive letters.

[0028] Secondly, embodiments of this application provide a disk virtual slot address setting system, including:

[0029] The boot sequence number acquisition module is used to acquire the boot sequence number of the controller connected to each of the disk expanders;

[0030] The first port address acquisition module is used to acquire the address of the first port of each of the disk extenders;

[0031] The first sequence number acquisition module is used to sequentially set the first sequence number of each disk expander according to the boot sequence number and the address of the first port;

[0032] The disk SAS address acquisition module is used to obtain the SAS address of each disk;

[0033] The virtual slot address setting module is used to sequentially set the virtual slot address of each disk according to the first sequence number and the SAS address.

[0034] Thirdly, embodiments of this application provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of any one of the methods in the first aspect.

[0035] Fourthly, embodiments of this application provide a computer storage medium on which a program is stored, which, when executed by a processor, implements the steps of the method as described in any one of the first aspects.

[0036] This application provides a method, system, device, and storage medium for setting virtual slot addresses for disks. The method involves: obtaining the boot sequence number of the controller connected to each disk expander; obtaining the address of the first port of the controller connected to each disk expander; sequentially setting the first sequence number of each disk expander according to the boot sequence number and the address of the first port; obtaining the SAS address of each disk; and sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address. In this way, the first sequence numbers of multiple disk expanders are set sequentially, ensuring no duplication. The virtual slot addresses of the disks are also set sequentially based on the first sequence number and the SAS address, ensuring no duplication and serving as unique identifiers for each disk. Furthermore, the SAS address is related to the disk's position on the disk expander. Therefore, if the disk's position remains unchanged, the virtual slot address will not change, preventing disk reordering and disk drive letter drift issues, thus improving disk maintenance efficiency. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1A flowchart illustrating a method for setting a virtual disk slot address, provided in an embodiment of this application;

[0039] Figure 2 A schematic diagram of the virtual slot address of the disk provided in the embodiments of this application;

[0040] Figure 3 This is a schematic diagram of a disk virtual slot address setting system provided in an embodiment of this application;

[0041] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

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

[0043] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect, only for the purpose of clearly describing the technical solution of the embodiments of this application, and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated.

[0044] In the embodiments of this application, "multiple" means two or more, and "at least one" means one or more, unless otherwise explicitly specified.

[0045] In related technologies, the parallel use of multiple controllers can easily lead to disk disorder or disk drive letter drift; for example, when onboard controllers and external controllers are mixed, disk disorder may occur.

[0046] The drive letter is a relative identifier for a disk storage device. Disk disorder or drive letter drift can lead to disk system file corruption or even system crash. In addition, when a disk needs to be replaced, if the drive letter has drifted, it is impossible to directly determine the location of the disk to be replaced, which increases the difficulty of maintenance.

[0047] In Red Hat 6 (a Linux operating system) series, drivers are loaded serially. The loading order of drivers can be adjusted by changing the PCIe slot (Peripheral Component Interconnect Express) of the external controller to avoid disk loading out of order. In Red Hat 7 series and later operating systems, in order to speed up system startup, the driver loading method has been changed from serial to parallel, and the problem of drive letter drift can no longer be avoided by adjusting the PCIe slot.

[0048] The disks connected to the system have unique identifiers SERIAL_ID / WWID / PATH, where SERIAL_ID is the disk's serial number, WWID is a globally unique identifier, and PATH is the disk's path. Related technologies in the Linux operating system use Udev rules (a Linux system file management rule) to set an alias for the disk. Specifically, Udev is a mechanism used to create and name / dev device nodes corresponding to devices existing in the system. Udev uses matching information provided by sysfs (a Linux file system) and user-provided rules to dynamically add the required device nodes, and uses Udev rules to set an alias for the disk's unique identifier SERIAL_ID / WWID / PATH.

[0049] The aliases in the relevant technologies do not solve the problem of disk out-of-order. In actual use, they need to correspond one-to-one with the disk order, which is quite complicated. Furthermore, when replacing a disk later, the disk and the alias need to be re-bound one by one, which makes the operation and maintenance difficult.

[0050] Based on this, embodiments of this application provide a method for setting virtual disk slot addresses, referring to... Figure 1 The methods include:

[0051] Step S101: Obtain the boot sequence number of the controller connected to each disk expander;

[0052] The disk virtual slot address setting method provided in this application embodiment can be applied to the firmware (FW) of a disk extender.

[0053] Firmware is the driver for the disk expander, and the operating system of the storage server drives the disk expander through firmware.

[0054] In this embodiment, multiple disk extenders share a single firmware, which controls all disk controllers and can then set the virtual slot addresses of the disks connected to all disk controllers.

[0055] The virtual disk slot address set in the firmware cannot be modified by the storage server, and the virtual disk slot address will not change due to operations such as starting the storage server.

[0056] In this embodiment of the application, the storage server can be connected to at least one controller, which is used to manage multiple disks.

[0057] The storage server's motherboard and controller are connected via PCIe ports. PCIe is a high-speed serial computer expansion bus standard, and PCIe ports are ports that use the PCIe standard. The storage server's motherboard and controller transmit data through PCIe ports.

[0058] Among them, the motherboard includes a CPLD (Complex Programming Logic Device) motherboard, which is a digital integrated circuit in which the user constructs the logic functions according to their own needs.

[0059] The controller can be a SAS card (Serial Attached SCSI), which supports various types of disks. SCSI (Small Computer System Interface) is an interface standard between a computer and external devices.

[0060] When a storage server is connected to at least two controllers, the storage server needs to boot the controllers in a certain order. For example, the storage server is connected to two controllers, controller A and controller B, and boot sequence numbers are set for the two controllers.

[0061] For example, if the boot sequence number of controller A is set to 1 and the boot sequence number of controller B is set to 2, and controller A is booted first and then controller B is booted, controller A can be called controller 1 and controller B can be called controller 2.

[0062] For example, if the boot sequence number of controller A is set to 2 and the boot sequence number of controller B is set to 1, and controller B is booted first and then controller A is booted, controller B can be called controller 1 and controller A can be called controller 2.

[0063] Among them, bootstrapping is loading. The controller that is booted first is the one that the storage server loads first. During the startup process of the storage server, each controller is automatically booted.

[0064] In some embodiments, the CPLD motherboard of the storage server is used to set the boot sequence number for the controller.

[0065] In this embodiment of the application, the firmware of the disk extender obtains the controller's boot sequence number from the storage server.

[0066] The controller has at least one first port, which is connected to a disk extender via a connection cable. For example, a controller may have two first ports, C0 Port and C1 Port, each connected to a disk extender.

[0067] In this embodiment of the application, the disk expander includes at least one disk slot, and the disk expander defines or manages the slot through a virtual slot address;

[0068] For example, a disk expander includes 15 disk slots, and the virtual slot addresses can be 0-14 sequentially, or the virtual slot addresses can be modified to 1-15 or 16-30;

[0069] For example, a disk expander may have 10 disk slots, with virtual slot addresses ranging from 0 to 9.

[0070] Step S102: Obtain the address of the first port of the controller to which each disk expander is connected.

[0071] In this embodiment, the first port is the port of the controller, and the controller is connected to the disk extender through the first port.

[0072] The firmware can obtain the address of the first port of the controller to which the disk extender is connected.

[0073] In some embodiments, a controller has two first ports, namely C0 Port and C1 Port, each port being connected to a disk extender; in other embodiments, a controller has four first ports, namely C0 Port, C1 Port, C2 Port and C3 Port.

[0074] For example, disk extender A is connected to port C0, and disk extender B is connected to port C1; the firmware obtains the address of port C0 to which disk extender A is connected, and the address of port C1 to which disk extender B is connected.

[0075] Step S103: Set the first sequence number of each disk expander in sequence according to the boot sequence number and the address of the first port.

[0076] In this embodiment, the disk extenders connected to the controller are first determined according to the boot sequence number. For example, the boot sequence number of controller A is 1 and the boot sequence number of controller B is 2. The disk extenders connected to controller A are sorted first, and then the disk extenders connected to controller B are sorted. In this way, the first sequence number of the disk extender connected to controller A is before the first sequence number of the disk extender connected to controller B.

[0077] For example, controller A and controller B are each connected to two disk expanders. First, the disk expanders connected to controller A are sorted, and their serial numbers are 1 and 2. Then, the disk expanders connected to controller B are sorted, and their serial numbers are 3 and 4.

[0078] In this embodiment, disk extenders connected to the same controller are sorted by the address of the first port.

[0079] For example, first sort the controller A. The first sequence number of disk extender A connected to the C0 port of controller A is 1, which is called disk extender 1. The first sequence number of disk extender B connected to the C1 port of controller A is 2, which is called disk extender 2.

[0080] After disk extenders A and B connected to controller A are sorted, the disk extenders C and D connected to controller B corresponding to the next boot sequence number are sorted according to the first sorting order. For example, the first sequence number of disk extender C connected to controller B's C0 port is 3, which is called disk extender 3, and the first sequence number of disk extender D connected to controller B's C1 port is 4, which is called disk extender 4.

[0081] Step S104: Obtain the SAS address of each disk.

[0082] In this application embodiment, the disk includes a hard disk, for example, a solid state drive (SSD), a hybrid hard drive (HHD), and a traditional hard disk drive (HDD).

[0083] In this embodiment, the disk is connected to the disk slot of the disk expander. The SAS (Serial Attached SCSI) address of the disk indicates the position of the disk on the disk expander. The SAS address of the disk will not change if the position of the disk does not change.

[0084] In this embodiment of the application, the disk expander has an initial virtual slot address. Taking a disk expander with 15 slots as an example, the initial virtual slot address of each disk controller is 0-14. One SAS address corresponds to one initial virtual slot address. However, when the initial virtual slot address changes, the SAS address of the disk will not change. Therefore, the location of the disk in the disk expander can be accurately obtained through the SAS address of the disk.

[0085] The SAS address of the disk can be queried using SAS address lookup commands, such as the sg_ses command.

[0086] Step S105: Set the virtual slot address of each disk in sequence according to the first serial number and SAS address.

[0087] In this embodiment of the application, the disks connected to the disk expander are first determined according to the first sequence number. In this embodiment of the application, the second sorting order is first determined according to the first sequence number. For example, the first sequence number of disk expander 1 is 1 and the first sequence number of disk expander 2 is 2. The disks connected to disk expander 1 are sorted first, and then the disks connected to disk expander 2 are sorted. In this way, the virtual slot address of the disk connected to disk expander 1 is before the virtual slot address of the disk connected to disk expander 2.

[0088] For example, disk extenders 1, 2, 3, and 4 each connect to 15 disks. First, the disk extenders connected to disk extender 1 are sorted, with virtual slot addresses 1-15. Then, the disk extenders connected to disk extenders 2, 3, and 4 are sorted, with virtual slot addresses 16-30 for disk extender 2, 31-45 for disk extender 3, and 46-60 for disk extender 4.

[0089] In this embodiment, disks connected to the same disk extender are sorted by SAS address.

[0090] For example, refer to Figure 2 Example, reference Figure 2 The virtual slot addresses of the disks connected to disk expander 1 are set to 1-15, the virtual slot addresses of the disks connected to disk expander 2 are set to 16-30, the virtual slot addresses of the disks connected to disk expander 3 are set to 31-45, and the virtual slot addresses of the disks connected to disk expander 4 are set to 46-60.

[0091] In this embodiment, the virtual slot address of the disk is determined based on the first sequence number and the SAS address. The SAS address is related to the position of the disk on the disk extender. Thus, the virtual slot address of the disk will not change if the position of the disk does not change.

[0092] When a disk needs to be replaced, for example, a disk with virtual slot address 4 is replaced. The SAS address of the replaced disk is the same as that of the original disk, and the virtual slot address of the replaced disk remains 4.

[0093] In some embodiments, all disk expanders are mounted on a chassis. The chassis labels the disk slots of all disk controllers with serial numbers in a specific order, such as by silkscreen printing or inscription, next to the disk slots. These labels can be visually identified; these serial numbers are called physical slot addresses. For example, with four disk expanders, each containing 15 slots, the physical slot addresses are typically numbered from 1 to 60 sequentially next to the disk slots.

[0094] Physical slot addresses and virtual slot addresses are different: Virtual slot addresses are set by the firmware of the disk controller, and can be changed through firmware. The storage server can directly obtain the virtual slot address through commands. Physical slot addresses are fixed serial numbers set on the chassis and will not change due to firmware or disk movement. The storage server cannot directly obtain the physical slot address.

[0095] The kernel device manager (Udev) is a feature in Linux systems and is the default device management tool in current Linux systems. The kernel device manager (Udev) assigns drive letters to disks according to the disk loading order, typically in the order SDA, SDB, SDC, etc.

[0096] Disk loading is performed through the firmware of the disk extender. The disk extender's firmware can load disks sequentially according to the order of virtual slot addresses. Thus, the disk loading order of the kernel device manager (Udev) is the same as the order of virtual slot addresses. The kernel device manager (Udev) assigns drive letters to the disks according to the order of virtual slot addresses. For example, the disk with virtual slot address 1 is assigned the drive letter SDA, the disk with virtual slot address 2 is assigned the drive letter SDB, and so on. The drive letter will not change if the virtual slot address remains unchanged.

[0097] In this embodiment, the disk virtual slot address set in the firmware cannot be modified by the storage server. The disk virtual slot address will not change due to operations such as starting the storage server. Consequently, the disk drive letter allocated according to the order of the virtual slot address will not change due to operations on the storage server side, thus avoiding the disk drive letter drifting problem caused by the shutdown or startup of the storage server.

[0098] The disk virtual slot address setting method provided in this application embodiment obtains the boot sequence number of the controller connected to each disk expander; sequentially sets the address of the first port connected to each disk expander; obtains the first sequence number of each disk expander based on the boot sequence number and the address of the first port; obtains the SAS address of each disk; and sequentially sets the virtual slot address of each disk based on the first sequence number and the SAS address. In this way, the first sequence numbers of multiple disk expanders are set sequentially, ensuring that the first sequence numbers of each disk expander are unique. The virtual slot addresses of the disks are also set sequentially based on the first sequence number and the SAS address, ensuring that the virtual slot addresses of each disk are unique and can serve as unique identifiers for the disks. Furthermore, the SAS address is related to the disk's position on the disk expander. Therefore, if the disk's position does not change, the virtual slot address of the disk will not change, preventing disk out-of-order issues and disk drive letter drift problems, thus improving disk operation and maintenance efficiency.

[0099] Optionally, step S101 involves obtaining the boot sequence number of the controller connected to each disk expander, including:

[0100] Obtain the boot sequence number of the controller determined by the motherboard based on the boot order;

[0101] The boot sequence number is determined based on the boot order and the PCIe port address of the controller.

[0102] In this embodiment of the application, the motherboard includes a CPLD (Complex Programming Logic Device) motherboard.

[0103] Among them, the CPLD motherboard is a digital integrated circuit in which users construct logic functions according to their own needs.

[0104] The storage server's motherboard and controller are connected via PCIe ports. PCIe is a high-speed serial computer expansion bus standard, and PCIe ports are ports that use the PCIe standard. The storage server's motherboard and controller transmit data through PCIe ports.

[0105] Each PCIe port has a unique address, and the connection location of the controller can be determined based on the controller's PCIe port address. For example, the PCIe port address can be the PCIe port number. For instance, if controller A is connected to PCIe port C0 and controller B is connected to PCIe port C1, the PCIe port address of controller A can be C0, and the PCIe port address of controller B can be C1.

[0106] The default boot order is the order in which the port addresses are incremented. For example, controller A connected to PCIe C0 port is booted first, and then controller B connected to PCIe C1 port is booted. The boot sequence number of controller A is 1, and the boot sequence number of controller B is 2.

[0107] Alternatively, the boot order can be changed. For example, the boot order can be changed to a sequence number that decreases from the port address. For instance, controller B connected to PCIe C1 port can be booted first, followed by controller A connected to PCIe C0 port; the boot sequence number of controller B is 1, and the boot sequence number of controller A is 2.

[0108] In some embodiments, the boot order is consistent with the physical order of the disk slots to which the controller is connected. For example, the physical slot numbers of the slots to which controller A is connected are 1-30, while the physical slot numbers of the slots to which controller B is connected are 31-60. The boot order of controller A can be set to 1 and the boot order of controller B can be set to 2 in the motherboard. In this way, the virtual slot number of the disk to which controller A is connected is between the virtual slot numbers of the disk to which controller B is connected, which can ensure that the order of the virtual slot numbers is consistent with the order of the physical slot numbers.

[0109] The disk virtual slot address setting method provided in this application embodiment obtains the boot sequence number of the controller connected to each disk expander, including: obtaining the boot sequence number of the controller determined by the motherboard; wherein, the boot sequence number is determined based on the PCIe port address of the controller. This allows for the sorting of multiple controllers, preventing multiple disks connected to multiple controllers from having the same virtual slot number, and ensuring that the virtual slot address of the disk serves as the unique identifier of the disk.

[0110] Optionally, in step S103, the first sequence number of the disk expander is set sequentially according to the boot sequence number and the address of the first port, including:

[0111] S1031, determine the first sorting order of each disk expander connected to multiple controllers based on the boot sequence number;

[0112] In this embodiment, the disk extenders connected to the controller are first determined according to the boot sequence number. For example, the boot sequence number of controller A is 1 and the boot sequence number of controller B is 2. The disk extenders connected to controller A are sorted first, and then the disk extenders connected to controller B are sorted. In this way, the first sequence number of the disk extender connected to controller A is before the first sequence number of the disk extender connected to controller B.

[0113] Specifically, the first sorting order is the sorting order of the multiple disk expanders connected to the controller. For example, controller A connects to disk expander A and disk expander B, and controller B connects to disk expander C and disk expander D. The first sequence number of controller A is 1, and the first sequence number of controller B is 2. The first sorting order is to sort disk expanders A and B first, and then sort disk expanders C and D.

[0114] S1032, according to the first sorting order, set the first sequence number of each disk extender connected to the same controller in sequence according to the address of the first port.

[0115] For example, first sort the controller A. The first sequence number of disk extender A connected to the C0 port of controller A is 1, which is called disk extender 1. The first sequence number of disk extender B connected to the C1 port of controller A is 2, which is called disk extender 2.

[0116] After disk extenders A and B connected to controller A are sorted, the disk extenders C and D connected to controller B corresponding to the next boot sequence number are sorted according to the first sorting order. For example, the first sequence number of disk extender C connected to controller B's C0 port is 3, which is called disk extender 3, and the first sequence number of disk extender D connected to controller B's C1 port is 4, which is called disk extender 4.

[0117] The disk virtual slot address setting method provided in this application embodiment sets the first sequence number of the disk expander sequentially according to the boot sequence number and the address of the first port. This includes: determining a first sorting order of the disk expanders connected to multiple controllers based on the boot sequence number; and sequentially setting the first sequence number of each disk expander connected to the same controller according to the address of the first port, following the first sorting order. In this way, according to the first sorting order, the first sequence number of the disk expander with the earlier boot sequence number is first, and the first sequence number of the disk expander with the later boot sequence number is last. This avoids the first sequence number of multiple disk expanders connected to multiple controllers being the same, thereby avoiding duplicate virtual slot addresses for multiple disks and ensuring that the virtual slot address of the disk serves as a unique identifier for the disk.

[0118] Optionally, in step S105, the virtual slot addresses of each disk are set sequentially according to the first sequence number and the SAS address, including:

[0119] S1051, determine the second sorting order of each disk connected to the multiple disk expanders according to the first sequence number.

[0120] In this embodiment of the application, the second sorting order is first determined according to the first sequence number. For example, the first sequence number of disk expander 1 is 1 and the first sequence number of disk expander 2 is 2. The disks connected to disk expander 1 are sorted first, and then the disks connected to disk expander 2 are sorted. In this way, the virtual slot address of the disk connected to disk expander 1 is before the virtual slot address of the disk connected to disk expander 2.

[0121] For example, disk extenders 1, 2, 3, and 4 each connect to 15 disks. First, the disk extenders connected to disk extender 1 are sorted, with virtual slot addresses 1-15. Then, the disk extenders connected to disk extenders 2, 3, and 4 are sorted, with virtual slot addresses 16-30 for disk extender 2, 31-45 for disk extender 3, and 46-60 for disk extender 4.

[0122] S1052, according to the second sorting order, set the virtual slot addresses of each disk connected to the same disk extender in sequence based on the SAS address.

[0123] For example, refer to Figure 2 The virtual slot addresses of the disks connected to disk expander 1 are set to 1-15, the virtual slot addresses of the disks connected to disk expander 2 are set to 16-30, the virtual slot addresses of the disks connected to disk expander 3 are set to 31-45, and the virtual slot addresses of the disks connected to disk expander 4 are set to 46-60.

[0124] Optionally, based on the first sequence number and the SAS address, the virtual slot addresses of each disk are set sequentially, including: determining the second sorting order of the disks connected to multiple disk expanders based on the first sequence number; and setting the virtual slot addresses of the disks connected to the same disk expander sequentially according to the second sorting order and their SAS addresses. This ensures that the virtual slot address of the disk with the first sequence number comes first, preventing multiple disks connected to multiple disk expanders from having identical virtual slot addresses, and guaranteeing that the virtual slot address serves as a unique identifier for the disk.

[0125] Optionally, the boot order can be consistent with the order of the physical slot addresses on the disk.

[0126] The boot order is consistent with the physical order of the disk slots connected to the controller. For example, the physical slot numbers of the slots connected to controller A are 1-30, while the physical slot numbers of the slots connected to controller B are 31-60. The boot order is the PCIe address order from controller A to controller B. The boot number of controller A can be set to 1 and the boot number of controller B can be set to 2 in the motherboard.

[0127] For example, if the physical slot number of the slot connected to controller A is 31-60, and the physical slot number of the slot connected to controller B is 1-30, and the boot order is the PCIe address order from controller B to controller A, the boot number of controller A can be set to 2 and the boot number of controller B to 1 in the motherboard.

[0128] In this way, the virtual slot number of the disk connected to controller A is between the virtual slot numbers of the disk connected to controller B, which can ensure that the order of the virtual slot numbers is consistent with the order of the physical slot numbers, facilitating subsequent disk maintenance.

[0129] Optionally, in step S105, the virtual slot addresses of each disk are set sequentially according to the first sequence number and the SAS address, including:

[0130] Get the initial slot address of the physical slot;

[0131] Based on the first sequence number and SAS address, set the virtual slot addresses of each disk sequentially, starting from the initial slot address.

[0132] The initial slot address of the physical slot address is the first slot address in sequence. In some embodiments, the initial slot address is 1, and in other embodiments, the initial slot address is 0.

[0133] In this embodiment, the virtual slot addresses of each disk are set sequentially starting from the initial slot address. In this way, the initial slot address of the virtual slot address is the same as the initial slot address of the physical slot address. Furthermore, since the boot order and the physical slot number order of the disks connected to the controller are consistent, the virtual slot address and the physical slot address are the same.

[0134] The disk virtual slot address setting method provided in this application embodiment sets the virtual slot address of each disk sequentially according to a first sequence number and SAS address, including: obtaining the initial slot address of the physical slot; and setting the virtual slot address of each disk sequentially starting from the initial slot address according to the first sequence number and SAS address. In this way, the initial slot address of the virtual slot address is the same as the initial slot address of the physical slot address. Furthermore, since the boot order and the physical slot number order of the disks connected to the controller are consistent, the virtual slot address and the physical slot address are identical. The system can query the virtual slot address of the disk requiring maintenance, and directly determine the disk requiring maintenance on the physical slot address based on the virtual slot address, thus improving the efficiency and operability of disk maintenance.

[0135] Optionally, the method also includes:

[0136] When the storage server requests disk drive letters, the disks are loaded in the order of their virtual slot addresses.

[0137] The order of virtual slot addresses is used to assign disk drive letters.

[0138] The kernel device manager (Udev) is a feature in Linux systems and is the default device management tool in current Linux systems. The kernel device manager (Udev) assigns drive letters to disks according to the disk loading order, typically in the order SDA, SDB, SDC, etc.

[0139] Disk loading is performed through the firmware of the disk extender. The disk extender's firmware can load disks sequentially according to the order of virtual slot addresses. Thus, the disk loading order of the kernel device manager (Udev) is the same as the order of virtual slot addresses. The kernel device manager (Udev) assigns drive letters to the disks according to the order of virtual slot addresses. For example, the disk with virtual slot address 1 is assigned the drive letter SDA, the disk with virtual slot address 2 is assigned the drive letter SDB, and so on. The drive letter will not change if the virtual slot address remains unchanged.

[0140] In this embodiment, the disk virtual slot address set in the firmware cannot be modified by the storage server. The disk virtual slot address will not change due to operations such as starting the storage server. Consequently, the disk drive letter allocated according to the order of the virtual slot address will not change due to operations on the storage server side, thus avoiding the disk drive letter drifting problem caused by the shutdown or startup of the storage server.

[0141] The disk virtual slot address setting method provided in this application loads each disk according to the order of its virtual slot addresses when the storage server requests disk drive letter allocation; the order of the virtual slot addresses is used to allocate disk drive letters. In this way, the virtual slot addresses of each disk will not be duplicated, can be used as unique identifiers of the disks, and the virtual slot addresses of the disks will not change, and the disk drive letters allocated according to the virtual slot addresses of the disks will not drift.

[0142] This application provides a disk virtual slot address setting system, referring to... Figure 3 ,include:

[0143] The boot sequence number acquisition module 301 is used to acquire the boot sequence number of the controller connected to each disk expander;

[0144] The first port address acquisition module 302 is used to acquire the address of the first port of the controller to which each disk expander is connected;

[0145] The first sequence number acquisition module 303 is used to sequentially set the first sequence number of each disk expander according to the boot sequence number and the address of the first port;

[0146] The disk SAS address acquisition module 304 is used to acquire the SAS address of each disk;

[0147] The virtual slot address setting module 305 is used to set the virtual slot address of each disk in sequence according to the first sequence number and the SAS address.

[0148] The disk virtual slot address setting system provided in this application embodiment obtains the boot sequence number of the controller connected to each disk expander; obtains the address of the first port of the controller connected to each disk expander; obtains the address of the first port of the controller connected to each disk expander; sets the first sequence number of each disk expander sequentially according to the boot sequence number and the address of the first port; obtains the SAS address of each disk; and sets the virtual slot address of each disk sequentially according to the first sequence number and the SAS address. In this way, the first sequence numbers of multiple disk expanders are set sequentially, ensuring that the first sequence numbers of each disk expander are unique. The virtual slot addresses of the disks are also set sequentially according to the first sequence number and the SAS address, ensuring that the virtual slot addresses of each disk are unique and can serve as unique identifiers for the disks. Furthermore, the SAS address is related to the disk's position on the disk expander. Therefore, if the disk's position does not change, the virtual slot address of the disk will not change, preventing disk out-of-order issues and disk drive letter drift problems, thus improving disk operation and maintenance efficiency.

[0149] Optionally, the boot sequence number acquisition module 301 includes:

[0150] The boot sequence number receiving submodule is used to obtain the boot sequence number of the controller determined by the motherboard;

[0151] The boot sequence number is determined based on the boot order and the PCIe port address of the controller.

[0152] The first sequence number acquisition module 303 includes:

[0153] The first sorting submodule is used to determine the first sorting order of each disk expander connected to multiple controllers based on the boot sequence number;

[0154] The second sorting submodule is used to sequentially set the first sequence number of each disk extender connected to the same controller according to the address of the first port, following the first sorting order.

[0155] The virtual slot address setting module 305 includes:

[0156] The third sorting submodule is used to determine the second sorting order of the disks connected by the multiple disk expanders based on the first sequence number;

[0157] The fourth sorting submodule is used to sequentially set the virtual slot addresses of each disk connected to the same disk extender according to the second sorting order and the SAS address.

[0158] Optionally, the boot order can be consistent with the order of the physical slot addresses on the disk.

[0159] Optionally, the virtual slot address setting module 305 includes:

[0160] The initial slot address acquisition submodule is used to obtain the initial slot address of the physical slot address;

[0161] The Virtual Slot Address Setting Submodule is used to sequentially set the virtual slot addresses of each disk, starting from the initial slot address, based on the first sequence number and the SAS address.

[0162] Optionally, the system may also include:

[0163] The virtual slot address sending module is used to load each disk in the order of virtual slot addresses when the storage server requests the allocation of disk drive letters;

[0164] The order of virtual slot addresses is used to assign disk drive letters.

[0165] This application provides a computer device, which is described in the embodiments of the present application. Figure 4 It includes a memory 401, a processor 402, and a computer program stored in the memory and executable on the processor. When the processor 402 executes the computer program, it implements any of the above-mentioned steps of the disk virtual slot address setting method.

[0166] The computer device provided in this application embodiment uses a processor 402 to execute the following steps: obtaining the boot sequence number of the controller connected to each disk expander; obtaining the address of the first port of the controller connected to each disk expander; obtaining the first sequence number of each disk expander based on the boot sequence number and the first port address; obtaining the SAS address of each disk; and sequentially setting the virtual slot address of each disk based on the first sequence number and the SAS address. In this way, the first sequence numbers of multiple disk expanders are set sequentially, ensuring that the first sequence numbers of each disk expander are unique. The virtual slot addresses of the disks are also set sequentially based on the first sequence number and the SAS address, ensuring that the virtual slot addresses of each disk are unique and can serve as unique identifiers for the disks. Furthermore, the SAS address is related to the disk's position on the disk expander. Therefore, if the disk's position does not change, the virtual slot address of the disk will not change, preventing disk reordering and disk drive letter drifting problems, thus improving disk operation and maintenance efficiency.

[0167] This application provides a computer-readable storage medium storing a program that, when executed by processor 402, performs the steps of the disk virtual slot address setting method described above.

[0168] The computer-readable storage medium provided in this application embodiment, through processor 402, executes the following steps: obtaining the boot sequence number of the controller connected to each disk expander; obtaining the address of the first port of the controller connected to each disk expander; sequentially setting the first sequence number of each disk expander according to the boot sequence number and the first port address; obtaining the SAS address of each disk; and sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address. In this way, the first sequence numbers of multiple disk expanders are set sequentially, ensuring that the first sequence numbers of each disk expander are unique. The virtual slot addresses of the disks are also set sequentially according to the first sequence number and the SAS address, ensuring that the virtual slot addresses of each disk are unique and can serve as unique identifiers for the disks. Furthermore, the SAS address is related to the disk's position on the disk expander. Therefore, if the disk's position does not change, the virtual slot address of the disk will not change, preventing disk out-of-order issues and disk drive letter drift problems, thus improving disk operation and maintenance efficiency.

[0169] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. 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 various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0170] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for setting a virtual slot address of a magnetic disk, characterized by, The method comprises the following steps: obtaining a boot sequence number of a controller connected to each disk expander; obtaining an address of a first port of the controller connected to each disk expander; sequentially setting a first sequence number of each disk expander according to the boot sequence number and the address of the first port; obtaining a SAS address of each disk; sequentially setting a virtual slot address of each disk according to the first sequence number and the SAS address; the step of sequentially setting the first sequence number of each disk expander according to the boot sequence number and the address of the first port comprises: determining a first sorting order of each disk expander connected to a plurality of controllers according to the boot sequence number; sequentially setting the first sequence number of each disk expander connected to the same controller according to the address of the first port in the first sorting order; the step of sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address comprises: determining a second sorting order of each disk connected to a plurality of disk expanders according to the first sequence number; sequentially setting the virtual slot address of each disk connected to the same disk expander according to the SAS address in the second sorting order.

2. The method of claim 1, wherein, The step of obtaining the boot sequence number of the controller connected to each disk expander comprises: obtaining a boot sequence number of the controller determined by a mainboard; wherein the boot sequence number is determined according to a booting order and a PCIE port address of the controller.

3. The method of claim 1, wherein: the booting order is consistent with an order of a physical slot address of the disk.

4. The method of claim 3, wherein, The step of sequentially setting the virtual slot address of each disk according to the first sequence number and the SAS address comprises: obtaining an initial slot address of the physical slot address; sequentially setting the virtual slot address of each disk from the initial slot address according to the first sequence number and the SAS address.

5. The method of claim 1, wherein, The method further comprises: loading each disk in the order of the virtual slot address when a storage server requests to allocate a disk drive letter; the order of the virtual slot address is used to allocate the disk drive letter.

6. A magnetic disk virtual slot address setting system characterized by comprising: The method comprises: a boot sequence number obtaining module, configured to obtain a boot sequence number of a controller connected to each disk expander; a first port address obtaining module, configured to obtain an address of a first port of the controller connected to each disk expander; a first sequence number obtaining module, configured to sequentially set a first sequence number of each disk expander according to the boot sequence number and the address of the first port; a disk SAS address obtaining module, configured to obtain a SAS address of each disk; a virtual slot address setting module, configured to sequentially set a virtual slot address of each disk according to the first sequence number and the SAS address; the first sequence number obtaining module comprises: a first sorting sub-module, configured to determine a first sorting order of each disk expander connected to a plurality of controllers according to the boot sequence number; the virtual slot address setting module comprises: The third sorting sub-module is configured to determine a second sorting sequence of the disks connected to the disk expander according to the first serial numbers. The fourth sorting sub-module is configured to set virtual slot addresses of the disks connected to the same disk expander in sequence according to the SAS addresses according to the second sorting sequence.

7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that: The computer readable storage medium stores the program, and the processor executes the program to implement the steps of the method in any one of claims 1-5.

Citation Information

Patent Citations

  • Method for fixing mapping relationships between disk slot position numbers and disk identifiers

    CN107239231A

  • Apparatus and method for managing a plurality of kinds of storage devices

    US20060155928A1