Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method provided by the first embodiment of the present application may be executed in a computer terminal or a similar computing device. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of a computer terminal of a method for controlling disk startup according to an embodiment of the present invention. As shown in fig. 1, the computer terminal 10 may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the method for controlling disk booting in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the above-mentioned method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a method for controlling disk booting running in the computer terminal is provided, and fig. 2 is a flowchart for controlling disk booting according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring state information of disks in a disk array, wherein the disk array comprises N disks, and N is an integer greater than or equal to 1;
step S204, determining the starting level of the disk according to the state information of the disk in the disk array;
and step S206, controlling the disk in the disk array to be started according to the starting level.
Through the steps, the state information of the disks in the disk array is obtained, the disk array comprises N disks, and N is an integer greater than or equal to 1; determining the starting level of the disk according to the state information of the disk in the disk array; and controlling the startup of the disks in the disk array according to the startup grade. Therefore, the problems of long starting time and low efficiency of the disk caused by low output power consumption of the power module of the high-density storage device can be solved, and the effect of improving the starting efficiency of the disk is achieved.
Alternatively, the execution subject of the above steps may be a terminal or the like, but is not limited thereto.
As an optional implementation, the disk array may be a disk array in a storage device, and the module that consumes more power in the storage device includes: the system comprises a main control unit, a disk array and a fan set. Where the power consumption of the disk array is relatively high. Fig. 3 is a schematic structural diagram of a storage device according to an alternative embodiment of the present invention, where a power supply module is used to provide power for a main control unit, a hard disk, and a switch, a disk array includes a plurality of disks, and the number of the disks specifically included is determined according to an actual situation. Fig. 4 is a schematic diagram of a start-up flow of a storage device according to an alternative embodiment of the present invention, which specifically includes the following steps:
step S41, the storage device is powered on or the storage device is started by key triggering;
step S42, the main control unit enables the power module;
step S43, the main control unit informs the control unit of the completion of the start and instructs the control unit to enable the fan combination disk array;
step S44, the control unit enables the fan group;
step S45, the control unit enables the disk array;
in step S46, the storage device startup flow ends.
The current for starting the hard disk is larger and is generally 2-3 times of the working current. If the requirement that the disks in the disk array are powered on simultaneously is met, the requirement on the power module is high. Such a large current is not required for normal operation after the memory device is started, thereby causing power waste. In the implementation, a power supply module with a conventional specification can be selected, the disk array is powered on in a time-sharing mode at a fixed time interval during starting, and starting current is staggered. Specifically, the disks can be divided into different starting levels according to the state information of the disks in the disk array, and the disks in the disk array are started in a time-sharing manner according to the starting levels, so that the problem that the starting speed of the disk array is slow due to high current requirements when the disks in the disk array are started simultaneously can be solved, and the technical effect of improving the starting efficiency of the disk array can be achieved.
Optionally, determining a boot level of the disk according to the state information of the disk in the disk array, including: determining a starting level of a first disk as a first starting level, wherein the first disk is a disk in the disk array which carries out data reading operation or writing operation last time; determining the starting level of a second disk as a second starting level, wherein the residual storage space of the second disk is less than or equal to a first threshold; determining that the boot level of a third disk is a third boot level, wherein the third disk is a disk in the disk array except for the first disk and the second disk; wherein the first boot level is higher than the second boot level, which is higher than the third boot level.
As an alternative embodiment, after the storage device is started, the data in the disk may be read or written to the disk. If the storage device is suddenly powered off or powered up, the storage device does not know which disk in the disk array to perform read or write operation before being restarted. In this case, the reading or writing operation needs to be performed again, which is tedious and time-consuming. To prevent this, the level of the disk that performs a read or write operation before the storage device crash may be set to the highest boot level in this embodiment. After the storage device is booted, the disk that performed the read or write operation before the booter is first started, so that the read or write operation that was not completed before the booter can be continuously performed. The problem of low efficiency caused by the fact that reading operation needs to be carried out again after the storage device is restarted is solved, and the technical effect of improving the efficiency of reading data or writing data can be achieved.
As an optional implementation manner, the boot level may be set according to the size of the storage space remaining in the disk, and the boot level set for the disk with more data is higher, that is, the disk with the remaining storage space less than or equal to the first threshold is set as the second boot level, where the first threshold may be determined according to actual situations, and may be, for example, 10G, 1G, 500M, and the like. And setting the grades of other disks in the disk array except the first boot grade and the second boot grade as a third boot grade.
As an optional implementation manner, the disks in the disk array may be time-divisionally started according to the sequence of the start levels, and the first disk of the first start level may be started first. After the first disk is started, starting a second disk of a second starting level, and similarly, disks in the disk array which meet that the remaining storage space is smaller than or equal to the first threshold value are collectively referred to as second disks, and the number of the second disks may be one or multiple. And starting other disks in the disk array after the second disk of the second starting level is started. In this embodiment, by performing time-sharing startup on the disks in the disk array, the problem of low startup efficiency can be avoided, and the effect of improving the disk startup efficiency is achieved.
Optionally, the method further comprises: obtaining a data request, wherein the data request comprises: a read data request and a write data request; and determining the starting level of the disk according to the data request and the state information of the disk.
As an optional implementation manner, the start-up levels of the disks in the disk array may be divided according to the obtained operation request. In this embodiment, as shown in fig. 5, which is a schematic diagram of a second structure of a storage device according to an alternative embodiment of the present invention, a power module adopts a conventional specification, a switch controls a circuit switch of a disk array, the switch is managed by a control unit, and the control unit also controls and manages the powering on and the operation of a fan set. The main control unit manages the control unit and interacts data with the disk array, the interacted data comprise read data and write data, and the main control unit simultaneously records and maintains the running state data of the disk array.
As an optional implementation manner, after the storage device is started, after the main control unit is started, the disk operated in the last disk array is firstly queried from the system log or the maintenance data table, and the fan in the corresponding physical fan area is analyzed and identified, and the two are used as the first starting stage. And informs the control unit to start the first starting-stage magnetic disk and the fan first. And then continuously inquiring a system log or maintaining a data table, and identifying the disk which is not empty in the disk array as a second starting stage. The remaining disks and fan sets serve as a third boot stage. Finally, the contents of the second and third starting stages are informed to the control unit, and the control unit starts the operation according to the priority.
As an optional implementation, the master control unit may obtain a data request, where the data request may be a read data request or a write data request. And dividing the disk starting grades in the disk array according to the data requests. After the disk in the disk array is started, reading or writing data can be executed through the communication connection between the main control unit and the disk. For example, if the data is read, the read data request carries data information requested to be read, and the disk storing the data sends the data to the main control unit. If the data is written, the data writing request carries the data requested to be written, and the data can be written into the corresponding disk through the communication connection between the main control unit and the disk.
Optionally, the determining the starting level of the disk according to the data request and the state information of the disk includes: determining that the starting level of a fourth disk is a fourth starting level under the condition that the data request is the read data request, wherein the read data request carries first data requested to be read, and the fourth disk stores the first data; determining the starting level of a fifth disk as a fifth starting level, wherein the data volume stored in the fifth disk is greater than or equal to a second threshold; determining that the boot level of a sixth disk is a sixth boot level, wherein the sixth disk is a disk in the disk array except for the fourth disk and the fifth disk; wherein the fourth boot level is higher than the fifth boot level, which is higher than the sixth boot level.
As an alternative embodiment, in the case where the data request is a read data request, the disk rank in which the data requested to be read is stored may be set to the highest boot rank (fourth boot rank). The boot levels of the remaining disks may be divided according to the amount of data stored in the disks, the boot level having the amount of data stored greater than or equal to the second threshold is set as a fifth boot level, and the disks other than the fourth boot level and the fifth boot level are set as a sixth boot level. In this embodiment, the fourth disk, the fifth disk and the sixth disk are used to refer to disks satisfying corresponding conditions, and may be a generic term of one or more disks.
As an optional implementation manner, the disks may be time-shared started according to the startup level, a fourth disk of a fourth startup level is started first, a fifth disk of a fifth startup level is started after the fourth disk is started, and a sixth disk of a sixth startup level is started after the fifth disk is started. In this embodiment, the disk in the disk array is time-shared started according to the read data request, so that the starting efficiency of the disk can be improved.
Optionally, the determining the starting level of the disk according to the data request and the state information of the disk includes: determining that the starting level of a seventh disk is a seventh starting level under the condition that the data request is the write data request, wherein the write data request carries second data requested to be written, and the residual storage space of the seventh disk is greater than or equal to a third threshold; determining that the boot level of an eighth disk is an eighth boot level, wherein the eighth disk is a disk in the disk array except for the seventh disk.
As an optional implementation manner, in a case that the data request is a write data request, the startup level of the disk with a larger remaining storage space may be set to be the highest, specifically, the third threshold may be set, the disk level with the remaining space greater than or equal to the third threshold is set to be the highest, and after the seventh disk with the highest level is started, the other disks are started. In this embodiment, the seventh disk and the eighth disk are used to refer to disks satisfying corresponding conditions, and may be a generic term of one or more disks.
Optionally, controlling the disk startup in the disk array according to the startup level includes: and sequentially controlling the startup of the disks in the disk array according to the sequence of the startup grade from high to low.
In this embodiment, the startup is performed sequentially according to the startup levels of the disks from high to low, and the startup of the disks of different startup levels may be separated by a predetermined time period, which may be determined according to actual situations, and may be, for example, 3 minutes, 5 minutes, 1 hour, and the like. For example, 5 minutes after the disk of the first boot level is booted, the disk of the second boot level is re-enabled.
Optionally, the method further comprises: determining the starting level of the disks in the disk array every a preset period; establishing an incidence relation between the starting level and a corresponding disk; and recording the association relation.
As an optional embodiment, since the state of the disk is changed, for example, the stored data is changed continuously, and the remaining storage space is also changed continuously, the state of the disk in the disk array may be obtained once every predetermined period, the start level of the disk is updated according to the current state of the disk, the start level and the corresponding disk identifier are stored in a log or a maintenance table in an associated manner, the disk included in the corresponding start level may be determined by looking up a table, and then the corresponding disk start may be controlled.
As an optional implementation manner, fig. 6 is a schematic diagram illustrating a boot flow of a storage device according to an optional embodiment of the present invention, where the boot flow may include the following steps:
step S61, the storage device is powered on or the storage device is started by key triggering;
step S62, the main control unit enables the power module;
step S63, after the master control unit finishes starting, the log or the maintenance table is queried and analyzed to determine the starting level of the disk in the disk array. Specifically, determining that a disk operated before the extension of the storage device is a disk of a first starting level, and determining that a disk of which the remaining storage space is less than or equal to a preset threshold value is a disk of a second starting level; determining the starting grade of the rest of the disks in the disk array as a third starting grade;
step S64, sending instruction information to the control unit to instruct the corresponding disks to be started up sequentially according to the order of the starting level from high to low.
In step S65, the storage device startup flow ends.
In the embodiment, the device is started, the disk array which is operated last time is powered on preferentially, so that the data service is ensured to be connected rapidly, and the disk is not required to be written after the disk array is started. And meanwhile, the fan of the corresponding physical fan area is enabled, so that the working disk can dissipate heat in time. The empty magnetic disks and the residual fan sets are used as a third starting level, so that the current overhead can be saved to the maximum extent, and the method is used for increasing the starting number of the hot disks and reducing the starting time. The power supply module with the conventional specification is adopted for supplying power, so that the cost is greatly reduced, the power supply module is compatible with the general power supply module in the market, and the maintainability is improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a device for controlling the startup of a disk is also provided, and the device is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 7 is a block diagram of an apparatus for controlling disk booting according to an embodiment of the present invention, as shown in fig. 7, the apparatus including: an obtaining module 72, configured to obtain state information of disks in a disk array, where the disk array includes N disks, and N is an integer greater than or equal to 1; a determining module 74, configured to determine a starting level of a disk according to state information of the disk in the disk array; and a control module 76, configured to control disk startup in the disk array according to the startup level.
Optionally, the apparatus is further configured to determine the boot level of the disk according to the status information of the disks in the disk array in the following manner: determining a starting level of a first disk as a first starting level, wherein the first disk is a disk in the disk array which carries out data reading operation or writing operation last time; determining the starting level of a second disk as a second starting level, wherein the residual storage space of the second disk is less than or equal to a first threshold; determining that the boot level of a third disk is a third boot level, wherein the third disk is a disk in the disk array except for the first disk and the second disk; wherein the first boot level is higher than the second boot level, which is higher than the third boot level.
Optionally, the apparatus is further configured to obtain a data request, where the data request includes: a read data request and a write data request; and determining the starting level of the disk according to the data request and the state information of the disk.
Optionally, the apparatus is further configured to determine a boot level of the disk according to the data request and the state information of the disk by: determining that the starting level of a fourth disk is a fourth starting level under the condition that the data request is the read data request, wherein the read data request carries first data requested to be read, and the fourth disk stores the first data; determining the starting level of a fifth disk as a fifth starting level, wherein the data volume stored in the fifth disk is greater than or equal to a second threshold; determining that the boot level of a sixth disk is a sixth boot level, wherein the sixth disk is a disk in the disk array except for the fourth disk and the fifth disk; wherein the fourth boot level is higher than the fifth boot level, which is higher than the sixth boot level.
Optionally, the apparatus is further configured to determine a boot level of the disk according to the data request and the state information of the disk by: determining that the starting level of a seventh disk is a seventh starting level under the condition that the data request is the write data request, wherein the write data request carries second data requested to be written, and the residual storage space of the seventh disk is greater than or equal to a third threshold; determining that the boot level of an eighth disk is an eighth boot level, wherein the eighth disk is a disk in the disk array except for the seventh disk.
Optionally, the apparatus is further configured to implement the controlling, according to the boot level, the booting of the disks in the disk array by: and sequentially controlling the startup of the disks in the disk array according to the sequence of the startup grade from high to low.
Optionally, the apparatus is further configured to determine a boot level of the disks in the disk array every predetermined period; establishing an incidence relation between the starting level and a corresponding disk; and recording the association relation.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring state information of disks in a disk array, wherein the disk array comprises N disks, and N is an integer greater than or equal to 1;
s2, determining the starting level of the disk according to the state information of the disk in the disk array;
and S3, controlling the disk in the disk array to start according to the starting level.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring state information of disks in a disk array, wherein the disk array comprises N disks, and N is an integer greater than or equal to 1;
s2, determining the starting level of the disk according to the state information of the disk in the disk array;
and S3, controlling the disk in the disk array to start according to the starting level.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.