A control method, device, and storage medium
By obtaining the location information and configuration list of the target hard disk slot, determining the target hard disk information, removing the non-target hard disk, and installing the operating system only on the first hard disk, solving the problem of operating system installation complexity caused by the limitations of hard disk layout in the prior art, and achieving simplified hard disk slot position management.
Patent Information
- Application Number
- CN202111419755.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-11-26
AI Technical Summary
In the prior art, nonvolatile memory storage devices and hard disk drives cannot be arranged in the order of PCIe bus due to layout restrictions, resulting in users needing to modify the operating system kernel or script to determine the installation order of the hard disk, resulting in the complicated process of installing the operating system.
By obtaining the location information of the target hard disk slot, determining the target hard disk information based on the configuration list, and removing the hard disk other than the first hard disk, installing the operating system on the first hard disk, and using the configuration list and firmware interface to manage the loading order and function activation of the hard disk, ensuring that the location information of the hard disk slot matches the hard disk information.
Without modifying the operating system kernel or scripts, the operating system is installed on the designated hard disk slot according to user needs, simplifying the installation process of the operating system.
Smart Images

Figure CN114153507B_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and in particular, to a control method, an apparatus, and a storage medium. Background Art
[0002] In the related art, a Non-Volatile Memory Express (NVMe) or a Hard Disk Drive (HDD) connected to a Back Plate (BP) may not be arranged in the order of a Peripheral Component Interconnect Express (PCIe) bus due to the layout limitation of the HDD, resulting in the need for users to modify the operating system (OS) kernel to determine which HDD should be ranked first or modify the script to select the required hard disk when installing the operating system on a specific NVMe or HDD during a large number of deployments. Summary of the Invention
[0003] The technical solution of this application is implemented as follows:
[0004] A control method, the method includes:
[0005] Obtain target location information representing a target hard disk slot for installing an operating system;
[0006] Based on a configuration list, determine target hard disk information corresponding to the target location information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the location information for installing the hard disk, and different location information corresponds to different hard disk slots; the target hard disk information is the hard disk information of a first hard disk;
[0007] Remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks that the electronic device has;
[0008] Install the operating system based on the first hard disk.
[0009] In the above solution, the removing at least one second hard disk includes:
[0010] Determine the drive root ports of the second hard disks in the at least one second hard disk;
[0011] Disable the drive root ports of the second hard disks in the at least one second hard disk.
[0012] In the above solution, after determining the target hard disk information corresponding to the target position based on the configuration list, the method further includes:
[0013] Detect whether the operating system is installed on the first hard disk; wherein, in the case where the operating system is not installed on the first hard disk, at least one second hard disk is removed.
[0014] In the above solution, the method further includes:
[0015] In the case where the operating system is installed on the first hard disk, disable the function of the first hard disk and enable the drive root port of the at least one second hard disk.
[0016] In the above solution, the method further includes:
[0017] Load the at least two hard disks into the corresponding at least two hard disk slots;
[0018] For each of the at least two hard disks, determine the hard disk information of the hard disk and the position information of the hard disk slot where the hard disk is loaded;
[0019] According to the hard disk information of the hard disk and the position information, obtain the configuration relationship, and the configuration relationships corresponding to each of the at least two hard disks constitute the configuration list.
[0020] In the above solution, the method further includes:
[0021] Obtain the execution order of at least two on-demand memories executed by the electronic device through a firmware interface, and different on-demand memories correspond to different hard disks;
[0022] Based on the execution order of the at least two on-demand memories, determine the loading order of the at least two hard disks.
[0023] In the above solution, the method further includes:
[0024] Receive execution setting information for the at least two on-demand memories, and the execution setting information includes the execution order of each of the at least two on-demand memories;
[0025] Based on the execution setting information, execute the at least two on-demand memories.
[0026] In the above solution, the hard disk information includes: hard disk identifier,
[0027] In the case where the hard disk is hot-plugged from the hard disk slot corresponding to the hard disk, the hard disk identifier remains unchanged before and after the hard disk hot-plugging.
[0028] A control device includes:
[0029] An acquisition unit, configured to acquire target location information characterizing a target hard disk slot for installing an operating system;
[0030] A first determination unit, configured to determine target hard disk information corresponding to the target location information based on a configuration list, where the configuration list includes at least one configuration relationship, and the configuration relationship is a relationship between the hard disk information of a hard disk and the location information where the hard disk is installed, and different location information corresponds to different hard disk slots; the target hard disk information is the hard disk information of a first hard disk;
[0031] A removal unit, configured to remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks that the electronic device has;
[0032] An installation unit, configured to install the operating system based on the first hard disk.
[0033] An electronic device, the electronic device may include: a processor, a memory, and a communication bus, where:
[0034] The communication bus is configured to implement a communication connection between the processor and the memory;
[0035] The processor is configured to execute a processing program stored in the memory to implement the following steps:
[0036] An acquisition unit, configured to acquire target location information characterizing a target hard disk slot for installing an operating system;
[0037] A first determination unit, configured to determine target hard disk information corresponding to the target location information based on a configuration list, where the configuration list includes at least one configuration relationship, and the configuration relationship is a relationship between the hard disk information of a hard disk and the location information where the hard disk is installed, and different location information corresponds to different hard disk slots; the target hard disk information is the hard disk information of a first hard disk;
[0038] A removal unit, configured to remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks that the electronic device has;
[0039] An installation unit, configured to install the operating system based on the first hard disk.
[0040] A storage medium, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the above control method.
[0041] The control method, device, and storage medium provided by the embodiments of the present application obtain target location information representing a target hard disk slot for installing an operating system; based on a configuration list, determine target hard disk information corresponding to the target location information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the location information where the hard disk is installed, and different location information corresponds to different hard disk slots; the target hard disk information is the hard disk information of a first hard disk; remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks possessed by the electronic device; install the operating system based on the first hard disk. In this way, without modifying the OS kernel or script, the operating system can be installed on the hard disk slot determined according to user requirements. Description of the Drawings
[0042] Figure 1 It is a flowchart of a control method provided by an embodiment of the present application;
[0043] Figure 2 It is a flowchart of another control method provided by an embodiment of the present application;
[0044] Figure 3 It is a flowchart of yet another control method provided by an embodiment of the present application;
[0045] Figure 4 It is a flowchart of a control method provided by another embodiment of the present application;
[0046] Figure 5 It is a flowchart of another control method provided by another embodiment of the present application;
[0047] Figure 6 It is a structural diagram of a control device provided by an embodiment of the present application;
[0048] Figure 7 It is a structural diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0049] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application.
[0050] It should be understood that the "embodiments of the present application" or "the foregoing embodiments" mentioned throughout the specification mean that specific features, structures, or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, the "in the embodiments of the present application" or "in the foregoing embodiments" that appear throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner. In various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The serial numbers of the embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0051] Without special instructions, when the electronic device executes any step in the embodiments of the present application, it can be the processor of the electronic device that executes this step. It is also worth noting that the embodiments of the present application do not limit the order of execution of the following steps by the electronic device. In addition, the methods used to process data in different embodiments can be the same method or different methods. It should also be noted that any step in the embodiments of the present application can be independently executed by the electronic device, that is, when the electronic device executes any step in the following embodiments, it can be independent of the execution of other steps.
[0052] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] The embodiments of the present application provide a control method, which is applied to a control device. Each functional module in the control device can be realized by the hardware resources of an electronic device (such as a terminal device, a server, or a server cluster), such as computing resources such as a processor, detection resources such as a sensor, and communication resources.
[0054] The electronic device can be any electronic device with information processing capabilities. In one embodiment, the electronic device can be a smart terminal, such as a mobile terminal with wireless communication capabilities, such as a notebook. In another embodiment, the electronic device can also be a terminal device with computing functions that is not convenient to move, such as a desktop computer, a desktop PC, a server, etc.
[0055] In actual applications, a control application program runs on the electronic device, and the control method provided by the embodiments of the present application can be implemented by this control application program.
[0056] Of course, the embodiments of the present application are not limited to being provided as methods and hardware, and there are also various implementation manners, such as being provided as a storage medium (storing instructions for executing the control method provided by the embodiments of the present application).
[0057] Figure 1Schematic diagram of the implementation process of the control method provided by the embodiments of the present application, as shown in Figure 1 shown, the method includes the following steps:
[0058] Step 101, the electronic device obtains target position information indicating a target hard disk slot for installing an operating system.
[0059] After the electronic device is powered on, a self-check process, namely Power On Self Test (POST), is performed. During the power-on self-check process of the electronic device, it is detected whether target position information for installing an operating system is set in the hardware settings. Among them, the target position information indicates the target hard disk slot and can be information such as a drive order number or a hard disk slot number. When the target position information is set in the hardware settings, it is indicated to install the operating system on the hard disk in the target hard disk slot indicated by the target position information.
[0060] In the embodiments of the present application, during the power-on self-check process of the electronic device, the Basic Input Output System (BIOS) or Advanced Configuration and Power Interface (ACPI) in the electronic device can detect whether target position information for installing an operating system is set in the hardware settings.
[0061] In the embodiments of the present application, the electronic device can be provided with at least two hard disk slots, and different hard disks are installed in different hard disk operations. The types of hard disks installed on the hard disk slots can include: Hard Disk Drive (HDD), Solid State Drive (SSD) using the non-volatile memory express (NVMe) interface specification, and SSD using the Platform Controller HUB (PCH) M.2 interface. In the embodiments of the present application, the SSD using NVMe is simply referred to as an NVMe hard disk, and the SSD using the PCH M.2 interface is simply referred to as a PCH M.2 hard disk.
[0062] In the embodiments of the present application, when the electronic device is equipped with a BMC, the BIOS or ACPI of the electronic device can detect whether target position information for installing an operating system is set in the hardware settings through the BMC.
[0063] In the embodiment of the present application, the target location information can be input by the user during the power-on self-check process of the electronic device, or can be obtained in the working state before the power-on self-check of the electronic device. When the target location information is obtained in the working state before the power-on self-check of the electronic device, the electronic device can store the obtained target location information in a specified path, and during the power-on self-check process, the electronic device reads the target location information from the specified path.
[0064] Step 102: The electronic device determines the target hard disk information corresponding to the target location information based on the configuration list. The configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of the hard disk and the location information of the slot where the hard disk is installed. Different location information corresponds to different hard disk slots; the target hard disk information is the hard disk information of the first hard disk.
[0065] After determining the target location information, the electronic device reads the configuration list and matches the location information with the location information in each configuration relationship in the configuration list. Among them, the configuration list includes multiple configuration relationships, and one configuration relationship corresponds to one hard disk. The configuration relationship is the association relationship between the location information representing the installation location of the hard disk and the hard disk information of the hard disk. Among them, the hard disk information in the configuration relationship includes: function information representing the function of the hard disk, supplier information representing the supplier of the hard disk, etc. that can represent the hard disk. Among them, the function information includes one or more of the following information: bus, device, function. The supplier information may include: Vendor ID, Device ID. In the embodiment of the present application, the function information may further include: a consistency name set for the hard disk, and this consistency name remains unchanged when the hard disk slot corresponding to the hard disk does not change.
[0066] In the embodiment of the present application, the configuration list can be stored in the BIOS or ACPI. The BIOS or ACPI in the electronic device can read the configuration list from the BIOS or ACPI.
[0067] The electronic device matches the target location with the location information in each configuration relationship, and determines the configuration relationship including the location information as the target configuration information as the target configuration relationship. At this time, the hard disk information in the target configuration relationship is called the target hard disk information, and the hard disk represented by the target hard disk information is the first hard disk.
[0068] In one example, the configuration list includes: configuration relationship 1, configuration relationship 2, and configuration relationship 3. Among them, configuration relationship 1 corresponds to hard disk 1, and configuration relationship 1 includes location information 1 and hard disk information 1 of hard disk 1. Configuration relationship 2 corresponds to hard disk 2, and configuration relationship 2 includes location information 1 and hard disk information 2 of hard disk 2. Configuration relationship 3 corresponds to hard disk 3, and configuration relationship 3 includes location information 3 and hard disk information 3 of hard disk 3. When the target location information obtained by the electronic device is location information 3, the hard disk information 3 is the target hard disk information, and the hard disk 3 represented by the hard disk information 3 is the first hard disk.
[0069] Step 103: The electronic device removes at least one second hard disk, and the at least one second hard disk includes the hard disks other than the first hard disk among the at least two hard disks that the electronic device has.
[0070] After the electronic device determines the first hard disk, it removes the hard disks other than the first hard disk among the multiple hard disks that the electronic device has, and only retains the first hard disk.
[0071] In one example, the hard disks in the electronic device include: hard disk 1, hard disk 2, and hard disk 3. Among them, the first hard disk determined in S102 is hard disk 3, so hard disk 1 and hard disk 2 are second hard disks. The electronic device removes hard disk 1 and hard disk 2.
[0072] The removal in the embodiments of the present application can be understood as virtual removal, that is, turning off the hard disk. In the embodiments of the present application, the electronic device turns off the second hard disk while keeping the functions of the second hard disk unchanged. Among them, the ways for the electronic device to remove the second hard disk may include: disconnecting the connection with the second hard disk, or shielding the access to the second hard disk, etc.
[0073] In the embodiments of the present application, the BIOS or ACPI in the electronic device removes the second hard disk. After removing the second hard disk, only the operation on the first hard disk is retained.
[0074] Step 104: The electronic device installs the operating system based on the first hard disk.
[0075] When the electronic device removes the second hard disk and only the first hard disk remains, the electronic device installs the operating system on the first hard disk.
[0076] In the embodiments of the present application, after the electronic device installs the operating system on the first hard disk, it can generate a boot variable and a file system, and store the boot variable and the file system on the first hard disk.
[0077] The control method provided by the embodiment of the present application can be applied to the following scenario: when an electronic device needs to install an operating system on the hard disk in slot 3, the position information of slot 3 is characterized to the electronic device. During the power-on self-test process of the electronic device, based on the position information of slot 3 and the configuration list, it is determined that the hard disk in slot 3 is hard disk B. Then, the hard disks other than hard disk B among the hard disks available in the electronic device, namely hard disk A, hard disk C, and hard disk D, are removed, and only hard disk B is retained, so as to install the operating system on hard disk B in slot 3, and thus install the operating system in the specified slot.
[0078] The control method provided by the embodiment of the present application obtains target position information characterizing a target hard disk slot for installing an operating system; based on a configuration list, determines target hard disk information corresponding to the target position information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the position information where the hard disk is installed, and different position information corresponds to different hard disk slots; the target hard disk information is the hard disk information of the first hard disk; removes at least one second hard disk, where the at least one second hard disk includes the hard disks other than the first hard disk among at least two hard disks available in the electronic device; installs the operating system based on the first hard disk. In this way, without modifying the OS kernel or script, the operating system can be installed on the hard disk slot determined according to user requirements.
[0079] In one embodiment, as Figure 2 shown, the implementation of removing at least one second hard disk in step 103 includes:
[0080] Step 1031: Determine the drive root ports of each second hard disk in the at least one second hard disk.
[0081] Step 1032: Disable the drive root ports of each second hard disk in the at least one second hard disk.
[0082] After the electronic device determines the second hard disk, it determines the drive root ports (driver root ports) of each second hard disk and disables the driver root ports of each second hard disk, so as to disconnect the connection with each second hard disk and no longer access the second hard disk.
[0083] In the embodiments of the present application, disabling the driver root port of the second hard disk can be understood as invalidating the driver root port of the second hard disk. After the driver root port of a second hard disk is disabled, the driver root port cannot operate, making the second hard disk unusable. In the embodiments of the present application, the method of disabling the driver root port may include setting the port status of the driver root port to not start, and may also include shielding the call of the driver root port, etc. In the embodiments of the present application, there is no limitation on the method of disabling the driver root port of the second hard disk.
[0084] In one embodiment, as Figure 3 shown, after determining the target hard disk information corresponding to the target location based on the configuration list in S102, the method further includes:
[0085] S105. The electronic device detects whether the operating system is installed on the first hard disk.
[0086] Wherein, in the case where the operating system is not installed on the first hard disk, the electronic device removes at least one second hard disk.
[0087] In the embodiments of the present application, after the electronic device determines the target hard disk information, it determines the first hard disk corresponding to the target hard disk information and detects whether the operating system is installed in the first hard disk. When the operating system is not installed in the first hard disk, it is necessary to install the operating system in the first hard disk.
[0088] In the embodiments of the present application, the methods for the electronic device to determine whether the operating system is installed in the first hard disk include at least one of the following:
[0089] Determination method 1: Determine whether there is a startup variable on the first hard disk.
[0090] Determination method 2: Determine whether there is a file system on the first hard disk.
[0091] For determination method 1, when there is a startup variable on the first hard disk, it indicates that the operating system has been installed on the first hard disk; when there is no startup variable on the first hard disk, it indicates that the operating system has not been installed on the first hard disk;
[0092] For determination method 2, when there is a file system on the first hard disk, it indicates that the operating system has been installed on the first hard disk; when there is no file system on the first hard disk, it indicates that the operating system has not been installed on the first hard disk.
[0093] When the electronic device determines that the first hard disk does not have an operating system installed, it determines to install the operating system on the first hard disk. At this time, the second hard disk is removed.
[0094] In one embodiment, based on Figure 1 or Figure 3 the control method shown, the processing performed by the electronic device further includes:
[0095] When the operating system is installed on the first hard disk, disable the function of the first hard disk and enable the drive root port of the at least one second hard disk.
[0096] In an embodiment of the present application, when the electronic device determines that the first operating system already has an operating system installed, it disables the function of the first hard disk and enables the root port of the removed second hard disk, so that the second hard disk is turned on.
[0097] In an embodiment of the present application, the way for the electronic device to determine that the operating system is installed in the first hard disk includes: performing an operation to install the operating system based on the first hard disk, or determining whether the operating system is installed in the first hard disk.
[0098] In one example, after the electronic device installs the operating system based on the first hard disk in S104, the electronic device disables the function of the first hard disk and enables the drive root port of the at least one second hard disk.
[0099] In one example, when the electronic device determines whether the operating system is installed in the first hard disk and determines that the operating system is installed in the first hard disk, it disables the function of the first hard disk and enables the drive root port of the at least one second hard disk, where the way for the electronic device to determine whether the operating system is installed in the first hard disk includes one or both of the above-mentioned determination methods 1 and 2.
[0100] In an embodiment of the present application, after the driver root port of a second hard disk is enabled, the driver root port is valid, so that the second hard disk can be used. In an embodiment of the present application, the way to enable the driver root port may include: setting the port state of the driver root port to start, and may also include: lifting the shielding of the driver root port, etc. In an embodiment of the present application, there is no limitation on the way to enable the driver root port of the second hard disk.
[0101] Here, the electronic device can perform a power-on self-test again after S104. During the power-on self-test again, S101 and S102 are executed again. At this time, the first hard disk is determined. However, the operating system has been installed in the first hard disk at this time. By judging whether the operating system is installed in the first hard disk, the electronic device determines that the operating system has been installed in the first hard disk, then disables the function of the first hard disk. The first hard disk is only used as the installation hard disk of the operating system, and enables the root port of the second hard disk, thereby restoring the access to the second hard disk during the startup process and restoring the connection between the second hard disk and the system, so that the electronic device supports the function of the second hard disk.
[0102] In the embodiment of the present application, during the first startup self-test process of the electronic device, the steps of S101 to S104 are executed, so as to install the operating system on the first hard disk. After the installation of the operating system on the first hard disk is completed, the electronic device is restarted, that is, the second startup self-test process is executed. During the second startup self-test process, when the first hard disk is determined and it is determined that the operating system has been installed in the first hard disk, the function of the first hard disk is disabled, and the root port of the second hard disk is enabled. After disabling the function of the first hard disk and enabling the second hard disk, the startup is executed again, so that the electronic device enters the working state based on the second hard disk.
[0103] At this time, as Figure 4 shown, the electronic device executes the following steps:
[0104] S401. The electronic device performs a power-on self-test once.
[0105] S402. The electronic device obtains the target location information.
[0106] S403. The electronic device determines whether the operating system is installed in the first hard disk corresponding to the target location information?
[0107] If the operating system is not installed in the electronic device, S404 is executed.
[0108] S404. The electronic device turns off the second hard disk other than the first hard disk.
[0109] S405. The electronic device installs the operating system based on the first hard disk.
[0110] S406. The electronic device performs a power-on self-test twice.
[0111] S407. The electronic device obtains the target location information.
[0112] S408. The electronic device determines whether the operating system is installed in the first hard disk corresponding to the target location information?
[0113] If the operating system is installed in the electronic device, S409 is executed.
[0114] S409. The electronic device disables the function of the first hard disk and turns on the second hard disk.
[0115] S410. The electronic device restarts.
[0116] In practical applications, during each power-on self-test process of the electronic device, after obtaining the target location information, it can determine whether the operating system is installed on the first hard disk corresponding to the target location information. In the case where the operating system is not installed, other second hard disks are removed. In the case where the operating system is installed, the removed second hard disk is restored, and the function of the first hard disk is disabled.
[0117] In an embodiment, before S101, the control method provided by the embodiments of the present application further includes: loading the at least two hard disks into the corresponding at least two hard disk slots; for each of the at least two hard disks, determining the hard disk information of the hard disk and the location information of the hard disk slot where the hard disk is loaded; according to the hard disk information of the hard disk and the location information, obtaining the configuration relationship, and the configuration relationships corresponding to each of the at least two hard disks constitute the configuration list.
[0118] Here, during the power-on self-test process of the power-on self-test in S101, the electronic device obtains the hard disk information of each hard disk and the hard disk slot corresponding to each hard disk, and loads the hard disk into the corresponding hard disk slot according to the corresponding relationship between the hard disk and the hard disk slot. In the embodiments of the present application, when loading the hard disk and the hard disk slot, the hard disk slot and the corresponding hard disk can be loaded based on the physical order of the hard disk slots, or the hard disk can be loaded into the corresponding hard disk slot according to the hard disk loading order.
[0119] After loading the hard disk into the corresponding hard disk slot, the position information corresponding to each hard disk can be generated based on the loading order of the hard disks. The position information can include: sequential number, number of the hard disk slot, etc. For each hard disk, a relationship is established between the hard disk information of the hard disk and the corresponding position information, so as to obtain the configuration relationship. Here, the configuration relationships corresponding to all the hard disks constitute the configuration list.
[0120] In the embodiments of the present application, before establishing the configuration relationship, a consistent hard disk identifier can be generated for each hard disk. The consistent hard disk identifier can remain unchanged when the hard disk slot into which the hard disk is inserted does not change. After the electronic device generates the consistent hard disk identifier, the hard disk identifier is added to the hard disk information of the hard disk, and the configuration relationship is generated with the position information corresponding to the hard disk. Among them, the hard disk identifier can also be called the drive name.
[0121] In one example, for a hard disk, the information included in the configuration relationship of the hard disk is shown in Table 1, including: drive sequence number, function information, vendor information (Venodr ID / Device ID), and consistent driver name. Among them, the function information may include one or more of: bus, device, and function. The vendor information may include: vendor identification or device identification.
[0122] Table 1. Example of configuration relationship
[0123] Drive sequence number Function information Vendor information Hardware name
[0124] After determining the configuration list, the electronic device can store the configuration list in a specified path, so that the electronic device reads the configuration list from the specified path during the next power-on self-test process.
[0125] In the embodiments of the present application, when the hard disk information of the hard disk includes: function information representing the function of the hard disk, and vendor information representing the vendor of the hard disk, the function information and the vendor information can be obtained through a firmware interface, and the firmware interface transmits the obtained function information or firmware information to ACPI or BIOS. In one example, the firmware interface may be a Unified Extensible Firmware Interface (UEFI), and the type of the firmware interface is not limited in the embodiments of the present application.
[0126] In the embodiments of the present application, when the electronic device loads the hard disk to the corresponding hard disk slot based on the hard disk loading order, the hard disk loading order may be a set loading order or an execution order associated with an Option Read-Only Memory (Oprom).
[0127] In one embodiment, the method further includes:
[0128] Obtaining, through the firmware interface, the execution order of at least two Option Read-Only Memories executed by the electronic device, where different Option Read-Only Memories correspond to different hard disks; and determining the loading order of the at least two hard disks based on the execution order of the at least two Option Read-Only Memories.
[0129] In the embodiments of the present application, the Option Read-Only Memory may also be referred to as a Peripheral Component Interconnect (PCI) Expansion ROM.
[0130] Among them, each hard disk has a corresponding Oprom, and the Oprom can determine in which slot of the electronic device it is located.
[0131] Before loading the hard disk, the electronic device obtains the execution order of the Oprom through the firmware interface and sends the UEFI to the ACPI or BIOS. The ACPI or BIOS determines the loading order of the hard disk based on the execution order of the Oprom.
[0132] In one example, hard disk 1 corresponds to Oprom1, hard disk 2 corresponds to Oprom2, hard disk 3 corresponds to Oprom3, hard disk 4 corresponds to Oprom4, and the execution order of the Oprom is: Oprom2, Oprom3, Oprom1, Oprom4. Then the loading order of hard disks 1, 2, 3, and 4 is: hard disk 2, hard disk 3, hard disk 4, and hard disk 4.
[0133] In the embodiment of the present application, at least one bay can be provided on the backplane of an electronic device. At least one slot is provided on one bay. The firmware interface can determine the slots corresponding to each hard disk and send the slots corresponding to each hard disk to the ACPI or BIOS. The ACPI or BIOS loads each hard disk to the corresponding slot based on the loading order of the hard disks.
[0134] In one embodiment, the method further includes: receiving execution setting information for the at least two on-demand memories, where the execution setting information includes the execution order of each on-demand memory in the at least two on-demand memories; and executing the at least two on-demand memories based on the execution setting information.
[0135] In the embodiment of the present application, before determining the loading order, a setting interface can be output during the current power-on self-test process, and a setting information receiving interface can be output on the setting interface to receive the execution order of the Oprom input by the user through the setting information receiving interface.
[0136] In the embodiment of the present application, through the manual control of the execution order of the Oprom, the loading order of the hard disks can be indirectly controlled, so that the loading order of the hard disks meets the user's expectations.
[0137] In one embodiment, the hard disk information includes: a hard disk identifier
[0138] In the case where the hard disk is hot-plugged from the hard disk slot corresponding to the hard disk, the hard disk identifier remains unchanged before and after the hard disk hot-plugging.
[0139] In the embodiment of the present application, for a hard disk, when the hard disk information of the hard disk in the configuration relationship includes a hard disk identifier, that is, a consistency identifier, the electronic device can effectively identify a hard disk based on the physical information of the hard disk.
[0140] In the related art, for each hard disk, a logical name can be set during loading, and when a hard disk is unplugged and then inserted, the logical name of the hard disk changes. In the embodiments of the present application, when a hard disk is re-inserted into the hard disk slot, if the hard disk slot remains unchanged, the hard disk name of the hard disk also remains unchanged, so that the hard disk identifier of the hard disk is fixed.
[0141] Next, the control method provided by the embodiments of the present application will be further described.
[0142] In the related art, hard disks (NVMe or HDDs) connected to the BP cannot be arranged in the order of the PCIe bus due to hardware (HW) layout restrictions. As a result, when a user wants to install an OS to a specific NVMe or HDD during a large-scale deployment, the user needs to modify the OS kernel to determine which HDD should be ranked first or modify the script to select the required hard disk. For example, if an electronic device has 32 NVMe and one PCH m.2, and the user wants to install the OS on the PCH m.2, but according to the HW layout, the PCH m.2 may be ranked among the 32 NVMe, and the 32 NVMe include NVMe from different manufacturers. The order of OS driver loading will not be arranged in the order of the BP bay number. In this way, the user must know which one is the hard disk he wants to install. Therefore, the user cannot intuitively select a specific hard disk.
[0143] Each time UEFI boots, it loads the corresponding NVMe and slots according to the oprom order, which ensures that the sorting order of the NVMe meets our expectations. Since UEFI can obtain information about which slot and which bay ID the current NVMe belongs to through FPGA and BMC information, UEFI can organize a table (ACPI or System Management Basic Input Output System (SMBIOS)) for the OS to refer to which device needs to be loaded first and the fixed name.
[0144] UEFI allows the user to select through setup or xcc to determine on which hard disk the OS will be installed. During the boot process, UEFI will turn off other root ports of the storage type to ensure that the OS will only exist on the hard disk where it needs to be installed. After the next boot, if UEFI checks that there is a file system or a boot item variable in the hard disk, it will turn on the root ports of the other turned-off hard disks.
[0145] The control method provided by the embodiments of the present application, as Figure 5 shown, includes:
[0146] S501, Power-on self-test.
[0147] S502, Determine whether there is a specified installation HDD for installing the OS.
[0148] Here, the BMC customer can be asked whether a specified HDD sequence number is set. If not, S503 is executed. If set, S506 is executed.
[0149] Here, when a specified HDD sequence number is set, it indicates that the OS needs to be installed in the HDD corresponding to the specified HDD sequence number. Here, the HDD corresponding to the specified HDD sequence number is called the specified installation HDD.
[0150] S503, Collect the execution order of the extended ROM in the UEFI through the UEFI, and obtain the HDD information of each hard disk.
[0151] Here, collect the execution order of the extended ROM through the UEFI, and obtain the HDD-related information of each hard disk, and send the obtained HDD-related information to the ACPI or SMBIOS. Among them, the obtained HDD-related information may include: the function information of the hard disk representing the device, the vendor information representing the vendor of the hard disk. Among them, the function information may include: bus, device, function, etc., and the vendor information may include: Vendor ID, Device ID, etc.
[0152] Here, the UEFI can know which slot and which bay ID each hard disk belongs to through the FPGA and the BMC.
[0153] S504, Start and enter the OS.
[0154] Here, during the startup process, determine the loading order of each hard disk based on the execution order of the extended ROM, and load each hard disk and the slot where each hard disk is inserted based on the determined loading order.
[0155] S505, Generate a configuration list based on the loading order of the hard disks and the HDD information of each hard disk.
[0156] Here, the configuration list includes the configuration relationships corresponding to each hard disk. Among them, the configuration relationship is the drive sequence number based on the loading order and the HDD information. Among them, the HDD information includes the obtained HDD-related information and the drive name. Among them, the drive name is consistent, and the drive name remains unchanged before and after hot plugging of the hard disk.
[0157] S506, Check whether the specified installation HDD has installed the operating system.
[0158] Here, it can be checked whether a boot variable or a file system exists in the specified installed HDD. If it exists, it indicates that the OS has been installed in the specified installed HDD, and the boot path based on the specified installed HDD has been established. If it does not exist, it indicates that the OS has not been installed in the specified installed HDD.
[0159] Here, if it exists, S507 is executed; if not, S509 is executed.
[0160] S507. Disable other HDDs.
[0161] Based on the specified installed HDD, determine other HDDs in the HDDs equipped with the electronic device except the specified installed HDD, and disable other HDDs.
[0162] Here, the drive root port of other HDDs can be disabled.
[0163] S508. Deploy the OS.
[0164] At this time, only the specified installed HDD is enabled, and the OS is installed in the specified installed HDD.
[0165] S509. Disable the function of the specified installed HDD and enable other HDDs.
[0166] Here, after the OS has been installed in the specified installed HDD, the function of this HDD is disabled, the installation of the OS is not performed again, and other HDDs are turned on by enabling the drive root ports of other HDDs.
[0167] After disabling the function of the specified HDD and enabling other HDDs, a reboot is performed.
[0168] Based on the above control method, an embodiment of the present application provides a control device. Refer to Figure 6 As shown, the device 600 includes:
[0169] An obtaining unit 601, configured to obtain target position information representing a target hard disk slot for installing an operating system;
[0170] A first determining unit 602, configured to determine, based on a configuration list, target hard disk information corresponding to the target position information. The configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the position information where the hard disk is installed. Different position information corresponds to different hard disk slots; the target hard disk information is the hard disk information of the first hard disk;
[0171] A removal unit 603 for removing at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks possessed by the electronic device;
[0172] An installation unit 604 for installing the operating system based on the first hard disk.
[0173] In some embodiments, the removal unit 603 is further configured to:
[0174] Determine the drive root ports of the respective second hard disks in the at least one second hard disk;
[0175] Disable the drive root ports of the respective second hard disks in the at least one second hard disk.
[0176] In some embodiments, the apparatus 600 further includes:
[0177] A detection unit for detecting whether the operating system is installed on the first hard disk after determining the target hard disk information corresponding to the target location based on a configuration list; wherein, when the operating system is not installed on the first hard disk, at least one second hard disk is removed.
[0178] In some embodiments, the apparatus 600 further includes: a recovery unit for:
[0179] When the operating system is installed on the first hard disk, disable the function of the first hard disk and enable the drive root ports of the at least one second hard disk.
[0180] In some embodiments, the apparatus 600 further includes:
[0181] A loading unit for loading the at least two hard disks into corresponding at least two hard disk slots;
[0182] A second determination unit for determining, for each of the at least two hard disks, the hard disk information of the hard disk and the position information of the hard disk slot where the hard disk is loaded;
[0183] A third determination unit for obtaining the configuration relationship according to the hard disk information of the hard disk and the position information, and the configuration relationships corresponding to the respective hard disks in the at least two hard disks constitute the configuration list.
[0184] In some embodiments, the apparatus 600 further includes:
[0185] A sequential acquisition unit for acquiring, through a firmware interface, the execution order of at least two random access memories executed by the electronic device;
[0186] A fourth determination unit for determining the loading order of the at least two hard disks based on the execution order of the at least two random access memories.
[0187] In some embodiments, the apparatus 600 further includes:
[0188] a receiving unit, configured to receive execution setting information for the at least two on-demand memories (Oproms), where the execution setting information includes the execution order of each of the at least two on-demand memories;
[0189] an execution unit, configured to execute the at least two on-demand memories based on the execution setting information.
[0190] In some embodiments, when the hard disk is hot-plugged from the hard disk slot corresponding to the hard disk, the hard disk identifier in the physical information remains unchanged before and after the hard disk hot-plugging.
[0191] It should be noted that the interaction process between the units in this embodiment can refer to Figures 1 - 5 the implementation process in the control method provided in the corresponding embodiment, which will not be elaborated here.
[0192] The control device provided in the embodiments of the present application installs the operating system on the hard disk slot determined based on user requirements without modifying the OS kernel or script.
[0193] Based on the foregoing embodiments, an embodiment of the present application provides an electronic device, as Figure 7 shown. The electronic device 700 may include: a processor 701, a memory 702, and a communication bus 703, where:
[0194] The communication bus 703 is used to implement a communication connection between the processor 701 and the memory 702;
[0195] The processor 701 is configured to execute a processing program stored in the memory 702 to implement the following steps:
[0196] Obtain target position information representing a target hard disk slot for installing the operating system;
[0197] Based on a configuration list, determine target hard disk information corresponding to the target position information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of the hard disk and the position information where the hard disk is installed, and different position information corresponds to different hard disk slots; the target hard disk information is the hard disk information of the first hard disk;
[0198] Remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among the at least two hard disks possessed by the electronic device;
[0199] Install the operating system based on the first hard disk.
[0200] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0201] Determine the drive root ports of the respective second hard disks in the at least one second hard disk;
[0202] Disable the drive root ports of the respective second hard disks in the at least one second hard disk.
[0203] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0204] After determining the target hard disk information corresponding to the target location based on the configuration list, detect whether the operating system is installed on the first hard disk; wherein, in the case where the operating system is not installed on the first hard disk, remove at least one second hard disk.
[0205] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0206] In the case where the operating system is installed on the first hard disk, disable the function of the first hard disk and enable the drive root ports of the at least one second hard disk.
[0207] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0208] Load the at least two hard disks into the corresponding at least two hard disk slots;
[0209] For each of the at least two hard disks, determine the hard disk information of the hard disk and the location information of the hard disk slot where the hard disk is loaded;
[0210] According to the hard disk information of the hard disk and the location information, obtain the configuration relationship, and the configuration relationships corresponding to the respective hard disks in the at least two hard disks constitute the configuration list.
[0211] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0212] Obtain the execution order of at least two on-demand memories executed by the electronic device through the firmware interface, and different on-demand memories correspond to different hard disks;
[0213] Based on the execution order of the at least two on-demand memories, determine the loading order of the at least two hard disks.
[0214] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0215] Receive execution setting information for the at least two on-demand memories, where the execution setting information includes the execution order of each on-demand memory in the at least two on-demand memories;
[0216] Execute the at least two on-demand memories based on the execution setting information.
[0217] In other embodiments of the present application, the processor 701 is further configured to implement the following steps:
[0218] When the hard disk is hot-plugged from the hard disk slot corresponding to the hard disk, the hard disk identifier in the hard disk information remains unchanged before and after the hard disk hot-plugging.
[0219] It should be noted that the specific implementation process of the steps executed by the processor in this embodiment can be referred to Figures 1 - 5 the implementation process in the control method provided in the corresponding embodiment, which will not be elaborated here.
[0220] Based on the foregoing embodiments, an embodiment of the present application provides a storage medium, that is, a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the control method provided in the embodiments of the present application.
[0221] It should be noted that the specific implementation process of the steps executed by the processor in this embodiment can be referred to the implementation process in the control method provided in the embodiments of the present application, which will not be elaborated here.
[0222] The descriptions of the above embodiments of the electronic device and the computer-readable storage medium are similar to the descriptions of the above method embodiments, and have beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the embodiments of the electronic device, storage system, and computer-readable storage medium of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
[0223] In the embodiments of the present application, if the above control method is implemented in the form of software functional modules and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read Only Memory), magnetic disks, or optical discs. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0224] It should be understood that the term "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the sequence numbers of the above processes do not indicate the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The sequence numbers of the embodiments of the present application are only for description and do not represent the superiority or inferiority of the embodiments.
[0225] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or device. Without further limitations, the element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the element.
[0226] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the displayed or discussed components can be through some interfaces. The indirect coupling or communication connection of devices or units can be electrical, mechanical, or other forms.
[0227] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units. They can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0228] In addition, each functional unit in the embodiments of the present application can be all integrated in a processing unit, or each unit can be separately used as a unit, or two or more units can be integrated in a unit. The above integrated units can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.
[0229] Those of ordinary skill in the art can understand that all or part of the steps to implement the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments. The foregoing storage media include various media that can store program codes, such as removable storage devices, read-only memory (ROM), magnetic disks, or optical discs.
[0230] Alternatively, if the above integrated units of the present application are implemented in the form of software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage media include various media that can store program codes, such as removable storage devices, ROM, magnetic disks, or optical discs.
[0231] As described above, it is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claimed rights.
Claims
1. A control method, applied to an electronic device, includes: Obtaining target location information representing a target hard disk slot for installing an operating system; Based on a configuration list, determining target hard disk information corresponding to the target location information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the location information of the hard disk slot where the hard disk is installed, and different location information corresponds to different hard disk slots; The target hard disk information is the hard disk information of the first hard disk; The configuration relationship is determined when the hard disk is loaded in the hard disk slot; the hard disk information includes: a hard disk identifier, and in the case of hot plugging the hard disk from the hard disk slot corresponding to the hard disk, the hard disk identifier remains unchanged before and after the hot plugging of the hard disk; Removing at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks that the electronic device has; Installing the operating system based on the first hard disk.
2. The method according to claim 1, wherein The removing at least one second hard disk includes: Determining the drive root ports of each second hard disk in the at least one second hard disk; Disabling the drive root ports of each second hard disk in the at least one second hard disk.
3. The method according to claim 1, wherein, After determining the target hard disk information corresponding to the target location based on the configuration list, the method further includes: Detecting whether the operating system is installed on the first hard disk; wherein, in the case where the operating system is not installed on the first hard disk, removing at least one second hard disk.
4. The method according to claim 1 or 3, wherein, The method further includes: In the case where the operating system is installed on the first hard disk, disabling the function of the first hard disk and enabling the drive root ports of the at least one second hard disk.
5. The method according to claim 1, wherein, The method further includes: Loading the at least two hard disks to the corresponding at least two hard disk slots; For each hard disk in the at least two hard disks, determining the hard disk information of the hard disk and the location information of the hard disk slot where the hard disk is loaded; According to the hard disk information of the hard disk and the location information, obtaining the configuration relationship, and the configuration relationships corresponding to each hard disk in the at least two hard disks constitute the configuration list.
6. The method according to claim 5, wherein The method further includes: Obtaining, through a firmware interface, the execution order of at least two on-demand memories executed by the electronic device, where different on-demand memories correspond to different hard disks; Based on the execution order of the at least two on-demand memories, determining the loading order of the at least two hard disks.
7. The method according to claim 6, wherein The method further includes: Receiving execution setting information for the at least two on-demand memories, where the execution setting information includes the execution order of each on-demand memory in the at least two on-demand memories; Based on the execution setting information, executing the at least two on-demand memories.
8. A control device, applied to an electronic device, includes: An obtaining unit, configured to obtain target location information representing a target hard disk slot for installing an operating system; A first determining unit, configured to determine, based on a configuration list, target hard disk information corresponding to the target location information, where the configuration list includes at least one configuration relationship, and the configuration relationship is the relationship between the hard disk information of a hard disk and the location information of the hard disk slot where the hard disk is installed, and different location information corresponds to different hard disk slots; The target hard disk information is the hard disk information of the first hard disk; The configuration relationship is determined when the hard disk is loaded in the hard disk slot; the hard disk information includes: a hard disk identifier, and in the case where the hard disk is hot-plugged from the hard disk slot corresponding to the hard disk, the hard disk identifier remains unchanged before and after the hard disk is hot-plugged; A removal unit, configured to remove at least one second hard disk, where the at least one second hard disk includes hard disks other than the first hard disk among at least two hard disks possessed by the electronic device; An installation unit, configured to install the operating system based on the first hard disk.
9. A storage medium storing one or more programs, where the one or more programs can be executed by one or more processors to implement the steps in the control method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Hard disk boot sequence recognition method and system
CN101499008A
Method for installing operating system on CPCI mainboard based on Loongson CPU on PMON
CN112988178A