Server disk RAID state monitoring method and device and readable storage medium

By monitoring the RAID hardware status and SMART attribute information, it automatically triggers RAID array reconstruction and encrypts log files, solving the problem that RAID monitoring tools in existing technologies cannot monitor detailed information in real time and log management security, and achieving RAID status stability and data security.

CN120687322APending Publication Date: 2025-09-23POWERLEADER TELECOM TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510656843.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

Existing RAID monitoring tools cannot monitor detailed information about RAID hardware in real time, making it difficult to detect potential failure risks in a timely manner. In addition, log management has security issues, affecting system availability and data security.

Method used

By monitoring the RAID hardware status, SMART attribute information, and RAID array status, it automatically triggers array reconstruction and replaces failed disks. It uses the AES algorithm to encrypt log files and generate hash values ​​to ensure the integrity and security of log files.

Benefits of technology

It realizes real-time monitoring of RAID status, timely discovers potential faults, and automatically repairs faulty disks, improving system stability and data security, and ensuring the confidentiality and integrity of log files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687322A_ABST
    Figure CN120687322A_ABST
Patent Text Reader

Abstract

The invention relates to a server disk RAID state monitoring method and device and a readable storage medium. The method comprises the steps that the health state of a battery backup unit is judged according to RAID hardware information; obtaining SMART attribute information to judge the health state of a server disk; obtaining the state of a server disk RAID array, reconstruction progress information and availability information of a hot spare disk so as to judge the performance of the server disk; when the RAID array has the degradation state, a fault disk corresponding to the degradation state in the RAID array is determined, reconstruction of the RAID array is automatically triggered, replacement operation of the fault disk is executed, and alarm information is sent to an upper computer; the RAID hardware information, the SMART attribute information, the state of the RAID array, the reconstruction progress information, the availability information of the hot spare disk and the position information of the fault disk are uploaded to a log file; and encrypting the log file by using an AES algorithm. The accuracy of the method for monitoring the RAID state of the server disk and the safety and reliability of the log file are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for monitoring the status of a server disk RAID, and a readable storage medium. Background Art

[0002] With the rapid development of information technology, server storage systems play a vital role in enterprise applications. Server disk RAID (Redundant Array of Independent Disks) technology is widely used in various mission-critical scenarios because it provides data redundancy, improves storage performance, and improves reliability. However, the stability and reliability of RAID systems depend on real-time monitoring and management of RAID hardware status, disk health, and RAID array configuration.

[0003] In the prior art, RAID monitoring tools typically only provide limited hardware status information, such as basic RAID controller status or simple battery backup unit (BBU) health status. However, these tools often fail to monitor detailed RAID hardware information in real time, such as BBU configuration changes or detailed RAID controller hardware status, making it difficult to promptly identify potential hardware failures. Existing technologies for monitoring RAID array status often only detect whether the array is degraded, but are unable to further determine the specific location of the failed disk or provide detailed rebuild progress information. Furthermore, upon detecting RAID array degradation or disk failure, existing monitoring systems typically require manual intervention to trigger a rebuild or replace the failed disk. This manual process is not only time-consuming and labor-intensive, but can also lead to delayed fault resolution, impacting system availability and data security. Furthermore, existing RAID monitoring systems have shortcomings in log management, such as unencrypted log files and a lack of integrity verification mechanisms. This can lead to log data tampering or leakage, compromising the accuracy of fault analysis and data security. Summary of the Invention

[0004] The present invention provides a method and device for monitoring the RAID status of a server disk, and a readable storage medium, aiming to solve at least one of the technical problems existing in the prior art.

[0005] The technical solution of the present invention is a method for monitoring the status of a server disk RAID, which includes: S100: Monitor the server disk RAID hardware status and determine the health status of the battery backup unit based on the RAID hardware information; S200: Monitoring SMART attribute information of the server disk, and determining the health status of the server disk according to the SMART attribute information; S300: Obtaining the status of the server disk RAID array, reconstruction progress information, and availability information of the hot spare disk, and determining the server disk performance based on the status of the RAID array, the reconstruction progress information, and the availability information of the hot spare disk; S400: When the server disk RAID array is in a degraded state, determine the faulty disk corresponding to the degraded state in the RAID array, automatically trigger the reconstruction of the RAID array, perform a replacement operation on the faulty disk, and send an alarm message to the host computer; S500: Upload the server disk RAID hardware information, the SMART attribute information, the status of the RAID array, the reconstruction progress information, the availability information of the hot spare disk, and the location information of the faulty disk to a log file; S600: Read the log file, encrypt the log file using an AES algorithm, generate a first hash value for the log file, and save the encrypted log file and the first hash value.

[0006] According to some embodiments of the present invention, step S100 includes: S110: Use the lspci-vvv command to obtain server disk RAID hardware information, and store the server disk RAID hardware information in a configuration file; S120: Checking the status of the battery backup unit through the storcli command, and determining whether the status of the battery backup unit is abnormal; S130: When it is detected that the battery backup unit is in an abnormal state, record the abnormal state of the battery backup unit and upload the abnormal state of the battery backup unit to the log file; S140: When it is detected that the battery backup unit is in a normal state, performing a configuration change detection on the battery backup unit; S150: When there is a configuration change of the battery backup unit, record alarm information of the configuration change of the battery backup unit, and update the log file with the current configuration information of the battery backup unit.

[0007] According to some embodiments of the present invention, step S200 includes: S210: Use the storcli command to obtain a list of disks to monitor each disk. S220: Using the smartctl -a command to obtain SMART information of each disk, extracting key indicators from the SMART information, wherein the key indicators include a reallocated sector count indicator and a temperature indicator; S230: traversing the disk list, performing a bad sector check on each disk, and determining whether the number of bad sectors on the current disk is greater than a first threshold based on the reallocated sector number indicator corresponding to each disk; if the number of bad sectors on the current disk is greater than the first threshold, recording that the number of bad sectors on the current disk exceeds the threshold; S240: Compare the number of bad sectors on the current disk with the number of historical bad sectors. If the number of bad sectors on the current disk is greater than the number of historical bad sectors, update the number of historical bad sectors with the number of bad sectors on the current disk. S250: Determine whether the temperature of the current disk is greater than a second threshold value based on the temperature index corresponding to each disk. If the temperature of the current disk is greater than the second threshold value, record that the temperature of the current disk is too high and send a high temperature alarm message.

[0008] According to some embodiments of the present invention, step S300 includes: S310: Obtain the status of the server disk RAID array and check whether the RAID array is in a degraded state using the storcli command; S320: If the RAID array is detected to be in a degraded state, record array degradation alarm information; S330: Determine whether the RAID array is in a rebuilding state. If the RAID array is in a rebuilding state, obtain and record the rebuilding progress information. S340: Detect whether there is an available hot spare disk in the RAID array. If there is no available hot spare disk, record a warning message indicating that there is no available hot spare disk, and send a message for adding an available hot spare disk.

[0009] According to some embodiments of the present invention, step S400 includes: S410: If it is detected that the RAID array is in a degraded state, determine a faulty disk corresponding to the degraded state in the RAID array, and obtain location information of the faulty disk; S420: Detect whether there is an available hot spare disk in the RAID array. If there is an available hot spare disk, use the storcli command to automatically trigger a RAID array reconstruction operation to replace the failed disk. S430: determining a fault level according to the number of faulty disks, and sending alarm information of different levels to the host computer according to the fault level; S440: If there is no available hot spare disk, a lack of available hot spare disk alarm message is sent to the host computer to prompt the administrator to manually intervene.

[0010] According to some embodiments of the present invention, the method further comprises: S700: Obtain the status information of the power distribution unit of the server disk through the SNMP protocol; S710: Determine whether the power distribution unit is in an abnormal state according to the state information of the power distribution unit; S720: If it is detected that the power distribution unit is powered off, it is determined that the power distribution unit is in an abnormal state; S730: Record the abnormal information of the power distribution unit, send the abnormal information of the power distribution unit to the host computer, and trigger a safe shutdown process.

[0011] According to some embodiments of the present invention, after triggering the safety shutdown process, the method further includes: S740: Stop the rebuilding operation of the RAID array; S750: Synchronize all information of the log file, and after all information of the log file is successfully synchronized, delay shutdown for a preset time.

[0012] According to some embodiments of the present invention, step S100 further includes: S160: Determine whether the state of the battery backup unit is in a preset optimal state, so that the battery backup unit provides power guarantee for the disk RAID cache; S170: When a configuration change of the battery backup unit is detected, calculating a second hash value of the configuration file by using md5sum; S180: Determine the consistency between the second Hash value and the first Hash value to determine the integrity of the configuration file.

[0013] The technical solution of the present invention also relates to a computer device, comprising a memory and a processor, wherein the processor implements the above method when executing a computer program stored in the memory.

[0014] The technical solution of the present invention further relates to a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions implement the above-mentioned method when executed by a processor.

[0015] The server disk RAID status monitoring method, device, and readable storage medium provided by the embodiments of the present invention have at least one of the following advantages or beneficial effects: Monitor the server disk RAID hardware status and obtain server disk RAID hardware information, such as obtaining detailed RAID controller information, parsing RAID controller details, and checking the battery backup unit (BBU) status field to determine the BBU's health. Continuously monitoring controller status can promptly identify potential issues and avoid data loss or system downtime caused by controller failure. Monitor the server disk's SMART attribute information. Through self-monitoring and analysis of SMART attributes, the server disk's health status can be determined. Obtain the server disk RAID array status, rebuild progress information, and hot spare drive availability information. The RAID array status directly affects the storage system's performance and data redundancy. Promptly identifying RAID array degradation or rebuild failures can effectively ensure stable system operation. Based on a comprehensive assessment of the RAID status, rebuild progress, and hot spare drive availability, if the RAID status is Degraded and no hot spare drive is available, the server disk may be affected.

[0016] When the server disk RAID array is in a degraded state, it automatically triggers the reconstruction of the RAID array, determines the location of the faulty disk, and performs a safe replacement operation for the faulty disk. An alarm message is sent to the host computer, and the administrator is notified in a timely manner through the alarm mechanism. The automatic repair mechanism can respond quickly after detecting a faulty disk, reducing system downtime and improving storage system availability.

[0017] Writes information such as RAID hardware information, SMART attributes, RAID status, rebuild progress, hot spare disk availability, and failed disk location into log files, effectively protecting server disk RAID data integrity and traceability. Uses the AES algorithm to encrypt log files to ensure the confidentiality of log file data and prevent unauthorized access. Generates a SHA-256 hash value for the log file for subsequent integrity verification, ensuring that the log file has not been tampered with and enhancing log file security.

[0018] In addition, additional aspects and advantages of the present invention will be set forth in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is an overall flow chart of a method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 2 This is a first detailed flow chart of step S100 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 3This is a detailed flow chart of step S200 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 4 This is a detailed flow chart of step S300 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 5 This is a detailed flow chart of step S400 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 6 This is a first detailed flow chart of a method for monitoring the server disk RAID status provided by an embodiment of the present invention; Figure 7 This is a second detailed flow chart of step S100 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The following will provide a clear and complete description of the concept, specific structure and technical effects of the present invention in conjunction with the embodiments and drawings to fully understand the purpose, scheme and effects of the present invention.

[0021] It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to the other feature, or it may be indirectly fixed or connected to the other feature. The singular forms "a", "said" and "the" used herein are also intended to include the plural forms, unless the context clearly indicates otherwise. In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art. The terms used in this specification are only for describing specific embodiments and are not intended to limit the invention. The term "and / or" used herein includes any combination of one or more related listed items.

[0022] It should be understood that, although the present invention may adopt the terms first, second, third etc. to describe various elements, these elements should not be limited to these terms. These terms are only used to distinguish the elements of the same type from each other. For example, without departing from the scope of the present invention, the first element may also be referred to as the second element, and similarly, the second element may also be referred to as the first element. The use of any and all examples or exemplary language ("for example", "such as" etc.) provided herein is only intended to better illustrate embodiments of the present invention, and unless otherwise required, will not impose limitations on the scope of the present invention.

[0023] In the prior art, RAID monitoring tools typically only provide limited hardware status information, such as basic RAID controller status or simple battery backup unit (BBU) health status. However, these tools often fail to monitor detailed RAID hardware information in real time, such as BBU configuration changes or detailed RAID controller hardware status, making it difficult to promptly identify potential hardware failures. Existing technologies for monitoring RAID array status often only detect whether the array is degraded, but are unable to further determine the specific location of the failed disk or provide detailed rebuild progress information. Furthermore, upon detecting RAID array degradation or disk failure, existing monitoring systems typically require manual intervention to trigger a rebuild or replace the failed disk. This manual process is not only time-consuming and labor-intensive, but can also lead to delayed fault resolution, impacting system availability and data security. Furthermore, existing RAID monitoring systems have shortcomings in log management, such as unencrypted log files and a lack of integrity verification mechanisms. This can lead to log data tampering or leakage, compromising the accuracy of fault analysis and data security.

[0024] Based on this, the embodiment of the present invention provides a server disk RAID status monitoring method, device and readable storage medium. By analyzing the disk RAID hardware information, the health status of the battery backup unit is judged. Through self-monitoring and analysis of SMART attributes, the health status of the server disk can be judged, the status of the server disk RAID array, reconstruction progress information and availability information of the hot spare disk can be obtained, and problems such as RAID array degradation or reconstruction failure can be discovered in time, which can effectively ensure the stable operation of the system. When the server disk RAID array is in a degraded state, the reconstruction of the RAID array is automatically triggered, the location information of the faulty disk is determined, and the safe replacement operation of the faulty disk is performed. The alarm information is sent to the host computer, and the administrator is notified in time through the alarm mechanism, thereby improving the accuracy of the server disk RAID status monitoring method, and using the AES algorithm to encrypt the log file to improve the security and reliability of the log file.

[0025] Reference Figure 1 As shown, Figure 1 This is an overall flow chart of a method for monitoring the server disk RAID status provided by an embodiment of the present invention. The method for monitoring the server disk RAID status includes but is not limited to steps S100 to S600. Specifically, S100: Monitor the server disk RAID hardware status and determine the health status of the battery backup unit based on the RAID hardware information; S200: Monitor the SMART attribute information of the server disk and determine the health status of the server disk according to the SMART attribute information; S300: Obtaining the status of the server disk RAID array, reconstruction progress information, and availability information of the hot spare disk, and determining the server disk performance based on the status of the RAID array, reconstruction progress information, and availability information of the hot spare disk; S400: When the server disk RAID array is in a degraded state, a faulty disk corresponding to the degraded state in the RAID array is determined, and a RAID array reconstruction is automatically triggered, the faulty disk is replaced, and an alarm message is sent to the host computer; S500: Upload the server disk RAID hardware information, SMART attribute information, RAID array status, rebuild progress information, hot spare disk availability information, and fault disk location information to a log file; S600: Read a log file, encrypt the log file using an AES algorithm, generate a first hash value for the log file, and save the encrypted log file and the first hash value.

[0026] In some embodiments of the present invention, a method for monitoring the status of a server disk RAID includes: monitoring the server disk RAID hardware status and obtaining server disk RAID hardware information, such as obtaining detailed information about the RAID controller, including the health status of the battery backup unit (BBU); parsing the RAID controller details and checking the BBU status field (e.g., BBU Status); and determining whether the BBU status field is OK or Failed to determine the BBU health status. As a core component of a storage system, the RAID controller's status is directly related to the stability and data security of the entire storage system. By continuously monitoring the controller status, potential problems can be promptly identified, preventing data loss or system downtime caused by controller failure. Monitoring the SMART attribute information of the server disks includes information about bad sectors and temperature. Self-monitoring and analysis of these SMART attributes can determine the health status of the server disks. The SMART overall-health self-assessment test result field is specifically monitored to determine the health of the disks. If the result is PASSED, the disk is healthy; if it is FAILED, the disk may be faulty. Obtain information about the server's RAID array status, rebuild progress, and hot spare drive availability. The RAID array status directly affects the storage system's performance and data redundancy. Promptly detecting issues like RAID array degradation or rebuild failures effectively ensures stable system operation. Based on the RAID status, rebuild progress, and hot spare drive availability, if the RAID status is Degraded and no hot spare drive is available, the server's disks may be affected.

[0027] When the server disk RAID array is degraded, use the MegaCLI -PDList -aALL command to search for disks in the Failed state. Use the MegaCLI -PDRbld -Start -PhysDrv [E:S] -a0 command to automatically trigger a RAID array rebuild, where E:S is the slot position of the failed disk. This determines the location of the failed disk and safely replaces it. Alarms are sent to the host computer via email, SMS, or a host computer interface. The alarm mechanism promptly notifies the administrator. The automatic repair mechanism responds quickly after detecting a failed disk, reducing system downtime and improving storage system availability.

[0028] RAID hardware information, SMART attributes, RAID status, rebuild progress, hot spare disk availability, and failed disk location are written to log files, effectively ensuring the data integrity and traceability of server disk RAID. Log files are an important basis for server disk failure analysis and security audits. Log files are encrypted using the AES algorithm to ensure the confidentiality of log file data and prevent unauthorized access. SHA-256 hash values ​​are generated for log files for subsequent integrity verification to ensure that the log files have not been tampered with. A first hash value is also generated for the log file, and the encrypted log file and hash value are saved in a secure location, effectively ensuring the stability and data security of the server disk RAID. At the same time, encryption and hash value verification enhance the security of log files.

[0029] Reference Figure 2 As shown, Figure 2 This is a first detailed flow chart of step S100 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. Step S100 includes but is not limited to steps S110 to S150. Specifically, S110: Use the lspci-vvv command to obtain the server disk RAID hardware information and store the server disk RAID hardware information in the configuration file; S120: Use the storcli command to check the status of the battery backup unit and determine whether the battery backup unit is in an abnormal state. S130: When it is detected that the battery backup unit is in an abnormal state, the abnormal state of the battery backup unit is recorded and uploaded to a log file; S140: When it is detected that the battery backup unit is in a normal state, a configuration change detection is performed on the battery backup unit; S150: When there is a configuration change of the battery backup unit, alarm information of the configuration change of the battery backup unit is recorded, and a log file is updated with the current configuration information of the battery backup unit.

[0030] In some embodiments of the present invention, the server disk RAID hardware status is monitored, and the server disk RAID hardware information is obtained. The health status of the battery backup unit is determined based on the RAID hardware information, including: first, real-time monitoring of the RAID card hardware status, battery backup unit (BBU) health check, and RAID controller configuration change detection. As a core component of the storage system, the status of the RAID controller is directly related to the stability and data security of the entire storage system. By continuously monitoring the controller status, potential problems can be discovered in a timely manner to avoid data loss or system downtime caused by controller failure. Use the lspci -vvv command to obtain detailed information about the RAID controller and save it to a temporary file for subsequent comparison and analysis. Use the storcli command to check the status of the battery backup unit and analyze whether the status of the battery backup unit is in an abnormal state; if the battery backup unit is detected to be in an abnormal state, the abnormal situation of the battery backup unit is recorded, and the abnormal information is uploaded to the log file, effectively ensuring the data integrity and data traceability of the battery backup unit status. If it is detected that the battery backup unit is in a normal state, a configuration change detection is performed on the battery backup unit to determine whether there is a configuration change of the battery backup unit. The current configuration information of the battery backup unit is compared with the historical configuration. If it is found that the current configuration information of the battery backup unit is inconsistent with the historical configuration, it is determined that there is a configuration change of the battery backup unit, and an alarm information of the configuration change of the battery backup unit is recorded. At the same time, the current configuration information of the battery backup unit is updated to the log file to provide basic data for subsequent monitoring and analysis.

[0031] In some embodiments of the present invention, monitoring the server disk RAID hardware status, obtaining the server disk RAID hardware information, and determining the health status of the battery backup unit based on the RAID hardware information are implemented by the following code: #! / bin / bash # Enhanced controller monitoring script CONTROLLER_LOG=" / var / log / raid_controller.log" check_controller() { # 1. Get the RAID card hardware status lspci -vvv > / tmp / current_controller.log # 2. Check the battery backup unit (BBU) status (key indicator) storcli / c0 show bbustatus | grep -q "Optimal" if [ $? -ne 0 ]; then echo "[CRITICAL] BBU status abnormal!" >> $CONTROLLER_LOG return 1 fi # 3. Configuration change detection if [ -f $CONTROLLER_LOG ]; then diff / tmp / current_controller.log $CONTROLLER_LOG > / dev / null if [ $? -ne 0 ]; then echo "[WARNING] Configuration changed!" >> $CONTROLLER_LOG md5sum / tmp / current_controller.log >> $CONTROLLER_LOG fi fi # 4. Update Log cp / tmp / current_controller.log $CONTROLLER_LOG } check_controller In some embodiments of the present invention, log files are cleaned up regularly through automated scripts to prevent the files from becoming too large. At the same time, configuration files of the battery backup unit are backed up regularly for easy recovery.

[0032] The log file cleanup script can clean up old logs based on log file size or timestamp.

[0033] Implementation steps: Check the log file size: If the file size exceeds the specified threshold, clean it up; Clean up by timestamp: Keep the logs of the last few days and delete the old logs; Record cleanup operations: Record the cleanup operations in a separate log file.

[0034] The BBU configuration file backup script can periodically back up the current BBU configuration file and retain a certain number of historical backups.

[0035] Implementation steps: Get the current battery backup unit configuration: Use the storcli command to get the current battery backup unit configuration; Back up the configuration file: Save the current configuration to a backup file with a timestamp; Clean up old backups: Keep a certain number of recent backup files and delete old backups.

[0036] Through the above method, regular cleaning of log files and regular backup of configuration files of the battery backup unit are achieved, thereby better managing the operation and maintenance of the server.

[0037] Reference Figure 3 As shown, Figure 3 This is a detailed flow chart of step S200 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. Step S200 includes but is not limited to steps S210 to S250. Specifically, S210: Use the storcli command to obtain a list of disks to monitor each disk. S220: Use the smartctl -a command to obtain the SMART information of each disk and extract key indicators from the SMART information, including the number of reallocated sectors and temperature. S230: Traversing the disk list, performing a bad sector check on each disk, and determining whether the number of bad sectors on the current disk is greater than a first threshold based on the reallocated sector count indicator corresponding to each disk. If the number of bad sectors on the current disk is greater than the first threshold, recording that the number of bad sectors on the current disk exceeds the threshold; S240: Compare the number of bad sectors on the current disk with the historical bad sector number record. If the number of bad sectors on the current disk is greater than the historical bad sector number record, update the historical bad sector number record with the number of bad sectors on the current disk. S250: Determine whether the temperature of the current disk is greater than a second threshold value based on the temperature index corresponding to each disk. If the temperature of the current disk is greater than the second threshold value, record that the temperature of the current disk is too high and send a high temperature alarm message.

[0038] In some embodiments of the present invention, the storcli command is used to obtain a disk list to monitor each disk. The disk list is parsed and the device number and location information of each disk are extracted. Then, the smartctl -a command is used to obtain the SMART information of each disk and save it to a temporary file. The disk list is traversed, and the smartctl -a command is run for each disk to extract key indicators from the SMART information, such as "Reallocated_Sector_Ct" (the number of reallocated sectors) and "Temperature_Celsius" (the temperature indicator), and threshold judgment is performed. The number of bad sectors on the disk is determined based on the number of reallocated sectors, and then it is determined whether the number of bad sectors on the current disk is greater than 50. If the number of bad sectors on the current disk is greater than 50, the number of bad sectors on the current disk is recorded, and the number of bad sectors on the current disk exceeds the limit to generate a warning message. Compare the current disk's bad sector count with the historical bad sector count record. If the current disk's bad sector count increases compared to the historical bad sector count record, record the newly added bad sector count and update the historical bad sector count record with the current disk's bad sector count, providing a basis for subsequent disk maintenance.

[0039] The system determines the current disk temperature based on the Temperature_Celsius value and checks whether the current disk temperature is greater than 60°C. If the current disk temperature is greater than 60°C, the system records that the current disk temperature is too high and sends a high temperature alarm.

[0040] Through the above method, regular monitoring of server disks can be achieved, bad sectors and temperature anomalies can be discovered in a timely manner, and alarm information can be sent, thereby better managing the operation and maintenance of the server.

[0041] In some embodiments of the present invention, monitoring the SMART attribute information of the server disk and determining the health status of the server disk according to the SMART attribute information is implemented by the following code: #! / bin / bash # Get the disk list DISK_LIST=$(storcli / c0 show | grep -A 100 "EID:Slt" | grep -v "EID:Slt" | awk '{print $1}') for disk in $DISK_LIST; do # 1. Get SMART attribute information smartctl -a / dev / $disk > / tmp / disk_$disk.log # 2. Key indicator inspection REALLOC=$(grep "Reallocated_Sector_Ct" / tmp / disk_$disk.log | awk'{print $10}') TEMP=$(grep "Temperature_Celsius" / tmp / disk_$disk.log | awk '{print $10}') # 3. Threshold determination if [ $REALLOC -gt 50 ]; then echo "[ERROR] $disk bad sectors exceed limit: $REALLOC" >> / var / log / disk_health.log fi if [ $TEMP -gt 60 ]; then echo "[WARNING] $disk temperature is too high: $TEMP℃" >> / var / log / disk_health.log fi # 4. Historical Data Comparison if [ -f / var / log / disk_$disk.last ]; then LAST_REALLOC=$(grep "Reallocated" / var / log / disk_$disk.last |awk '{print $10}') if [ $REALLOC -gt $LAST_REALLOC ]; then echo "[NOTICE] $disk New bad sectors: $((REALLOC-LAST_REALLOC))">> / var / log / disk_health.log fi fi cp / tmp / disk_$disk.log / var / log / disk_$disk.last done Reference Figure 4 As shown, Figure 4This is a detailed flow chart of step S300 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. Step S300 includes but is not limited to steps S310 to S340. Specifically, S310: Get the status of the server disk RAID array and use the storcli command to check whether the RAID array is in a degraded state. S320: If the RAID array is detected to be in a degraded state, record array degradation alarm information; S330: Determine whether the RAID array is in a rebuilding state. If the RAID array is in a rebuilding state, obtain and record the rebuilding progress information. S340: Detect whether there is an available hot spare disk in the RAID array. If there is no available hot spare disk, record a warning message indicating that there is no available hot spare disk, and send a message to add an available hot spare disk.

[0042] It is understood that the degraded state of a RAID array refers to the failure of one or more disks in the RAID array, resulting in the RAID not being able to fully function, but still providing data access. This situation usually occurs in redundancy levels such as RAID 1, RAID 5, and RAID 6, because these RAID levels allow for continued operation in the event of some disk failures.

[0043] In some embodiments of the present invention, the status of a server disk RAID array, reconstruction progress information, and availability information of a hot spare disk are obtained, and the server disk performance is judged based on the status of the RAID array, the reconstruction progress information, and the availability information of the hot spare disk. Specifically, the storcli / c0 show command is used to obtain the status information of the RAID controller, and the output containing the "LDs:" (Logical Drives) portion is extracted through grep, which contains the status information of the RAID array, thereby obtaining the status of the server disk RAID array. The storcli / c0 / vall show |grep -c "Dgd" is used to query whether the value of "Dgd" exists to determine whether the RAID array is in a degraded state. If the RAID array is detected to be in a degraded state, array degradation alarm information is recorded, and an email is sent to notify the administrator.

[0044] Use the storcli command (storcli / c0 show rebuild | grep -c "Progress") to check whether the "Progress" value exists to determine whether the RAID array is in the rebuilding state. If the RAID array is in the rebuilding state, obtain and record the rebuild progress information to help administrators understand the rebuild status.

[0045] Use the storcli command (storcli / c0 show all | grep -A 10 "HSP" | grep -c "Available") to check whether the value "Available" exists to determine whether there is an available hot spare drive in the RAID array. If no hot spare drive is available, a warning message indicating the lack of available hot spare drives is recorded and a message requesting that an available hot spare drive be added is sent to prompt the user to add a hot spare drive in a timely manner to ensure system redundancy.

[0046] Detects RAID array degradation, rebuild progress, and hot spare disk availability. The RAID array status directly affects the performance and data redundancy of the storage system. Promptly detecting issues such as array degradation or rebuild failure can effectively ensure stable system operation and better manage server operation and maintenance.

[0047] In some embodiments of the present invention, obtaining the status of a server disk RAID array, reconstruction progress information, and availability information of a hot spare disk, and determining the server disk performance based on the status of the RAID array, the reconstruction progress information, and the availability information of the hot spare disk, is implemented by the following code: #! / bin / bash # RAID array status check check_array() { # 1. Check the downgrade status DEGRADED=$(storcli / c0 / vall show | grep -c "Dgd") if [ $DEGRADED -gt 0 ]; then echo "[URGENT] Array degradation detected!" >> / var / log / raid_status.log return 1 fi # 2. Check the rebuild progress REBUILDING=$(storcli / c0 show rebuild | grep -c "Progress") if [ $REBUILDING -gt 0 ]; then PROGRESS=$(storcli / c0 show rebuild | grep "Progress" | awk '{print $3}') echo "[INFO] Rebuilding, progress: $PROGRESS" >> / var / log / raid_status.log fi # 3. Hot spare disk check HOTSPARE=$(storcli / c0 show all | grep -A 10 "HSP" | grep -c "Available") if [ $HOTSPARE -eq 0 ]; then echo "[WARNING] No hot spare disk available!" >> / var / log / raid_status.log fi } check_array Reference Figure 5 As shown, Figure 5 This is a detailed flow chart of step S400 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. Step S400 includes but is not limited to step S410 to step S440. Specifically, S410: If it is detected that the RAID array is in a degraded state, determine the faulty disk corresponding to the degraded state in the RAID array, and obtain location information of the faulty disk; S420: Check whether there is an available hot spare disk in the RAID array. If there is an available hot spare disk, use the storcli command to automatically trigger a RAID array reconstruction operation to replace the failed disk. S430: Determine the fault level according to the number of faulty disks, and send different levels of alarm information to the host computer according to the fault level; S440: If there is no available hot spare disk, a lack of available hot spare disk alarm message is sent to the host computer to prompt the administrator to manually intervene.

[0048] In some embodiments of the present invention, when the server disk RAID array is in a degraded state, the faulty disk corresponding to the degraded state in the RAID array is determined, and the reconstruction of the RAID array is automatically triggered, the faulty disk is replaced, and an alarm message is sent to the host computer, including: using the storcli / c0 show command to obtain the status of the RAID array, and checking whether it contains "State: Degraded" to determine whether it is in a degraded state. If the RAID array is detected to be in a degraded state, the storcli / c0 show all command is used to obtain detailed information, and the location information of the faulty disk is extracted through grep and awk. Checking whether "Dedicated Hot Spare" or "Global Hot Spare" exists to determine whether a hot spare disk is available. If an available hot spare disk is available, the storcli / c0 start rebuild command is used to trigger the reconstruction, and the storcli / c0 replace failed command is used to replace the faulty disk. The fault level is determined according to the number of faulty disks, and different levels of alarm information are sent. If there is no available hot spare disk, the alarm level is increased, prompting the administrator to manually intervene.

[0049] Automatically triggers a RAID array rebuild, safely replacing a failed disk and promptly notifying the administrator through a multi-level alert mechanism. This automatic repair mechanism rapidly responds to detected failures, reducing system downtime and improving storage system availability. The highly automated repair process enables rapid response to failures without human intervention, ensuring continuous system operation. All operations and status are recorded in log files for easy review.

[0050] Through the above method, regular monitoring of the server disk RAID array status is achieved, faulty disks are automatically handled, and alarm information is sent according to the fault level, thereby better managing the server operation and maintenance work.

[0051] In some embodiments of the present invention, when the server disk RAID array is in a degraded state, a faulty disk corresponding to the degraded state in the RAID array is determined, and a RAID array reconstruction is automatically triggered, the faulty disk is replaced, and an alarm message is sent to a host computer. This is achieved by the following code: """Execute the repair process""" # 1. Check the downgrade status ret = os.popen("storcli / c0 / vall show | grep Dgd").read() if not ret: return True # 2. Get the location of the failed disk bad_disk = os.popen("storcli / c0 / vall show | grep Dgd | awk '{print $2}'").read().strip() # 3. Check the hot spare disk hs_status = os.popen("storcli / c0 show all | grep -A 10HSP").read() if "Available" in hs_status: self.trigger_rebuild(bad_disk) self.send_alert(f"Automatically started rebuilding the faulty disk: {bad_disk}") else: self.alert_level = 2 self.send_alert(f"No hot spare disk! Need to manually handle the faulty disk: {bad_disk}") if __name__ == "__main__": repair = RaidRepair() repair.execute_repair() Reference Figure 6 As shown, Figure 6 This is a first detailed flow chart of a method for monitoring the server disk RAID status provided by an embodiment of the present invention. The method for monitoring the server disk RAID status also includes but is not limited to steps S700 to S730. Specifically, S700: Obtain the status information of the power distribution unit of the server disk through the SNMP protocol; S710: Determine whether the power distribution unit is in an abnormal state according to the state information of the power distribution unit; S720: If it is detected that the power distribution unit is powered off, it is determined that the power distribution unit is in an abnormal state; S730: Record the abnormal information of the power distribution unit, send the abnormal information of the power distribution unit to the host computer, and trigger the safety shutdown process.

[0052] Monitoring power distribution units (PDUs) ensures a safe shutdown process in the event of a power failure. Power failure is a common cause of storage system downtime. Real-time monitoring and prompt response can effectively protect data integrity.

[0053] In some embodiments of the present invention, the snmpget command is used via the SNMP protocol to obtain the status information of the power distribution unit. Typically, the status information of the power distribution unit can be obtained using a specific OID (Object Identifier). Replace oid_power_status with the actual OID. It is usually necessary to consult the PDU documentation to obtain the correct OID. Assuming the status value of the power distribution unit is 0, adjust the judgment criteria based on the actual power distribution unit documentation. Based on the obtained status information, determine whether the power distribution unit is in an abnormal state.

[0054] If the power distribution unit (PDU) is turned off, the PDU is considered abnormal. Assume the PDU status value is 0 and adjust the judgment criteria based on the actual PDU documentation. Record PDU abnormality information in a log file. Send the PDU abnormality information to the host computer via email or other means. Use the shutdown -h now command to trigger a safe shutdown of the server.

[0055] By using the above method, you can monitor the status of the server's disk power distribution unit, detect anomalies in a timely manner, and trigger the safe shutdown process, thereby better managing the server's operation and maintenance work.

[0056] In some embodiments of the present invention, the method for monitoring the server disk RAID status further includes but is not limited to steps S740 to S750. Specifically, S740: Stop the RAID array rebuild operation; S750: Synchronize all information in the log file. After all information in the log file is successfully synchronized, delay shutdown for a preset time.

[0057] In some embodiments of the present invention, the storcli command is used to stop the rebuild of a RAID array. The command's return value ($?) is checked. If the return value is 0, the operation is successful. The sync command is used to ensure that all log file contents are written to disk. The sync command's return value is checked to ensure that the synchronization operation is successful. After all log file information is successfully synchronized, the sleep command is used to delay the synchronization for a preset time (e.g., 60 seconds). The shutdown -h now command is used to trigger a safe shutdown of the server, causing it to shut down after 60 seconds.

[0058] In the event of a power failure, all rebuild tasks are stopped, the file system is synchronized, and then shutdown is delayed to ensure data consistency and integrity, preventing data corruption caused by sudden power outages. This approach allows for better management of server operations and maintenance.

[0059] Reference Figure 7 As shown, Figure 7 This is a second detailed flow chart of step S100 in the method for monitoring the server disk RAID status provided by an embodiment of the present invention. The method for monitoring the server disk RAID status also includes but is not limited to steps S160 to S180. Specifically, S160: Determine whether the battery backup unit is in a preset optimal state, so that the battery backup unit provides power guarantee for the disk RAID cache; S170: When a configuration change of the battery backup unit is detected, a second hash value of the configuration file is calculated using md5sum; S180: Determine the consistency between the second Hash value and the first Hash value to determine the integrity of the configuration file.

[0060] In some embodiments of the present invention, the storcli command is used to check the battery backup unit (BBU) status to ensure it is in "Optimal" condition. The BBU provides power to the RAID cache, and its health is crucial to data security. The storcli command is used to obtain the current BBU configuration information. When a BBU configuration change is detected, the hash value (second hash value) of the current configuration file is calculated using md5sum. This hash value is then compared with the previously saved first hash value. If the second hash value and the first hash value are inconsistent, indicating a configuration file change, the change is recorded and the first hash value is updated.

[0061] Through the above method, the battery backup unit status monitoring, configuration change detection and configuration file integrity verification are achieved, thereby better managing the operation and maintenance of the server.

[0062] It should be appreciated that the method steps in the embodiments of the present invention can be implemented or executed by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method can use standard programming techniques. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system. However, if desired, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, for this purpose, the program can be run on a programmed application-specific integrated circuit.

[0063] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that collectively executes on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that can be executed by one or more processors.

[0064] Further, the methods can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Various aspects of the present invention can be implemented as machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, RAM, ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein. In addition, the machine-readable code, or portions thereof, can be transmitted over a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques of the present invention, the present invention can also include the computer itself.

[0065] The computer program can be applied to input data to perform the functions described herein, thereby converting the input data to generate output data that is stored in a non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present invention, the converted data represents a physical and tangible object, including a specific visual depiction of the physical and tangible object produced on the display.

[0066] The above description is merely a preferred embodiment of the present invention. The present invention is not limited to the aforementioned embodiments. As long as the technical effects of the present invention are achieved by the same means, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention. Within the scope of protection of the present invention, various modifications and variations of the technical solutions and / or implementation methods are possible.

Claims

1. A method for monitoring server disk RAID status, characterized in that: include: S100: Monitor the server disk RAID hardware status and determine the health status of the battery backup unit based on the RAID hardware information; S200: Monitoring SMART attribute information of the server disk, and determining the health status of the server disk according to the SMART attribute information; S300: Obtaining the status of the server disk RAID array, reconstruction progress information, and availability information of the hot spare disk, and determining the server disk performance based on the status of the RAID array, the reconstruction progress information, and the availability information of the hot spare disk; S400: When the server disk RAID array is in a degraded state, determine the faulty disk corresponding to the degraded state in the RAID array, automatically trigger the reconstruction of the RAID array, perform a replacement operation on the faulty disk, and send an alarm message to the host computer; S500: Upload the server disk RAID hardware information, the SMART attribute information, the status of the RAID array, the reconstruction progress information, the availability information of the hot spare disk, and the location information of the faulty disk to a log file; S600: Read the log file, encrypt the log file using an AES algorithm, generate a first hash value for the log file, and save the encrypted log file and the first hash value.

2. The method for monitoring the server disk RAID status according to claim 1, characterized in that: The step S100 includes: S110: Use the lspci-vvv command to obtain server disk RAID hardware information, and store the server disk RAID hardware information in a configuration file; S120: Checking the status of the battery backup unit through the storcli command, and determining whether the status of the battery backup unit is abnormal; S130: When it is detected that the battery backup unit is in an abnormal state, record the abnormal state of the battery backup unit and upload the abnormal state of the battery backup unit to the log file; S140: When it is detected that the battery backup unit is in a normal state, performing a configuration change detection on the battery backup unit; S150: When there is a configuration change of the battery backup unit, record alarm information of the configuration change of the battery backup unit, and update the log file with the current configuration information of the battery backup unit.

3. The method for monitoring the server disk RAID status according to claim 1, characterized in that: The step S200 includes: S210: Use the storcli command to obtain a list of disks to monitor each disk. S220: Using the smartctl -a command to obtain SMART information of each disk, extracting key indicators from the SMART information, wherein the key indicators include a reallocated sector count indicator and a temperature indicator; S230: traversing the disk list, performing a bad sector check on each disk, and determining whether the number of bad sectors on the current disk is greater than a first threshold based on the reallocated sector number indicator corresponding to each disk; if the number of bad sectors on the current disk is greater than the first threshold, recording that the number of bad sectors on the current disk exceeds the threshold; S240: Compare the number of bad sectors on the current disk with the number of historical bad sectors. If the number of bad sectors on the current disk is greater than the number of historical bad sectors, update the number of historical bad sectors with the number of bad sectors on the current disk. S250: Determine whether the temperature of the current disk is greater than a second threshold value based on the temperature index corresponding to each disk. If the temperature of the current disk is greater than the second threshold value, record that the temperature of the current disk is too high and send a high temperature alarm message.

4. The method for monitoring the server disk RAID status according to claim 1, wherein: The step S300 includes: S310: Obtain the status of the server disk RAID array and check whether the RAID array is in a degraded state using the storcli command; S320: If the RAID array is detected to be in a degraded state, record array degradation alarm information; S330: Determine whether the RAID array is in a rebuilding state. If the RAID array is in a rebuilding state, obtain and record the rebuilding progress information. S340: Detect whether there is an available hot spare disk in the RAID array. If there is no available hot spare disk, record a warning message indicating that there is no available hot spare disk, and send a message for adding an available hot spare disk.

5. The method for monitoring the server disk RAID status according to claim 4, characterized in that: The step S400 includes: S410: If it is detected that the RAID array is in a degraded state, determine a faulty disk corresponding to the degraded state in the RAID array, and obtain location information of the faulty disk; S420: Detect whether there is an available hot spare disk in the RAID array. If there is an available hot spare disk, use the storcli command to automatically trigger a RAID array reconstruction operation to replace the failed disk. S430: determining a fault level according to the number of faulty disks, and sending alarm information of different levels to the host computer according to the fault level; S440: If there is no available hot spare disk, a lack of available hot spare disk alarm message is sent to the host computer to prompt the administrator to manually intervene.

6. The method for monitoring the server disk RAID status according to claim 1, wherein: The method further comprises: S700: Obtain the status information of the power distribution unit of the server disk through the SNMP protocol; S710: Determine whether the power distribution unit is in an abnormal state according to the state information of the power distribution unit; S720: If it is detected that the power distribution unit is powered off, it is determined that the power distribution unit is in an abnormal state; S730: Record the abnormal information of the power distribution unit, send the abnormal information of the power distribution unit to the host computer, and trigger a safe shutdown process.

7. The method for monitoring the server disk RAID status according to claim 6, characterized in that: After triggering the safety shutdown process, the method further includes: S740: Stop the rebuilding operation of the RAID array; S750: Synchronize all information of the log file, and after all information of the log file is successfully synchronized, delay shutdown for a preset time.

8. The method for monitoring the server disk RAID status according to claim 2, wherein: Step S100 further includes: S160: Determine whether the state of the battery backup unit is in a preset optimal state, so that the battery backup unit provides power guarantee for the disk RAID cache; S170: When a configuration change of the battery backup unit is detected, calculating a second hash value of the configuration file by using md5sum; S180: Determine the consistency between the second Hash value and the first Hash value to determine the integrity of the configuration file.

9. A computer device comprising a memory and a processor, characterized in that: The method according to any one of claims 1 to 8 is implemented when the processor executes the computer program stored in the memory.

10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Redundant array of independent disks (RAID) reconstruction method and electronic equipment

    CN120892264A

  • A method for reconstructing a redundant array of independent disks and an electronic device

    CN120892264B