Hard disk protection method and electronic device

By receiving and parsing system power-on and power-off commands, the system determines the hard drive latency, thus resolving the issue of hard drive start-up and shutdown timing mismatch during server power-on and power-off processes, thereby improving hard drive reliability and lifespan.

CN120872263BActive Publication Date: 2025-12-05INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511404567.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2025-12-05
Estimated Expiration
2045-09-29

AI Technical Summary

Technical Problem

Existing servers lack effective management of hard drive start-up and shutdown timings during power-on and power-off processes, leading to timing mismatches and affecting the lifespan of HDDs.

Method used

By receiving system power-on/off commands triggered by different components, parsing the command type, and determining the delay duration based on system and hard drive parameters, the system ensures that the hard drive is not affected by changes in power status during startup and shutdown, thus avoiding abnormal startup and shutdown.

Benefits of technology

It reduces mechanical stress and electrical shock caused by power transients, improving hard drive reliability and extending its lifespan.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120872263B_ABST
    Figure CN120872263B_ABST
Patent Text Reader

Abstract

The application discloses a hard disk protection method and electronic equipment, and relates to the technical field of servers, and comprises the following steps: receiving system power-on and power-off instructions triggered by different components; analyzing the system power-on and power-off instructions, and determining the instruction type of the system power-on and power-off instructions, wherein the instruction type comprises a short power-on and power-off instruction and a long power-on and power-off instruction; in response to the system power-on and power-off instruction being the short power-on and power-off instruction, maintaining the current state of the hard disk; in response to the system power-on and power-off instruction being the long power-on and power-off instruction, determining the delay duration of the power-on and power-off instruction corresponding to the hard disk according to system parameters, parameters of the hard disk and parameters of the system power-on and power-off instruction; and completing the power-on and power-off of the hard disk according to the delay duration of the power-on and power-off instruction corresponding to the hard disk, so that the technical problem that the time sequence may not meet the hard disk start and stop duration in the conventional server start and shutdown operation in the prior art is solved, and the technical effect that the hard disk is not affected by the system power state change before completing the start and stop process is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of servers, and in particular to a hard disk protection method and electronic equipment. BACKGROUND

[0002] In a computer room environment, servers usually adopt dual-redundant power supply combined with UPS (Uninterruptible Power Supply) to effectively prevent abnormal AC (Alternating Current) power failure and provide continuous power at the moment of power failure, ensuring that the server has enough time to complete the normal shutdown process, thereby avoiding damage to the hard disk. In addition, some enterprise-grade HDDs (Hard Disk Drives) have built-in capacitor cache protection mechanisms that use supercapacitors or electrolytic capacitors to quickly discharge when external power supply is interrupted, providing hundreds of milliseconds of power support for critical operations such as cache data writing and head homing. However, this mechanism cannot cover the several to tens of seconds of inertial rotation time required for the hard disk motor to stop rotating. Currently, although power failure protection has been considered in the design of computer room infrastructure and hard disks themselves, there is still a lack of effective management of the timing of hard disk start rotation or stop rotation in the control logic of the server itself, which leads to a mismatch in timing during the normal server startup and shutdown process, thereby affecting the service life of the HDD hard disk.

[0003] Therefore, in view of the shortcomings of the prior art, the present application provides a hard disk protection method. SUMMARY

[0004] The present application provides a hard disk protection method and electronic equipment to at least solve the problem that the timing may not meet the hard disk start-stop duration during the normal server startup and shutdown operation in the related art.

[0005] The present application provides a hard disk protection method, which includes: receiving a system power-on / off instruction triggered by different components; analyzing the system power-on / off instruction to determine the instruction type of the system power-on / off instruction, wherein the instruction type includes a short power-on / off instruction and a long power-on / off instruction; in response to the system power-on / off instruction being a short power-on / off instruction, maintaining the current state of the hard disk; in response to the system power-on / off instruction being a long power-on / off instruction, determining the delay duration of the hard disk corresponding to the power-on / off instruction according to system parameters, hard disk parameters, and parameters of the system power-on / off instruction; and completing the power-on / off of the hard disk according to the delay duration of the hard disk corresponding to the power-on / off instruction.

[0006] The present application also provides an electronic device, which includes: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above hard disk protection methods.

[0007] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described hard disk protection methods.

[0008] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described hard disk protection methods.

[0009] This application achieves the following: By receiving system power-on / off commands triggered by different components; parsing these commands to determine their types (including short-duration and long-duration commands); maintaining the hard drive's current state in response to short-duration commands; and determining the delay duration of the corresponding power-on / off command based on system parameters, hard drive parameters, and the parameters of the system power-on / off command in response to a long-duration command; and completing the hard drive's power-on / off process based on the delay duration of the corresponding power-on / off command, the system ensures that the hard drive is not affected by changes in system power state before completing the start-up or stop-up process. This avoids interruptions to the hard drive's operation during daily server operation, preventing "abnormal start-up and stop," thereby reducing mechanical stress and electrical shocks caused by power transients, improving hard drive reliability, and extending its lifespan. Attached Figure Description

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

[0011] Figure 1 A schematic flowchart illustrating a hard disk protection method provided in an embodiment of this application;

[0012] Figure 2 This is a system schematic diagram of a hard disk protection method provided in an embodiment of this application;

[0013] Figure 3 A timing diagram illustrating a hard disk protection method provided in an embodiment of this application;

[0014] Figure 4 A flowchart illustrating the brief power-on / off commands of a hard disk protection method provided in this application embodiment;

[0015] Figure 5 A flowchart illustrating the brief power-on / off commands of another hard disk protection method provided in this application embodiment;

[0016] Figure 6 A schematic diagram of a forced long-term power-on / off command for a hard disk protection method provided in this application embodiment;

[0017] Figure 7 A structural block diagram of a hard disk protection device provided in an embodiment of this application;

[0018] Figure 8 This is an internal structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

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

[0020] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0021] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0022] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0023] The embodiments of this application provide a hard disk protection method, and the method is described in detail below in conjunction with the execution flow of the hard disk protection method.

[0024] S101: Receives system power-on / off commands triggered by different components.

[0025] Here, system power-on and power-off can include system power-on and system power-off. System power-off can include powering off processing components (such as memory, graphics card, CPU, expansion card, etc.), interface components, and peripheral components (such as fans, heat sinks, hard drives, optical drives, chassis front panel devices, etc.).

[0026] Different components may include BMC (Baseboard Management Controller), BIOS (Basic Input / Output System), chassis buttons, etc.

[0027] This can include manual operation by the customer or automatic operation by the software backend.

[0028] Here, the execution entity can be a CPLD (Complex Programmable Logic Device) in the server.

[0029] The system power-on / off commands can be for routine operations such as powering on / off and resetting the server.

[0030] S102: Parse the system power-on / off commands and determine the command type of the system power-on / off commands, where the command type includes short-term power-on / off commands and long-term power-on / off commands.

[0031] Here, a brief power-on / off command means the system is powered off and then quickly powered on again, or the system is powered on and then quickly powered off again. A long power-on / off command means the system is currently powered on and then performs a long power-off, or the system is currently powered off and then performs a long power-on.

[0032] S103: Responds to system power-on / off commands as brief power-on / off commands, maintaining the current state of the hard disk.

[0033] Here, the hard drive can be an HDD.

[0034] Here, the current status of the hard drive can be normal operation, started spinning, or paused spinning.

[0035] Maintaining the current state of the hard drive means not performing power-on or power-off operations on the hard drive.

[0036] The spin-up process is the process by which the hard drive motor accelerates from a standstill to its rated speed. During this process, the motor requires a large starting current, and the read / write head arm is also in the critical stage of moving from the "parking zone" to the disk. If the power is suddenly cut off during the spin-up process, the motor speed will drop instantly. The mechanical stress at the moment of power failure may cause deformation of the read / write head arm and wear of the magnetic medium on the disk surface. Over time, this may lead to the formation of physical bad sectors.

[0037] The pause in rotation can be a spin-down, which is the process of the motor decelerating from its rated speed to a stop, with the read / write head gradually returning to the parking area. If power is suddenly applied at this time, the motor may be forced to start before it has completely stopped, requiring it to overcome reverse inertia instantly. This can lead to an abnormally increased force on the motor bearings, potentially causing bearing misalignment and bushing wear. If the read / write head has not fully returned to its position, a sudden power application may force the read / write head arm to collide with the disk, causing physical damage.

[0038] S104: In response to the system power-on / off command being a long-duration power-on / off command, determine the delay duration of the corresponding power-on / off command for the hard disk based on the system parameters, hard disk parameters, and system power-on / off command parameters.

[0039] Here, system parameters can include the current time, etc.

[0040] Here, the hard drive parameters can include the hard drive's design parameters (such as boot time and pause time) and the hard drive's operating parameters (last boot time, last pause time, and operating status).

[0041] Here, the parameters of the system power-on / off commands can include various identifiers, preset maximum time intervals, and power-on / off interval durations, etc.

[0042] Here, the power-on / off commands for the hard drive refer to those used to control the hard drive's power-on or power-off states.

[0043] S105: Power on / off the hard drive according to the delay time of the corresponding power-on / off command.

[0044] This can include delaying the power-on and power-off of the hard drive individually to protect it; or, when the hard drive cannot be delayed individually, the power-on and power-off of the entire system can be delayed to protect the hard drive.

[0045] Specifically, when the system receives a power-on or power-off command, the hard drive may be in the process of starting or pausing its rotation. By increasing the delay time, the hard drive is ensured to complete the operation of starting or pausing its rotation before being powered on or off. This avoids powering off the hard drive during the power-on startup period and powering it on during the power-off startup period.

[0046] In one embodiment, the system power-down protection triggered by thermal protection and power supply protection is identified separately in the motherboard CPLD and immediately powers down the system and hard drive.

[0047] In one embodiment, different protection switch options can be set in the BIOS system for different types of system power-on / off commands, allowing customers to flexibly select which hard drive protection functions to enable based on their application habits. These BIOS protection options are synchronously stored in the motherboard CPLD and motherboard BMC after power-on. They are written to the motherboard CPLD via the eSPI interface between the CPU and the motherboard CPLD, and to the motherboard BMC via the eSPI interface between the CPU and the motherboard BMC. Based on the stored hard drive protection options, the motherboard CPLD and motherboard BMC execute the relevant hard drive protection methods during power-on / off and system power-on / off activities.

[0048] It should be noted that this application adjusts the timing of hard drive start-up and shutdown to stagger the hard drive start-up and shutdown process from the server's power-on and power-off operations. This ensures that the hard drive is not affected by changes in the system power state before completing the start-up or shutdown process. In daily server operation, this avoids the hard drive being interrupted by the server's power-on and power-off actions, prevents the hard drive from "abnormal start-up and shutdown," thereby reducing mechanical stress and electrical shocks caused by power transients, improving hard drive reliability, and extending its service life.

[0049] In some specific implementations, receiving system power-on / off commands triggered by different components includes:

[0050] Receive system power-on / off commands triggered by hardware via button signals; and / or,

[0051] Receive system power-on / off commands triggered by the first controller via the first bus interface; and / or,

[0052] The system receives power-on / off commands triggered by the second controller via the second bus interface.

[0053] Here, the hardware can be chassis buttons or server panel buttons.

[0054] Here, the first controller can be a BMC, and the first bus interface can be an I2C (Inter-Integrated Circuit, bidirectional two-wire synchronous serial bus) interface.

[0055] Here, the second controller can be a CPU or BIOS, and the second bus interface can be an eSPI (Enhanced Serial Peripheral Interface) interface.

[0056] Within the same type of system power-on / off command, different components can trigger it. For example, a brief power-on / off command can be triggered by hardware, by the first controller, or by the second controller.

[0057] For example,Figure 2 This is a system schematic diagram in an embodiment of this application, such as... Figure 2 As shown, the system in this application includes: a complex programmable logic device (CPLD), a central processing unit (or basic input / output system) (i.e., a CPU (or BIOS)), a baseboard management controller (BMC), chassis buttons, and a hard disk drive (HDD). The CPLD and BMC transmit data via an I2C interface, and the CPLD and CPU (or BIOS) transmit data via an eSPI interface. The CPLD receives data by receiving button signals from the chassis buttons and provides feedback by activating the button LEDs. The CPU and BMC transmit data via the eSPI interface. The CPLD controls the power-on / off of the system by controlling the CPU (or BIOS), and the CPLD controls the power-on / off of the HDD by controlling the HDD.

[0058] In one embodiment, priority arbitration logic is pre-designed, for example, the hardware priority is greater than the first controller, which is greater than the second controller, so as to avoid logic confusion when multiple components trigger the system power-on / off command at the same time.

[0059] In this way, by aggregating the scattered power-on and power-off requests from different components into a central processing unit for unified decision-making and management, conflicts can be avoided and global optimization can be achieved.

[0060] In some specific implementations, the system power-on / off commands are parsed to determine the command type, including:

[0061] Parse the system power-on / off commands to obtain the command identifier, preset maximum time interval, and power-on / off interval duration of the system power-on / off commands;

[0062] In response to the instruction identifier being the first identifier, it is determined that the system power-on / off instruction is a short-term power-on / off instruction;

[0063] In response to the instruction identifier being the second identifier, the instruction type of the system power-on / off instruction is determined based on the power-on / off interval duration and the preset maximum time interval.

[0064] Here, the first identifier can be the recognition that the instruction is a specific short-term power-on / off instruction, such as cold reset in BIOS, or DC cycle initiated by BMC.

[0065] Here, the power-on / off time interval refers to the time interval from when the system was originally in a power-off state to when it was powered on and then back to power-off, or the time interval from when the system was originally in a power-on state to when it was powered off and then back to power-on.

[0066] In this way, distinguishing between specific instructions and general instructions, and isolating specific instructions, can prevent accidental operation and allow for more precise and efficient control.

[0067] In some specific implementations, the instruction type of the system power-on / off command is determined based on the power-on / off interval duration and a preset maximum time interval, including:

[0068] In response to a power-on / off interval duration being less than or equal to a preset maximum time interval, the system power-on / off command is determined to be a short-term power-on / off command.

[0069] In response to the power-on / off interval being longer than the preset maximum time interval, the system power-on / off command is determined to be a long-duration power-on / off command.

[0070] In one embodiment, the preset maximum time interval can be obtained by combining hardware, software, testing, and reliability requirements. Specifically, the power-on and power-off times of all critical hardware components in the system (such as processors, memory, power management chips, etc.) are identified to obtain the longest hardware power-on time; the time required for software tasks to be performed during power-on and power-off processes, such as operating system startup, driver initialization, data saving, and security verification, is obtained to obtain the longest software power-on time; operational data from multiple historical power-on and power-off operations are collected, and a typical time interval is determined through statistical analysis (such as calculating the average, median, or 95th percentile); extreme cases are then considered, and a first time interval is obtained based on the typical time interval; a safety margin is added to the first time interval to cope with unforeseen delays or environmental changes, resulting in the maximum time interval. For example, assuming the longest hardware power-on time is 3 seconds (including power stabilization and chip initialization), the longest software startup time is 2 seconds (including OS and application loading), and the total worst-case power-on time is 5 seconds, adding a safety margin of 20% yields 5 seconds × 1.2 = 6 seconds. Therefore, the maximum time interval can be set to 6 seconds.

[0071] This ensures the accuracy of instruction classification and system stability.

[0072] For example, Figure 3 This is a timing diagram of an embodiment of this application, such as... Figure 3 As shown, the timing in this application includes: a brief power-off scenario where the system power is short, i.e., the power-off time is less than or equal to the maximum time interval, in which case the hard disk power is not powered off; and a prolonged power-off scenario where the system power is long, i.e., the power-off time is greater than the maximum time interval, in which case the hard disk power-off is delayed.

[0073] In some specific implementations, the method further includes:

[0074] Parse long-time power-on / off commands and obtain the forced flag of the long-time power-on / off command;

[0075] In response to the presence of a mandatory flag, the long-time power-on / off command is determined to be a mandatory long-time power-on / off command.

[0076] In response to the absence of a mandatory flag, the long-duration power-on / off command is determined to be a non-mandatory long-duration power-on / off command.

[0077] Here, the forced long-term power-on / off command can be a system forced shutdown or power-on command triggered by the motherboard BMC or a system forced shutdown or power-on command triggered by the server panel buttons.

[0078] Specifically, based on the presence of specific instruction identifiers, specific instructions such as cold restart and power-off loop are identified and directly determined as short-term power-on / off instructions; the remaining instructions are compared with the power-on / off time interval and the preset maximum time interval to obtain short-term power-on / off instructions and long-term power-on / off instructions; then the long-term power-on / off instructions are parsed and divided into forced long-term power-on / off instructions and non-forced long-term power-on / off instructions.

[0079] In some specific implementations, in response to a long-duration system power-on / off command, the delay duration of the power-on / off command corresponding to the hard drive is determined based on system parameters, hard drive parameters, and system power-on / off command parameters, including:

[0080] In response to the system power-on / off command being a non-forced long-duration power-on / off command, the first delay duration of the corresponding power-on / off command for the hard drive is determined based on the system parameters, hard drive parameters, and system power-on / off command parameters.

[0081] In response to the system power-on / off command being a forced long-time power-on / off command, the processing identifier in the forced long-time power-on / off command is obtained, and the processing method for the forced long-time power-on / off command is determined.

[0082] The first processing method is to determine the first delay duration of the power-on / off command corresponding to the hard disk based on the system parameters, hard disk parameters, and system power-on / off command parameters.

[0083] The second processing method is adopted in response to the processing method. Based on the parameters of the hard disk and the system parameters, the second delay duration of the power-on / off command corresponding to the hard disk is determined.

[0084] Specifically, when the system power-on / off command is a non-forced long-duration power-on / off command, the first delay duration is calculated; when the system power-on / off command is a forced long-duration power-on / off command, the processing method is identified. If it is the first processing method, the first delay duration is calculated; if it is the second processing method, the second delay duration is calculated.

[0085] In this way, the system can make the most reasonable trade-off decisions in different scenarios, achieving high reliability and high availability.

[0086] In some specific implementations, the first delay duration of the power-on / off command corresponding to the hard drive is determined based on system parameters, hard drive parameters, and system power-on / off command parameters, including:

[0087] Determine the start and stop times of the hard drive based on its parameters;

[0088] Compare the start / stop duration with the preset maximum time interval, and use the maximum value as the first delay duration.

[0089] Here, the hard drive's start-stop duration is the factory default setting, and different hard drive models have different start-stop durations. The duration typically ranges from a few seconds to tens of seconds.

[0090] Here, the start-stop time of the hard drive can include the time it takes for the hard drive motor to accelerate from a standstill to its rated speed when it starts, or the time it takes for the hard drive motor to decelerate from its rated speed to a stop when it stops.

[0091] Specifically, the start and stop duration of the hard drive is obtained, and the start and stop duration is compared with the maximum time interval. The larger one is taken as the first delay duration. That is, after receiving the power-on or power-off command, the power-on or power-off command is sent to the hard drive after the first delay duration, so as to ensure that the start and stop of the hard drive is completed.

[0092] Therefore, more emphasis is placed on "preventive" protection, which ensures that the time interval between the hard drive powering down and the last powering up is met by using a fixed threshold, thus preventing the hard drive from being powered on and off during startup and shutdown.

[0093] In some specific implementations, the second delay duration for the power-on / off commands corresponding to the hard drive is determined based on the hard drive parameters and system parameters, including:

[0094] Based on the hard drive's parameters, determine the hard drive's historical data and health attribute data;

[0095] Based on the system parameters, determine the system load and power telemetry data;

[0096] The second latency is calculated based on historical hard drive data, hard drive health attribute data, system load, and power telemetry data using the following formula:

[0097] Where D is the second delay duration, D0 is the base delay duration, F1 is the health factor, F2 is the load factor, F3 is the power factor, F4 is the history factor, exp(·) is the exponential function, and α, β, γ, and δ are adjustable sensitivity coefficients used to adjust the influence of each factor on the delay. It is a very small positive number, used to prevent division by zero when F1=0.

[0098] in, The larger the value, the greater the latency; the larger the F2 value, the greater the latency; the more unstable 1-F3 values ​​are, the greater the latency; the worse the historical performance of 1-F4 values, the greater the latency.

[0099] Specifically, the base latency can be preset, determined based on the hard drive manufacturer's recommendations and system design. Different hard drive models have different base latency durations.

[0100] Specifically, the SMART attributes of the hard drive are collected, and the health factor F1 of the hard drive is obtained by weighting and combining the various attributes in the SMART attributes and then normalizing them; the I / O load of the current system is evaluated and the load factor F2 is calculated; the power factor F3 is obtained based on the power telemetry data; and the historical factor is obtained based on the historical data of the hard drive.

[0101] Specifically, since the second processing method involves powering on and off the entire system, rather than just the hard drive, extending the fixed time in a uniform manner would affect overall efficiency. Therefore, a more precise delay time is calculated for the hard drive to reduce the impact on the system.

[0102] In one embodiment, the start / stop duration and the most recent start / stop time of the hard drive can be determined based on the hard drive parameters; the current time can be determined based on the system parameters; the start / stop interval can be determined based on the current time and the most recent start / stop time; the start / stop interval and the start / stop duration can be compared; in response to the start / stop interval being less than the start / stop duration, the difference between the start / stop duration and the start / stop interval can be calculated, and the difference can be used as the second delay duration.

[0103] Here, the most recent start-stop time can be either the most recent power-on time or the most recent power-off time.

[0104] The current time can be obtained from the motherboard BMC via the I2C interface.

[0105] Specifically, in response to a start-stop interval greater than or equal to the start-stop duration, no delay is applied to power-on / off commands.

[0106] Specifically, the system obtains the most recent hard drive start / stop time and compares it with the current time to confirm whether the interval between the two is greater than the start / stop duration. If the interval does not meet the start / stop duration, the system delays until the start / stop duration is met before initiating the forced shutdown or power-on command. The system also prints in the command input interface how much longer it needs to delay before initiating the forced shutdown or power-on command because the time requirement for starting or stopping the hard drive rotation is not met.

[0107] In this way, by dynamically adjusting the latency based on real-time data, a balance between protection and performance can be struck.

[0108] In some specific implementations, the response to system power-on / off commands is a brief power-on / off command, maintaining the current state of the hard disk, including:

[0109] Write brief power-on / off commands into the power-on / off flags;

[0110] The system controls the hard drive to power on and off based on brief power-on / off commands, maintaining the current state of the hard drive;

[0111] When the system's power-on / off state is restored, the power-on / off flag is cleared.

[0112] Specifically, Figure 4 This is a flowchart illustrating the brief power-on / off commands in an embodiment of this application, as shown below. Figure 4 As shown, the process in this application includes: before triggering the cold reset timing sequence, the Basic Input / Output System (i.e., BIOS) notifies the motherboard CPLD that the current system power-down is a brief power-down through the eSPI interface between the BIOS and the motherboard Complex Programmable Logic Device (i.e., CPLD), and sets the brief power-down flag in the CPLD. When the motherboard CPLD receives the cold reset power-down timing sequence, it checks the flag to confirm that the current power-down is brief. When the system powers down, it does not power down the hard drive, but only powers down the components other than the hard drive. When the system powers up again, it powers up the components other than the hard drive and clears the brief power-down flag.

[0113] Specifically, Figure 5 This is a flowchart illustrating the brief power-on / off commands in an embodiment of this application, as shown below. Figure 5 As shown, the process in this application includes: before triggering the power-down cycle timing, the Basic Input / Output System (i.e., BIOS) notifies the motherboard CPLD that the current system power-down is a brief power-down through the I2C interface between the BMC and the motherboard Complex Programmable Logic Device (i.e., CPLD), and sets the brief power-down flag in the CPLD. When the motherboard CPLD receives the power-down cycle timing, it checks the flag to confirm that the current power-down is brief. When the system powers down, it does not power down the hard drive, but only powers down the components other than the hard drive. When the system powers up again, it powers up the components other than the hard drive and clears the brief power-down flag.

[0114] In this way, the physical start-stop operation of the hard drive during a brief restart is fundamentally avoided, thereby significantly reducing the mechanical wear and current surges of the hard drive and greatly improving its reliability and lifespan.

[0115] In one embodiment, Figure 6 This is a schematic diagram of the forced long-duration power-on / off command flow in an embodiment of this application, as shown below. Figure 6 As shown, the forced long-duration power-on / off command process in this application includes: receiving a forced long-duration power-on / off command, determining whether to enable the first processing method; if yes, issuing the forced long-duration power-on / off command normally; if not, reading the most recent hard disk start / stop time, reading the current time, determining whether the time interval meets the start / stop duration; if yes, issuing the forced long-duration power-on / off command normally; if not, displaying the required delay time on the screen, delaying until the start / stop duration before issuing the forced long-duration power-on / off command.

[0116] It should be understood that, although Figures 1-6 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figures 1-6 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0118] An embodiment of this application also provides a hard disk protection device, comprising: a first processing module 701, configured to receive system power-on / off commands triggered by different components; a second processing module 702, configured to parse the system power-on / off commands and determine the command type of the system power-on / off commands, wherein the command type includes short-duration power-on / off commands and long-duration power-on / off commands; a third processing module 703, configured to maintain the current state of the hard disk in response to a short-duration system power-on / off command; a fourth processing module 704, configured to determine the delay duration of the corresponding power-on / off command of the hard disk based on system parameters, hard disk parameters, and system power-on / off command parameters in response to a long-duration system power-on / off command; and a fifth processing module 705, configured to complete the power-on / off of the hard disk based on the delay duration of the corresponding power-on / off command of the hard disk.

[0119] In a preferred embodiment of this application, the first processing module 701 is specifically used to: receive a hardware-triggered system power-on / off command via a button signal; and / or,

[0120] Receive system power-on / off commands triggered by the first controller via the first bus interface; and / or,

[0121] The system receives power-on / off commands triggered by the second controller via the second bus interface.

[0122] As a preferred implementation, in this embodiment of the application, the second processing module 702 is specifically used to: parse the system power-on / off commands to obtain the command identifier, the preset maximum time interval, and the power-on / off interval duration of the system power-on / off commands;

[0123] In response to the instruction identifier being the first identifier, it is determined that the system power-on / off instruction is a short-term power-on / off instruction;

[0124] In response to the instruction identifier being the second identifier, the instruction type of the system power-on / off instruction is determined based on the power-on / off interval duration and the preset maximum time interval.

[0125] As a preferred implementation, in this embodiment of the application, the second processing module 702 is further configured to: determine that the system power-on / off command is a short power-on / off command in response to the power-on / off interval being less than or equal to a preset maximum time interval;

[0126] In response to the power-on / off interval being longer than the preset maximum time interval, the system power-on / off command is determined to be a long-duration power-on / off command.

[0127] In a preferred embodiment of this application, the device further includes a classification module, which is specifically used to: parse long-term power-on / off commands and obtain the mandatory identifier of the long-term power-on / off commands;

[0128] In response to the presence of a mandatory flag, the long-time power-on / off command is determined to be a mandatory long-time power-on / off command.

[0129] In response to the absence of a mandatory flag, the long-duration power-on / off command is determined to be a non-mandatory long-duration power-on / off command.

[0130] As a preferred implementation, in this embodiment of the application, the fourth processing module 704 is specifically used to: in response to the system power-on / off command being a non-forced long-duration power-on / off command, determine the first delay duration of the power-on / off command corresponding to the hard disk based on the system parameters, the hard disk parameters, and the system power-on / off command parameters;

[0131] In response to the system power-on / off command being a forced long-time power-on / off command, the processing identifier in the forced long-time power-on / off command is obtained, and the processing method for the forced long-time power-on / off command is determined.

[0132] The first processing method is to determine the first delay duration of the power-on / off command corresponding to the hard disk based on the system parameters, hard disk parameters, and system power-on / off command parameters.

[0133] The second processing method is adopted in response to the processing method. Based on the parameters of the hard disk and the system parameters, the second delay duration of the power-on / off command corresponding to the hard disk is determined.

[0134] As a preferred implementation, in this embodiment of the application, the fourth processing module 704 is further configured to: determine the start-up and stop duration of the hard disk based on the parameters of the hard disk;

[0135] Compare the start / stop duration with the preset maximum time interval, and use the maximum value as the first delay duration.

[0136] As a preferred implementation, in this embodiment of the application, the fourth processing module 704 is further configured to: determine the hard disk historical data and hard disk health attribute data based on the hard disk parameters;

[0137] Based on the system parameters, determine the system load and power telemetry data;

[0138] The second latency is calculated based on historical hard drive data, hard drive health attribute data, system load, and power telemetry data using the following formula:

[0139] Where D is the second delay duration, D0 is the base delay duration, F1 is the health factor, F2 is the load factor, F3 is the power factor, F4 is the history factor, exp(·) is the exponential function, and α, β, γ, and δ are adjustable sensitivity coefficients used to adjust the influence of each factor on the delay. It is a very small positive number, used to prevent division by zero when F1=0.

[0140] As a preferred implementation, in this embodiment of the application, the third processing module 703 is further configured to: write the brief power-on / off command into the power-on / off flag bit;

[0141] The system controls the hard drive to power on and off based on brief power-on / off commands, maintaining the current state of the hard drive;

[0142] When the system's power-on / off state is restored, the power-on / off flag is cleared.

[0143] For a description of the features in the embodiments corresponding to the hard disk protection device, please refer to the relevant descriptions in the embodiments corresponding to the hard disk protection method, which will not be repeated here.

[0144] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the hard disk protection method.

[0145] This electronic device can be a server, and its internal structure diagram can be as follows: Figure 8As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores hard disk protection data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a hard disk protection method.

[0146] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above embodiments of the hard disk protection method when it is run.

[0147] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0148] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the hard disk protection method.

[0149] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above embodiments of the hard disk protection method.

[0150] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0151] The above provides a detailed description of a hard disk protection method, electronic device, storage medium, and computer program product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A hard disk protection method, characterized in that, The method includes: Receive system power-on / off commands triggered by different components; Parse the system power-on / off commands to determine the command type of the system power-on / off commands, wherein the command type includes short-term power-on / off commands and long-term power-on / off commands; The system power-on / off command is a brief power-on / off command, maintaining the current state of the hard disk; In response to the system power-on / off command being a long-duration power-on / off command, the delay duration of the power-on / off command corresponding to the hard drive is determined based on the system parameters, hard drive parameters, and system power-on / off command parameters. The power-on and power-off of the hard drive are completed according to the delay time of the power-on / off command corresponding to the hard drive.

2. The hard disk protection method according to claim 1, characterized in that, The receiving of system power-on / off commands triggered by different components includes: Receive system power-on / off commands triggered by hardware via button signals; and / or, Receive system power-on / off commands triggered by the first controller via the first bus interface; and / or, The system receives power-on / off commands triggered by the second controller via the second bus interface.

3. The hard disk protection method according to claim 1, characterized in that, The process of parsing the system power-on / off commands and determining the command type of the system power-on / off commands includes: Parse the system power-on / off commands to obtain the command identifier, preset maximum time interval, and power-on / off interval duration of the system power-on / off commands; In response to the instruction identifier being a first identifier, the system power-on / off instruction is determined to be a short-term power-on / off instruction; In response to the instruction identifier being the second identifier, the instruction type of the system power-on / off instruction is determined based on the power-on / off interval duration and the preset maximum time interval.

4. The hard disk protection method according to claim 3, characterized in that, The step of determining the instruction type of the system power-on / off command based on the power-on / off interval duration and the preset maximum time interval includes: In response to the power-on / off interval being less than or equal to the preset maximum time interval, the system power-on / off command is determined to be a short power-on / off command. In response to the power-on / off interval being longer than the preset maximum time interval, the system power-on / off command is determined to be a long-duration power-on / off command.

5. The hard disk protection method according to claim 4, characterized in that, The method further includes: Parse the long-duration power-on / off command to obtain the forced identifier of the long-duration power-on / off command; In response to the presence of the mandatory identifier, the long-term power-on / off command is determined to be a mandatory long-term power-on / off command; In response to the absence of the mandatory identifier, the long-duration power-on / off command is determined to be a non-mandatory long-duration power-on / off command.

6. The hard disk protection method according to claim 5, characterized in that, The response to the system power-on / off command being a long-duration power-on / off command involves determining the delay duration of the power-on / off command corresponding to the hard drive based on system parameters, hard drive parameters, and system power-on / off command parameters, including: In response to the system power-on / off command being a non-forced long-duration power-on / off command, the first delay duration of the power-on / off command corresponding to the hard disk is determined based on the system parameters, the hard disk parameters, and the system power-on / off command parameters; In response to the system power-on / off command being a forced long-duration power-on / off command, the processing identifier in the forced long-duration power-on / off command is obtained, and the processing method for the forced long-duration power-on / off command is determined; In response to the processing method being the first processing method, the first delay duration of the power-on / off command corresponding to the hard disk is determined based on the system parameters, the hard disk parameters, and the system power-on / off command parameters; In response to the processing method being a second processing method, a second delay duration for the power-on / off command corresponding to the hard disk is determined based on the parameters of the hard disk and the system parameters.

7. The hard disk protection method according to claim 6, characterized in that, The step of determining the first delay duration of the power-on / off command corresponding to the hard drive based on system parameters, hard drive parameters, and system power-on / off command parameters includes: Determine the start and stop times of the hard drive based on its parameters; The start / stop duration is compared with the preset maximum time interval, and the maximum value is taken as the first delay duration.

8. The hard disk protection method according to claim 6, characterized in that, The step of determining the second delay duration of the power-on / off command corresponding to the hard drive based on the parameters of the hard drive and the system parameters includes: Based on the parameters of the hard drive, determine the hard drive's historical data and hard drive health attribute data; Based on the system parameters, determine the system load and power telemetry data; Based on the hard drive historical data, the hard drive health attribute data, the system load, and the power telemetry data, the second latency is calculated using the following formula: ; Where D is the second delay duration, D0 is the base delay duration, F1 is the health factor, F2 is the load factor, F3 is the power factor, F4 is the history factor, exp(·) is the exponential function, and α, β, γ, and δ are adjustable sensitivity coefficients used to adjust the influence of each factor on the delay. It is a very small positive number, used to prevent division by zero when F1=0.

9. The hard disk protection method according to claim 1, characterized in that, The response to the system power-on / off command is a brief power-on / off command, maintaining the current state of the hard disk, including: Write the brief power-on / off command into the power-on / off flag bit; The system is controlled to power on and off according to the brief power-on / off command, maintaining the current state of the hard drive; When the system's power-on / off state is restored, the power-on / off flag is cleared.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the hard disk protection method as described in any one of claims 1 to 9 when executing the computer program.

Citation Information

Patent Citations

  • Power-down hard disk protection device and method and server

    CN111737050A

  • Server power-on and power-off test method and test device

    CN118227390A