Disk scanning method and computing device
Through the serial scanning method of hard disk backplane or RAID card configuration information, the disk letter drift caused by inconsistent disk recognition order when the operating system is started is solved, ensuring the consistency of disk recognition, and improving system stability and user experience.
Patent Information
- Application Number
- CN202411392102.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-10
AI Technical Summary
During the startup process, the disk letter drift problem caused by inconsistent disk recognition order, resulting in the disk being unable to be correctly identified, affecting the software operation and data security.
Through the configuration information of the hard disk backplane or RAID card, multiple disks are identified by serial scanning to ensure that the disk order is consistent every time the disk is booted and avoid disk letter drifting.
It can prevent disk letters from drifting during the operating system startup without manual intervention, improve the accuracy of disk recognition and system stability, and is suitable for different disk connection methods.
Smart Images

Figure CN119292530A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of server technology, and in particular to a disk scanning method and computing device. Background Art
[0002] The operating system is the basic system software in a computing device, responsible for managing and coordinating the interaction between the hardware resources and software resources of the computing device. The operating system has multiple disks, and during the startup process, it will assign drive letters to multiple disks based on the order in which the disks are identified. Taking the Linux system as an example, the drive letters assigned to multiple disks by the Linux system are / dev / sda, / dev / sdb, and / dev / sdc.
[0003] At present, during each boot process, the operating system uses parallel scanning to identify multiple disks. As a result, the order in which the operating system identifies the same disk may be different, and the drive letters assigned to the same disk may also be inconsistent. For example, during the boot process of the Linux system, the drive letter assigned to Disk A may be / dev / sdb, and during the restart process, the drive letter assigned to Disk A may become / dev / sde, and the drive letter drift phenomenon occurs.
[0004] Drive letter drifting can cause the original drive letter of the disk to become a new drive letter, and the disk recognized by the operating system through the new drive letter is not the disk corresponding to the original drive letter. For example, in the Linux system, the original drive letter of Disk A is / dev / sdb, and the original drive letter of Disk B is / dev / sde. During the restart process, the drive letter of Disk A changes to the new drive letter / dev / sde. At this time, the disk recognized by the Linux system through the new drive letter / dev / sde is Disk B, not Disk A. That is, the operating system cannot correctly identify the disk. If the disk stores the configuration of specific software, it will cause the specific software to fail to run correctly, or the data recognized by the wrong disk will cause data security risks to the specific software. Summary of the invention
[0005] The embodiment of the present application provides a disk scanning method and computing device, which can achieve the purpose of preventing drive letter drift during the startup of an operating system. The technical solution is as follows.
[0006] In a first aspect, a disk scanning method is provided, which is applied to an out-of-band controller, and the method includes:
[0007] When the computing device is started, the configuration information of multiple disks in the computing device is determined based on the configuration information of the hard disk backplane or the configuration information of the disk array RAID card, and the configuration information of the disk includes the pass-through configuration and the RAID card configuration; if the configuration information of the multiple disks is only the pass-through configuration, or only one RAID card configuration, the multiple disks are scanned in a serial scanning manner; if the configuration information of the multiple disks includes multiple configurations, each of the multiple configurations is scanned in sequence, wherein when scanning each of the multiple configurations in sequence, after the disk scan of the current configuration is completed, the next configuration is scanned, and for each configuration, the disk of each configuration is scanned in a serial scanning manner. Wherein, the multiple configurations include at least two RAID card configurations, or at least one RAID card configuration and a pass-through configuration.
[0008] In an embodiment of the present application, when the computing device is turned on, the configuration information of multiple disks of the computing device can be identified through the configuration information of the hard disk backplane or the configuration information of the RAID card. Based on whether the configuration information of the multiple disks is only a straight-through configuration, only one RAID configuration, at least one RAID card configuration and a straight-through card configuration, and one of at least two RAID card configurations, if the configuration information of the multiple disks is at least one RAID card configuration and a straight-through card configuration, or at least two RAID card configurations, each configuration in the multiple configurations is identified in turn, and after the disk identification in the current configuration is completed, the disk in the next configuration is identified, and for each disk in each configuration, a serial scanning method is used to identify the disk in turn. Due to the method of obtaining the configuration information of the RAID card and the configuration information of the hard disk version, manual intervention is not required, and it does not need to rely on the operator's mastery of the disk management method. And even if the configuration of the computing device is changed, the processor can automatically obtain the connection method of multiple disks, which has strong universality. Moreover, the embodiment of the present application can realize the identification of multiple disks one by one according to the disk scanning order, and the identification order does not change, thereby improving the problem that the operating system assigns different drive letters to the same disk during each startup process, and helping to improve the problem of drive letter drift during the startup of the operating system. In summary, the embodiment of the present application can automatically determine the connection method of multiple disks through the configuration information of the RAID card or the hard disk backplane, and serially identify the method of identifying multiple disks of the computing device based on the connection method of different disks, without the need for manual interference, to achieve the purpose of preventing drive letter drift during the startup of the operating system, and the method has strong universality.
[0009] Among them, if multiple disks are directly connected to one RAID card, or are connected to one RAID card through the hard disk backplane, it is determined that the configuration information of multiple disks in the computing device is only one RAID card configuration; if multiple disks are respectively connected to at least two disk connection cards, or multiple disks are connected to at least two disk connection cards through the hard disk backplane, it is determined that the configuration information of multiple disks is at least two RAID card configurations or at least one RAID card configuration and a pass-through configuration, and the disk connection cards include the RAID card and the pass-through card; if the configuration information of the RAID card is not obtained, it is determined that the configuration information of multiple disks is only a pass-through configuration.
[0010] In a specific implementation, the first kernel startup parameter, the second kernel startup parameter and the serial hard disk scan parameter are configured in sequence, the first kernel startup parameter is used to load the first configuration, the second kernel startup parameter is used to load the second configuration, and the serial hard disk scan parameter is used to serially scan the disks in the configuration; based on the first kernel startup parameter, the second kernel startup parameter and the serial hard disk scan parameter, the following are executed in sequence: first serially scan the disks in the first configuration, and when the disks in the first configuration are completed, serially scan the disks in the second configuration. That is, the embodiment of the present application can load different configurations and serially identify the disks of each configuration by means of the existing operating system configuration kernel startup parameter method, which is simple to operate and easy to implement.
[0011] Among them, if the first configuration is RAID card configuration, and the second configuration is pass-through configuration, the first kernel startup parameter is to load the RAID card driver parameter, and the second kernel startup parameter is to load the Advanced Host Controller Interface AHCI driver parameter. If the first configuration is the first RAID card configuration, and the second configuration is the second RAID card configuration, the first kernel startup parameter is to load the first RAID card driver parameter, and the second kernel startup parameter is to load the second RAID card driver parameter.
[0012] In another specific implementation, if the configuration information of multiple disks is only pass-through configuration, or only one RAID card is configured, the serial scanning hard disk parameters are configured, and based on the serial scanning hard disk parameters, the multiple disks are serially scanned in sequence. That is, in the embodiment of the present application, when the configuration information of multiple disks is the same, only the serial scanning hard disk parameters need to be configured to implement serial scanning, which further reduces the complexity of operation.
[0013] In another specific implementation, it is determined whether the kernel startup parameters in the current operating system meet the conditions for enabling anti-drift. If not, the kernel startup parameters are configured based on the configuration information of multiple disks. The conditions for enabling anti-drift include: if the configuration information of multiple disks is only pass-through or only one RAID card configuration, the kernel startup parameters in the current operating system include serial scanning hard disk parameters; if the configuration information of multiple disks is at least two RAID card configurations, the current operating system includes loading the drive parameters of at least two RAID cards and serial scanning hard disk parameters; if the configuration information of multiple disks is at least one RAID card configuration and pass-through configuration, the current operating system includes loading the drive parameters of at least one RAID card, loading AHCI drive parameters and serial scanning hard disk parameters. Through the preliminary judgment of the anti-drift conditions, it is determined whether the kernel configuration parameters required for the anti-drift conditions are included in the current operating system. If necessary, they are not configured. Therefore, the configuration process can be simplified and the processing efficiency of anti-drive drift can be improved.
[0014] In another specific implementation, based on the disk scanning order, a serial scanning method is used to sequentially scan multiple disks; based on the disk scanning order, a serial scanning method is used to sequentially scan each configured disk. In this way, it can be ensured that multiple disks in the computing device are identified in a fixed order, and the identification order is the same each time the computing device is started, thereby avoiding disk drive letter drift.
[0015] In another specific implementation, a configuration interface is output, and the configuration interface is used to set whether to enable the anti-disk letter drift function; in response to receiving an operation of enabling the anti-disk letter drift function in the configuration interface, configuration information of the hard disk backplane or configuration information of the RAID card is obtained. Interacting with the user through the configuration interface improves the user experience.
[0016] In a second aspect, an embodiment of the present application provides a computing device, including:
[0017] Memory, used to store programs;
[0018] The processor is used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute any method as described in the first aspect.
[0019] In a third aspect, the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement the method provided in any one of the embodiments of the first aspect to the second aspect of the present application.
[0020] In a fourth aspect, the present application provides a computer program product comprising instructions, which, when executed on at least one computing device, enables the at least one computing device to implement the method provided in any one of the embodiments of the first to second aspects of the present application.
[0021] Any of the disk scanning methods provided above corresponds to a computing device, a terminal device, a computer-readable storage medium, or a computer program product, etc., which are used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A hardware structure block diagram of a computing device provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of another RAID card provided in an embodiment of the present application connected to multiple disks 105;
[0024] Figure 3 Provided in the embodiments of this application Figure 2 A schematic diagram showing the connection relationship between the RAID card, hard disk backplane and hard disk;
[0025] Figure 4 A flow chart of a disk scanning method provided in an embodiment of the present application;
[0026] Figure 5 A flowchart of another disk scanning method provided in an embodiment of the present application;
[0027] Figure 6 A schematic diagram of a configuration interface provided in an embodiment of the present application;
[0028] Figure 7 A flow chart of another method for preventing disk character drift provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0030] The following is an explanation of some terminology concepts involved in the embodiments of the present application.
[0031] Disk: Also known as hard disk, it is a physical storage device such as a hard disk drive or solid-state drive in a computing device.
[0032] Partition: A logical unit divided into two parts, a physical disk, which can be formatted and connected to an independent file system. Partitions can help you better manage the data on the disk.
[0033] Operating System (OS): It is configured on the motherboard of the computing device and interacts with hardware resources through the motherboard. Among them, the motherboard can communicate with the hard disk backplane controller, for example, the motherboard communicates with the Redundant Array of Independent Disks (RAID) card. In addition, the motherboard can also communicate with the disk connected to the hard disk backplane, and can also communicate with multiple hard disk backplanes. The operating system is configured with a disk driver, and the operating system can obtain disk information and communicate with the disk through the disk driver. From the current development point of view, the current mainstream operating systems are mainly Linux systems and Windows systems, and the embodiments of this application are mainly explained around the Linux system. The method provided in the embodiments of this application, but considering the diversity of operating systems and the possibility of more new operating systems in the future, this application does not limit the specific type of operating system.
[0034] Drive letter: The drive letter is an identifier assigned to a disk or partition by the operating system during the boot process. The operating system can access the corresponding disk or partition based on the drive letter. For Linux systems, the drive letter of a disk or partition can be identified by the device file name of the disk or partition. For example, the device file name of a disk is / dev / sdX, and the drive letter assigned to the disk by the Linux system is
[0035] / dev / sdX.
[0036] The following uses the Linux system as an example to illustrate the application scenarios involved in the embodiments of the present application.
[0037] During the boot process of the Linux system, the processor will detect the disks or partitions connected to the Linux system. After each disk or partition is detected, the Linux system will automatically assign a drive letter to the disk or partition. For example, the Linux system assigns the drive letter / dev / sda to the first disk detected, the drive letter assigned to the second disk is / dev / sdb, the drive letter assigned to the third disk is / dev / sdc, and so on. For example, the Linux system assigns the drive letter / dev / sd1 to the first partition detected, the drive letter assigned to the second partition is / dev / sd2, the drive letter assigned to the third partition is / dev / sd3, and so on.
[0038] Drive letter drift refers to the different drive letters assigned to the same disk or partition each time Linux boots. For example, during one boot process of the Linux system, the processor assigns drive letters / dev / sda, / dev / sdb, and / dev / sdc to Disk A, Disk B, and Disk C, respectively. During another boot process, the processor assigns drive letters / dev / sdc, / dev / sda, and / dev / sdb to Disk A, Disk B, and Disk C, respectively. Drive letter drift may cause the disk or partition to be incorrectly identified, which may cause specific software to fail to run correctly, or identify the data of the wrong disk or partition, which may cause data security risks to specific software.
[0039] In view of this, the embodiment of the present application provides a disk scanning method, which is used to determine the configuration information of the disk through the configuration information of the RAID card or the configuration information of the hard disk backplane, and serially identify multiple disks in the computing device based on the configuration information of the disk. Therefore, through the above method, the purpose of preventing the drive letter drifting during the startup of the operating system can be achieved without the need for manual interference. The disk scanning method provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.
[0040] Attached Figure 1 A hardware structure block diagram of a computing device provided in an embodiment of the present application. The computing device 100 includes a processor 101, a memory 102, a RAID card 103, a disk 105, and a baseboard management controller (Based Controller Management, BMC) 106. Among them, the BMC 106 is used for out-of-band management, also known as an out-of-band controller.
[0041] The processor 101 is connected to the memory 102, the RAID card 103 and the BMC 106. The RAID card 103 is connected to the disk 103. The BMC 106 is connected to the RAID card.
[0042] like Figure 1 As shown, the RAID card is directly connected to multiple disks 105 .
[0043] Figure 2 FIG. 2 shows another schematic diagram of a RAID card connected to multiple disks 105. Figure 2 As shown, the RAID card 103 is connected to the hard disk backplane 104, and the hard disk backplane 104 is connected to multiple disks. In actual applications, the hard disk backplane 104 can be provided with multiple hard disk slots, and each hard disk slot is connected to a disk 105.
[0044] Figure 3 Shows Figure 2 The diagram shows the connection relationship between the RAID card, hard disk backplane and hard disk. Figure 3As shown, the RAID card 103 is connected to multiple hard disk backplanes 104 , and each hard disk backplane 104 is connected to multiple disks 105 .
[0045] In addition, an operating system OS runs in the memory 102 , and the operating system OS includes a driver program of the RAID card 103 .
[0046] In addition, BMC 106 stores out-of-band management software, and since BMC 106 interacts with RAID card 103, it can be obtained that BMC 106 can obtain configuration information of RAID card. In addition, BMC 106 can also interact with hard disk backplane 104, so BMC 106 can obtain configuration information of hard disk backplane 104.
[0047] When the RAID card can support multiple hard disk backplane connections, it can be used for Figure 1 , Figure 2 or Figure 3 In the scenario shown, when the RAID card does not support multi-disk backplane connection, you can use Figure 1 or Figure 2 The scene shown.
[0048] The disk scanning method provided in the embodiment of the present application is described in detail below.
[0049] Attached Figure 4 A flow chart of a disk scanning method provided in an embodiment of the present application, the method includes the following contents:
[0050] S410: Determine configuration information of multiple disks in a computing device based on configuration information of a hard disk backplane or configuration information of a RAID card.
[0051] The disk configuration information includes the disk pass-through configuration and the disk RAID card configuration. The disk pass-through configuration refers to the configuration of the disk connected to the pass-through card, and the disk RAID card configuration refers to the configuration of the disk connected to the RAID card.
[0052] If multiple disks in the computing device 100 are only connected to the pass-through card, it is determined that the configuration information of the multiple disks in the current computing device 100 is a pass-through configuration that only includes the disks. The pass-through card is also called the platform controller hub (Platform Controller Hub, PCH) pass-through card. The disks connected to the PCH pass-through card are directly exposed to the operating system without any RAID processing. If multiple disks in the current computing device 100 are connected to the same RAID card, the configuration information of the multiple disks in the computing device 100 is only 1 RAID card configuration. If part of the multiple disks in the current computing device 100 are connected to the RAID card and the other part is connected to the pass-through card, it is determined that the configuration information of the multiple disks in the computing device 100 is multiple configurations, and the multiple configurations include RAID card configurations and pass-through configurations. If multiple disks in the current computing device 100 are connected to different RAID cards, it is determined that the configuration information of the multiple disks in the computing device 100 is multiple configurations, and the multiple configurations include multiple RAID card configurations.
[0053] Exemplary description, for example, the current computing device 100 includes disk A, disk B, disk C, disk D and disk E. If disk A, disk B, disk C, disk D and disk E are all mounted on RAID card 1, it means that the configuration information of multiple disks in the computing device 100 is configured for only one RAID card. If disk A, disk B, disk C, disk D and disk E are all mounted on a pass-through card, it means that the configuration information of multiple disks in the computing device 100 is configured for only a pass-through card. If disks A, disk B and disk C are mounted on RAID card 1, and disk D and disk E are mounted on a pass-through card, it means that the configuration information of multiple disks in the computing device 100 is configured for one RAID card and has a pass-through configuration. If disks A, disk B and disk C are mounted on RAID card 1, and disk D and disk E are mounted on RAID card 2, it means that the configuration information of multiple disks in the computing device 100 is configured for two RAID cards.
[0054] The BMC 106 may determine the configuration information of the disk based on the configuration information of the RAID card or the configuration information of the hard disk backplane.
[0055] Each time the computing device 100 is powered on or restarted, the BMC 106 interacts with the RAID card 103 or the hard disk backplane 104 to obtain the configuration information of the RAID card from the RAID card 103 or obtain the configuration information of the hard disk backplane from the hard disk backplane 104 .
[0056] The configuration information of the RAID card refers to the parameters and settings related to the configuration of the RAID card. In the embodiment of the present application, the configuration information of the RAID card includes whether the RAID card is connected to the disk, and the connected disk. In addition, the configuration information of the RAID card also includes RAID array information, such as the name of the RAID array information, the currently configured RAID level, and member disk information. The computing device 100 can determine the configuration information of the disk by whether the configuration information of the RAID card is obtained, and whether the disk is connected in the configuration information of the RAID card, and the connected disk.
[0057] The configuration information of the hard disk backplane refers to the parameters and settings related to the configuration of the hard disk backplane, wherein the configuration information of the hard disk backplane includes the disks connected to the RAID card through the hard disk backplane and the status of the disks.
[0058] In one example, BMC 106 can determine the configuration information of the disk based on the configuration information of the RAID card. Specifically, BMC 106 can determine which disks are configured into a RAID array and which disks belong to which RAID array based on whether the RAID card is connected to the disk, all the connected disks, and the RAID array information. If the disk is marked as belonging to a certain RAID array, the configuration information of the disk is the RAID card configuration. For example, disk A, disk B, and disk C are configured into a RAID 5 array (for example, logical volume DataVol1), then the configuration information of disk A, disk B, and disk C is the RAID card configuration corresponding to the RAID 5 array. If the disk is not marked as any RAID array, the configuration information of the disk is a pass-through configuration. Through the configuration information of the RAID card, it can be clearly determined which disks are connected to which RAID card, which helps to improve the accuracy of determining the disk connection method.
[0059] Further, if BMC 106 obtains configuration information of multiple RAID cards, BMC 106 can determine that the RAID card configuration of each disk in the multiple disks is specifically the RAID card configuration corresponding to that RAID card based on the configuration information of the multiple RAID cards. For example, BMC 106 obtains the configuration information of RAID card 1: RAID card 1 is connected to disk A, disk B, and disk C, and it is confirmed that disk A, disk B, and disk C are configured as a RAID 5 array. BMC 106 obtains the configuration information of RAID card 2: RAID card 2 is connected to disk D, disk E, and disk F, and it is confirmed that disk D, disk E, and disk F are configured as a RAID 1 array. This means that the configuration information of disk A, disk B, and disk C in computing device 100 is the RAID card configuration corresponding to RAID card 1, and the configuration information of disk D, disk E, and disk F is the RAID card configuration corresponding to RAID card 2.
[0060] In another example, BMC 106 determines the connection mode of multiple disks based on the configuration information of the hard disk backplane. Specifically, BMC 106 checks the disks connected to the RAID card, confirms which disks are connected to the RAID card through the hard disk backplane, and which disks are assigned to which RAID card, thereby determining the configuration information of the multiple disks. For example, the configuration information of the hard disk backplane includes: the hard disk backplane is connected to disk A, disk B, disk C, disk D, disk E, and disk F, wherein disk D, disk E, and disk F are connected to RAID card 2, and disk A, disk B, and disk C are connected to RAID card 1. At this time, multiple disks of the computing device 100 are connected to multiple disk connection cards, and the configuration information of disk D, disk E, and disk F is the RAID card configuration corresponding to RAID card 2, and disk A, disk B, and disk C are RAID card 1.
[0061] S420: If the configuration information of the multiple disks in the computing device 100 is only a direct-through configuration, or only one RAID card is configured, a serial scanning method is used to scan the multiple disks.
[0062] For multiple disks in the computing device 100, if the configuration information of the multiple disks is only a pass-through configuration, or only a configuration of the same RAID card, the processor 101 can scan the multiple disks in a serial scanning manner and identify the multiple disks in sequence. Thus, the processor 101 can assign drive letters to the disks according to the order in which the multiple disks are identified.
[0063] The BMC 106 may configure serial scanning hard disk parameters and send the serial scanning hard disk parameters to the processor 101. After receiving the serial scanning hard disk parameters, the processor 101 serially scans multiple disks.
[0064] For example, taking the Linux system as an example, the serial hard disk scanning parameter is "sync". That is, the BMC 106 configures "sync" to enable the processor 101 to serially scan multiple disks. For example, the BMC 106 can enter the Linux system and edit the configuration file of the boot loader of the Linux system (i.e., the / etc / default / grub file). By adding sync to the configuration file, the method of scanning the disk of the Linux system is determined. In a specific implementation, the scsi_mod.scan=sync parameter is added at the end of the GRUB_CMDLINE_LINUX line.
[0065] BMC 106 sends the serial scanning hard disk parameter to processor 101. After receiving the serial scanning hard disk parameter, processor 101 sequentially identifies multiple disks. For example, processor 101 receives the serial scanning hard disk parameter, sequentially identifies disk A, disk B, and disk C, and assigns drive letters to the identified disks A, B, and C. For example, drive letter assigned to disk A is / dev / sda, drive letter assigned to disk B is / dev / sdb, and drive letter assigned to disk C is / dev / sdc.
[0066] S430. If the configuration information of the multiple disks in the computing device 100 includes multiple configurations, scan each of the multiple configurations in sequence.
[0067] For multiple disks in the computing device 100, if the configuration information of the multiple disks includes at least two RAID card configurations, or includes at least one RAID card configuration and a pass-through configuration, each of the multiple configurations is scanned in sequence. Specifically, when scanning each of the multiple configurations in sequence, after the disk scan of the current configuration is completed, the next configuration is scanned, and for each configuration, the disk of each configuration is scanned in a serial scanning manner.
[0068] For example, RAID card 1 is connected to disk A and disk B, and RAID card 2 is connected to disk C and disk D. Disk A in RAID card 1, disk B in RAID card 1, disk C in RAID card 2, and disk D in RAID card 2 are identified in sequence, where disk A is identified as / dev / sda, disk B is identified as / dev / sdb, disk C is identified as / dev / sdc, and disk D is identified as / dev / sdd. Thus, multiple disks in the computing device are identified in sequence, and drive letters are assigned to the disks according to the identification order.
[0069] For convenience of explanation, the following description is made by taking the case where the configuration information of multiple disks includes two RAID card configurations, or includes one RAID card and a pass-through card configuration, that is, the configuration information of multiple disks includes a first configuration and a second configuration, and the first configuration and the second configuration are different.
[0070] Among them, BMC 106 configures the first drive parameter for scanning the first configuration, and configures the second drive parameter for scanning the second configuration. Exemplarily, if the first drive parameter is XX and the second drive parameter is yy, BMC 106 configures the first drive parameter and the second drive parameter through rdloaddriver=xx rdloaddriver=yy. Thus, processor 101 sequentially scans the first configuration and the second configuration based on the configured first drive parameter and the second drive parameter.
[0071] BMC 106 configures the synchronous scanning hard disk parameters to enable processor 101 to sequentially scan the disks of the first configuration and the disks of the second configuration, thereby realizing serial identification of each disk. The specific configuration is described above and will not be discussed here.
[0072] The BMC 106 sends the configured driving parameters to the processor 101 .
[0073] The processor 101 receives the first drive parameter, the second drive parameter and the serial scanning hard disk parameter. First, the processor 101 scans the first configuration corresponding to the first drive parameter, and serially scans the disk of the first configuration. After the disk scan of the first configuration is completed, the processor 101 scans the second configuration corresponding to the second drive parameter, and serially scans the disk of the second configuration.
[0074] For example, if disk A and disk B are configured by one RAID card, disk C and disk D are configured by direct connection, the first configuration is the RAID card configuration, and the second configuration is the direct connection configuration, the processor 101 sequentially identifies disk A and disk B configured by the RAID card, and then sequentially identifies disk C and disk D configured by direct connection. A drive letter is assigned to each disk in the order of identification.
[0075] Exemplarily, if disk A and disk B are configured for RAID card 1, and disk C and disk D are configured for RAID card 2, the first configuration is configured for RAID card 1, and the second configuration is configured for RAID card 2, then the processor 101 sequentially identifies disk A and disk B configured for RAID card 1, and then sequentially identifies disk C and disk D configured for RAID card 1. A drive letter is assigned to each disk in the order of identification.
[0076] Furthermore, in order to ensure that the processor 101 identifies multiple disks in the computing device 100 in a fixed order and that the identification order is the same each time the computing device 100 is started, the BMC 106 writes a disk scanning order for identifying disks while editing the drive parameters. The disk scanning order may be to identify disks corresponding to the slot numbers in order of slot numbers, for example, to identify disks in order of slot numbers from large to small or from small to large. The BMC 106 sends the written disk scanning order to the processor 101, and the processor 101 identifies different disks in order based on the disk scanning order.
[0077] Exemplarily, the disk scanning order received by the processor 101 is to identify disk A, disk B, disk C, and disk D. If disk A and disk B are configured by one RAID card, disk C and disk D are configured by direct connection, the first configuration is the RAID card configuration, and the second configuration is the direct connection configuration, then the processor 101 sequentially identifies disk A and disk B configured by the RAID card, and then sequentially identifies disk C and disk D configured by direct connection, based on the disk scanning order. A drive letter is assigned to each disk in the order in which the disks are identified.
[0078] In addition, the BMC 106 may also set a disk scanning sequence through the BIOS or UEFI, and the BMC 106 sends the set disk scanning sequence to the processor 101, and the processor 101 identifies the disk based on the disk scanning sequence.
[0079] The embodiment of the present application may also implement sequential scanning of multiple disks in the computing device 100 through other methods, which are not specifically limited in the embodiment of the present application.
[0080] In an embodiment of the present application, when the computing device is turned on, the configuration information of multiple disks of the computing device can be identified through the configuration information of the hard disk backplane or the configuration information of the RAID card. Based on whether the configuration information of the multiple disks is only a straight-through configuration, only one RAID configuration, at least one RAID card configuration and a straight-through card configuration, and one of at least two RAID card configurations, if the configuration information of the multiple disks is at least one RAID card configuration and a straight-through card configuration, or at least two RAID card configurations, each configuration in the multiple configurations is identified in turn, and after the disk identification in the current configuration is completed, the disk in the next configuration is identified, and for each disk in each configuration, a serial scanning method is used to identify the disk in turn. Due to the method of obtaining the configuration information of the RAID card and the configuration information of the hard disk version, manual intervention is not required, and it does not need to rely on the operator's mastery of the disk management method. And even if the configuration of the computing device is changed, the processor can automatically obtain the connection method of multiple disks, which has strong universality. Moreover, the embodiment of the present application can realize the identification of multiple disks one by one according to the disk scanning order, and the identification order does not change, thereby improving the problem that the operating system assigns different drive letters to the same disk during each startup process, and helping to improve the problem of drive letter drift during the startup of the operating system. In summary, the embodiment of the present application can automatically determine the connection method of multiple disks through the configuration information of the RAID card or the hard disk backplane, and serially identify the method of identifying multiple disks of the computing device based on the connection method of different disks, without the need for manual interference, to achieve the purpose of preventing drive letter drift during the startup of the operating system, and the method has strong universality.
[0081] Furthermore, in order to achieve better anti-disk letter deviation, BMC 106 sets a specific configuration loading mode based on different configuration modes. Figure 5 Provide detailed explanation.
[0082] Attached Figure 5 A flowchart of another disk scanning method provided in an embodiment of the present application, the method includes the following contents:
[0083] S510. The BMC 106 obtains configuration information of the RAID card or configuration information of the hard disk backplane.
[0084] S520 , the BMC 106 determines configuration information of multiple disks in the computing device 100 .
[0085] The configuration information of multiple disks includes: pass-through only, configuration with only one RAID card, configuration with one RAID card and pass-through, and configuration with two RAID cards.
[0086] S530 - 1 . If the configuration information of the multiple disks is only pass-through configuration or only one RAID card configuration, the BMC 106 sends a target command to the processor 101 .
[0087] The target command is used to trigger the processor 101 to obtain the kernel startup parameters of the current operating system. After receiving the target command, the processor 101 obtains the kernel startup parameters of the current operating system. The processor 101 sends the kernel startup parameters of the current operating system to the BMC 106.
[0088] S540 - 1 . The BMC 106 obtains kernel startup parameters of the current operating system.
[0089] S550-1. BMC 106 determines whether the kernel startup parameters of the current operating system meet the anti-drift enabling condition. If yes, execute S590; if not, execute S560-1.
[0090] In the embodiment of the present application, the BMC 106 obtains the kernel startup parameters of the current operating system and determines whether the kernel startup parameters of the current operating system meet the anti-drift enabling condition.
[0091] The anti-drift condition refers to that the kernel startup parameters of the current operating system meet the requirements for serially identifying multiple disks in the computing device 100. For example, if the configuration information of multiple disks in the computing device 100 is only pass-through or only one RAID card configuration, the kernel startup parameters of the current operating system include serial scanning hard disk parameters, and it is determined that the anti-drift enabling condition is met. If the kernel startup parameters of the current operating system do not include serial scanning hard disk parameters, it is determined that the anti-drift enabling condition is not met.
[0092] Among them, BMC 106 pre-stores the anti-drift conditions corresponding to the disk under different configuration information. In one example, the anti-drift conditions pre-set by BMC 106 are: under the condition of only pass-through configuration or only 1 RAID card configuration, the kernel startup parameters of the current operating system include serial scanning hard disk parameters. Under the condition of 1 RAID card configuration and pass-through configuration, the kernel startup parameters of the current operating system include loading RAID card driver parameters, loading Advanced Host Controller Interface (AHCI) driver parameters and serial scanning hard disk parameters. Under the configuration of 2 RAID cards, the kernel startup parameters of the current operating system include loading RAID card 1 driver parameters, loading RAID card 2 driver parameters and serial scanning hard disk parameters. Therefore, through the preliminary judgment of BMC, it is determined whether to perform the kernel startup parameter configuration of anti-drift, which can simplify the configuration process and improve the processing efficiency of anti-disk drift.
[0093] S560-1. Configure serial scanning hard disk parameters.
[0094] If the BMC 106 determines that the kernel startup parameters of the current operating system do not include the serial scanning hard disk parameters, the serial scanning hard disk parameters are configured.
[0095] The following is a specific implementation of configuring serial scanning hard disk parameters provided in an embodiment of the present application:
[0096] (1) Enter the Linux system.
[0097] (2) Edit the / etc / default / grub file.
[0098] The BMC 106 may issue and configure serial scanning hard disk parameters through an in-band management tool.
[0099] That is, add scsi_mod.scan=sync at the end of the line “GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel / rootrd.lvm.lv=rhel / swap rhgb quiet”.
[0100] (3) The amendment shall take effect.
[0101] The BMC 106 makes the serial scan hard disk parameter modification effective based on the preset command.
[0102] The preset command corresponds to the boot mode. For example, if the boot mode is Legacy mode, the preset command is grub2-mkconfig-o / boot / grub2 / grub.cfg. For example, if the boot mode is UEFI mode, the preset command is grub2-mkconfig-o
[0103] / boot / efi / EFI / redhat / grub.cfg.
[0104] S530-2. If the configuration information of multiple disks is configured for one RAID card and there is a pass-through configuration, the BMC sends the target name to the processor.
[0105] S540 - 2 . The BMC 106 obtains kernel startup parameters of the current operating system.
[0106] S550-2: BMC 106 determines whether the kernel startup parameters of the current operating system meet the anti-drift enabling condition. If yes, execute S590; if not, execute S560-2 or S570-2.
[0107] If BMC 106 determines that the kernel startup parameters of the current operating system include loading the driver parameters of the RAID card, loading the AHCI driver parameters and the first serial scanning hard disk parameters, it is determined that the anti-drift enabling condition is met. Otherwise, it is determined that the anti-drift enabling condition is not met and reconfiguration is required.
[0108] S560-2, BMC 106 configures and loads the RAID card driver parameters.
[0109] S570-1: BMC 106 configures and loads AHCI driver parameters.
[0110] Among them, the configuration order of S560-2 and S570-1 can be adjusted as needed, and is not specifically limited in the embodiment of the present application.
[0111] S580-1. Configure serial scanning hard disk parameters.
[0112] S530-3. If the configuration information of the multiple disks is for two RAID cards, the BMC sends the target name to the processor. S540-3. The BMC 106 obtains the kernel startup parameters of the current operating system.
[0113] S550-3: BMC 106 determines whether the kernel startup parameters of the current operating system meet the anti-drift enabling condition. If yes, execute S590; if not, execute S560-3.
[0114] If BMC 106 determines that the kernel startup parameters of the current operating system include driver parameters for loading RAID card 1, driver parameters for loading RAID card 2, and serial scanning hard disk parameters, it determines that the anti-drift enabling condition is met; otherwise, it determines that the anti-drift enabling condition is not met.
[0115] S560-3. Configure the driver parameters for loading RAID card 1.
[0116] S570-2. Configure the driver parameters for loading RAID card 2.
[0117] Among them, the configuration order of S560-3 and S570-3 can be adjusted as needed, and is not specifically limited in the embodiment of the present application.
[0118] S580-2. Configure serial scanning hard disk parameters.
[0119] S590, BMC control restarts and completes the startup settings.
[0120] Regarding the configuration loading driver parameters, the following is a specific implementation of setting kernel startup parameters. Herein, the kernel startup parameters include the first driver parameter, the second driver parameter, and the serial scanning hard disk parameter as an example for explanation. Herein, the first driver parameter is used to load the first configuration, and the second driver parameter is used to load the second configuration. The first configuration and the second configuration are different configurations, for example, they can be configured for two different RAID cards, or for one RAID card configuration and a pass-through configuration.
[0121] (1) Enter the Linux system.
[0122] (2) Edit the / etc / default / grub file.
[0123] The processor 101 may send and configure the first kernel startup parameter, the second kernel startup parameter, and the serial scanning hard disk parameter through an in-band management tool.
[0124] That is, add rdloaddriver=xx rdloaddriver=yy,scsi_mod.scan=sync to the end of the line "GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel / rootrd.lvm.lv=rhel / swap rhgb quiet". Among them, xx is the first kernel startup parameter and yy is the second kernel startup parameter.
[0125] (3) The amendment shall take effect.
[0126] The processor 101 starts the first kernel startup parameter, the second kernel startup parameter and the serial scan hard disk parameter based on the preset command. The preset command corresponds to the startup mode. For example, if the startup mode is Legacy mode, the preset command is grub2-mkconfig-o / boot / grub2 / grub.cfg. For example, if the startup mode is UEFI mode, the preset command is grub2-mkconfig-o / boot / efi / EFI / redhat / grub.cfg.
[0127] If the first kernel startup parameter is to load the RAID card driver parameter, and the second kernel startup parameter is to set the AHCI driver parameter, then xx is to load the RAID card driver parameter, and yy is to load the AHCI driver parameter. If the first kernel startup parameter is to load the RAID card 1 driver parameter, and the second kernel startup parameter is to set the RAID card 2 driver parameter, then xx is to load the RAID card 1 driver parameter, and yy is to load the RAID card 2 driver parameter.
[0128] Through the above steps, it can be ensured that the disks in the computing device 100 can maintain the consistency of the drive letter sequence after each system startup or restart, further avoiding drive letter drift.
[0129] Furthermore, in order to improve the user experience, the computing device 100 can output a configuration interface, which is provided with a function of enabling the anti-drive drift function. Figure 6 A schematic diagram of a configuration interface provided in an embodiment of the present application. The configuration interface 600 is provided with a switch button for preventing disk letter drift. Figure 6 Specifically, it includes an "on" button and an "off" button. When the user clicks the "on" button, the anti-disk letter drift function is turned on. When the user clicks the "off" button, the anti-disk letter drift function is turned off.
[0130] Furthermore, the configuration interface is also provided with a current status display function, which is used to display whether the anti-disk letter drift function is currently executed. Figure 6 , the embodiments of the present application provide two specific application scenarios.
[0131] Scenario 1: Before the user manually clicks the "Enable" button, BMC 106 does not perform the anti-drive letter drift function, and the current status displayed on the configuration interface is "Unknown". After the user clicks the "Enable" button, BMC obtains the configuration information of the RAID card or the hard disk backplane, and determines the connection method of the disk. Based on the connection method of the disk, it determines whether the correct anti-drive letter drift configuration has been enabled. If enabled, the current status is displayed as "Enabled". If not enabled, the kernel parameters of the Linux system are automatically configured. For specific configuration methods, see Figure 5If the configuration fails, for example, the operating system has not entered the Linux system, the current status is not displayed as "Unknown", and if the configuration is complete, the current status is displayed as "Enabled". Therefore, the user can determine whether the anti-disk letter drift function is correctly enabled based on the current status of the configuration interface.
[0132] Scenario 2: After the user manually clicks the "Start" button, the computing device restarts or powers on again. At this time, BMC106 will automatically detect the connection method of the disk in the current computing device, and based on the hard disk connection method, detect whether the parameter configuration of the Linux system is correct. If not, it will automatically configure the kernel parameters.
[0133] Attached Figure 7 A flowchart of another method for preventing disk character drift provided in an embodiment of the present application. The method includes the following contents:
[0134] S710. Turn on the “ON” button.
[0135] The user can manually click the "Open" button, or can also be opened in other ways, which are not specifically limited in the embodiments of the present application.
[0136] S720: Power on or restart the computing device.
[0137] S730. The current status is initially displayed as an "unknown" status.
[0138] S740. The BMC obtains the configuration information of the RAID card or the configuration information of the hard disk backplane.
[0139] S750. The BMC determines configuration information of multiple disks in the computing device.
[0140] S760: Check whether the BMC can access the Linux system. If yes, execute S770; if no, the status is displayed as "Unknown" and execute S760 again.
[0141] It should be noted that when the status is displayed as "unknown", it is periodically determined whether the Linux system is accessible, for example, with a period of 10 seconds.
[0142] S770: The BMC detects whether the kernel parameter configuration meets the kernel parameter configuration under the current disk configuration information. If so, execute S790. If not, execute S780.
[0143] S780, correctly configured.
[0144] Correct configuration means Figure 5 Different configurations are performed based on different disk configuration information.
[0145] S790, the status is displayed as "Enabled."
[0146] It should be noted that the configuration interface of the embodiment of the present application is a BMC storage management page.
[0147] As a result, users can intuitively see the current status of the anti-drive letter drift function through the graphical interface and easily turn the function on or off. In the "on" state, each time the computing device is restarted or powered on again, the BMC will automatically detect and configure the kernel parameters without manual user intervention. And by automatically detecting and configuring kernel parameters, it can ensure that the drive letter order of the disk is fixed, avoiding problems caused by drive letter drift.
[0148] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A disk scanning method, characterized in that: The method comprises: When the computing device is started, the configuration information of multiple disks in the computing device is determined based on the configuration information of the hard disk backplane or the configuration information of the disk array RAID card, wherein the configuration information of the disk includes a pass-through configuration and a RAID card configuration; If the configuration information of the plurality of disks is only direct configuration, or only one RAID card is configured, the plurality of disks are scanned in a serial scanning manner; If the configuration information of the plurality of disks includes a plurality of configurations, each of the plurality of configurations is scanned in sequence, wherein when each of the plurality of configurations is scanned in sequence, after the scanning of the disk of the current configuration is completed, the next configuration is scanned, and for each of the configurations, the disk of each configuration is scanned in a serial scanning manner; The multiple configurations include at least 2 RAID card configurations, or at least 1 RAID card configuration and a pass-through configuration.
2. The method according to claim 1, characterized in that The step of determining the configuration information of the plurality of disks in the computing device based on the configuration information of the hard disk backplane or the configuration information of the disk array RAID card includes: If the plurality of disks are directly connected to one RAID card, or are connected to one RAID card through the hard disk backplane, it is determined that the configuration information of the plurality of disks in the computing device is configured by only one RAID card; If the plurality of disks are respectively connected to at least two disk connection cards, or the plurality of disks are connected to at least two disk connection cards through the hard disk backplane, it is determined that the configuration information of the plurality of disks is at least two RAID card configurations or at least one RAID card configuration and a pass-through configuration, and the disk connection cards include the RAID card and the pass-through card; If the configuration information of the RAID card is not obtained, it is determined that the configuration information of the plurality of disks is a pass-through configuration only.
3. The method according to claim 1, characterized in that: If the plurality of configurations include at least a first configuration and a second configuration, the sequentially scanning each of the plurality of configurations comprises: sequentially configuring a first kernel startup parameter, a second kernel startup parameter, and a serial hard disk scan parameter, wherein the first kernel startup parameter is used to load the first configuration, the second kernel startup parameter is used to load the second configuration, and the serial hard disk scan parameter is used to serially scan the disk in the configuration; The step of sequentially scanning each of the plurality of configurations comprises: Based on the first kernel startup parameter, the second kernel startup parameter and the serial scanning hard disk parameter, the following are performed in sequence: first serially scanning the disks in the first configuration, and when the disks in the first configuration are completed, serially scanning the disks in the second configuration.
4. The method according to claim 3, characterized in that: If the first configuration is the RAID card configuration, and the second configuration is the pass-through configuration, the first kernel startup parameter is to load a RAID card driver parameter, and the second kernel startup parameter is to load an Advanced Host Controller Interface AHCI driver parameter.
5. The method according to claim 3, characterized in that: If the first configuration is the first RAID card configuration, the second configuration is the second RAID card configuration, the first kernel startup parameter is to load the first RAID card driver parameter, and the second kernel startup parameter is to load the second RAID card driver parameter.
6. The method according to claim 1, characterized in that: If the configuration information of the plurality of disks is only a direct configuration, or only one RAID card configuration, serially scanning the plurality of disks includes: If the configuration information of the plurality of disks is only pass-through configuration, or only one RAID card configuration, configure serial hard disk scanning parameters, and based on the serial hard disk scanning parameters, sequentially scan the plurality of disks in series.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine whether the kernel startup parameters in the current operating system meet the anti-drift enabling condition, and if not, configure the kernel startup parameters based on the configuration information of the plurality of disks; The conditions for enabling anti-drift include: if the configuration information of multiple disks is pass-through only, or only one RAID card configuration, the kernel startup parameters in the current operating system include serial scanning hard disk parameters; if the configuration information of multiple disks is at least two RAID card configurations, the current operating system includes loading the drive parameters of the at least two RAID cards and the serial scanning hard disk parameters; if the configuration information of multiple disks is at least one RAID card configuration and pass-through configuration, the current operating system includes loading the drive parameters of the at least one RAID card, loading the AHCI drive parameters and the serial scanning hard disk parameters.
8. The method according to any one of claims 1 to 6, characterized in that: Scanning the plurality of disks in a serial scanning manner comprises: scanning the plurality of disks in sequence in a serial scanning manner based on a disk scanning order; Scanning each configured disk in a serial scanning manner includes: based on the disk scanning order, scanning each configured disk in sequence in a serial scanning manner.
9. The method according to claim 1, characterized in that: The method further comprises: Output configuration interface, the configuration interface is used to set whether to enable the anti-disk letter drift function; In response to receiving an operation of setting and enabling the anti-drive drift function in the configuration interface, the configuration information of the hard disk backplane or the configuration information of the RAID card is obtained.
10. A computing device, characterized in that include: Memory, used to store programs; A processor, configured to execute the program stored in the memory; when the program stored in the memory is executed, the processor is configured to execute the method according to any one of claims 1 to 9.