RAID card power failure protection module test method and device, electronic equipment and storage medium
By generating test files, configuring RAID cards and simulating power-down scenarios, and using MD5 values to compare data integrity, the problems of limited testing range, dependence on power outage timing, ignoring the impact of system and file system, and insufficient verification of BBU functions in the existing technology are solved, and the reliability and stability testing of RAID cards are achieved.
Patent Information
- Application Number
- CN202510195823.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-07-22
AI Technical Summary
The existing RAID card power-down protection module test method has a limited range of tests, relies on power outage timing, ignores the impact of the system and file system, and insufficient verification of BBU functions, and the results are highly accidental.
By generating test files and calculating MD5 values as the reference value, configuring the RAID card and manually mounting it to a specific directory, setting up write operations synchronization, simulating power-down scenarios, restarting the system to calculate the MD5 values of the file for comparison, and evaluating data integrity.
A comprehensive test of RAID card performance and data protection capabilities is achieved, improving the accuracy and reliability of the test and ensuring the integrity of the data in the event of power outage.
Smart Images

Figure CN120353671A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer systems, and particularly to a test method, device, electronic device, and storage medium for a power-off protection module of a RAID card. Background Art
[0002] Existing test methods for the power-off protection module of a RAID card have many deficiencies, mainly reflected in the following aspects: First, the test scope is limited, only verifying whether the file exists, while ignoring the integrity of the file content and data consistency. This method cannot detect the situation where the file content is damaged. Even if the file is visible in the RAID-mounted directory, it may not be usable due to damaged content.
[0003] Second, the test scenarios are single, mainly targeting a single file copy scenario, and not involving actual application scenarios such as database transactions, log writing, or multi-threaded concurrent writing. Therefore, the reliability of the BBU (Backup Battery Unit) cannot be comprehensively verified.
[0004] Furthermore, the choice of power-off timing has a greater impact on the test results. The artificially set power-off timing, such as powering off when 80% is copied, may lead to instability of the test results. In addition, due to the influence of the system cache refresh cycle and the RAID card writing mechanism, the power-off may not occur at the critical moment when the cache is not written to the disk.
[0005] In addition, existing test methods also ignore the influence of the system and the file system. Different file systems have differences in metadata consistency and file visibility behavior in the case of power-off, and the file system cache of the operating system may also cause data loss, but the test methods cannot distinguish the influence of these two.
[0006] Finally, the verification of the BBU function is also insufficient. The BBU not only needs to ensure that data is written to the disk, but also should ensure that the cached content is completely written back to the disk after power recovery. However, existing test methods cannot verify the data consistency of the BBU after power-off recovery and also ignore the influence of the BBU health status on the protection function.
[0007] Therefore, a test method for the power-off protection module of a RAID card is needed that can comprehensively verify the function of the power-off protection module of the RAID card and improve the accuracy and reliability of the test results. Summary of the Invention
[0008] Embodiments of the present invention provide a test method for a power-off protection module of a RAID card to solve the problems of limited test scope, dependence on power-off timing, ignoring the influence of the system and the file system, insufficient verification of the BBU function, and high contingency of results in the prior art. The technical solutions are as follows:
[0009] According to one aspect of the present invention, a method for testing a power-off protection module of a RAID card, the method comprising: generating a test file according to the RAID card to be tested through a system command, and obtaining a reference value of data integrity according to the test file; configuring the RAID card to be tested and forming a RAID disk, manually mounting the RAID card to be tested to a specific directory through a system command and setting the write operation to be synchronized to the RAID disk; copying the test file to the RAID disk, performing a power-off operation on the system after the copying is completed and remounting the RAID disk; restarting the system, calculating a test value of the file copied in the RAID disk, and comparing the test value with the reference value to obtain a test result.
[0010] In one embodiment, generating a test file according to the RAID card to be tested through a system command is achieved through the following steps: based on the estimation of the cache capacity and write rate, generating a file with a size 1.5 times that of the cache capacity of the RAID card to be tested as the test file.
[0011] In one embodiment, obtaining a reference value of data integrity according to the test file is achieved through the following steps: calculating the MD5 value of the test file through the Message Digest Algorithm MD5, and using the MD5 value as the reference value of the data integrity of the test file.
[0012] In one embodiment, configuring the RAID card to be tested and forming a RAID disk is achieved through the following steps: enabling the cache function of the RAID card, forming a RAID disk, and using the tool command of the RAID card to set the cache write-back mode and turn off the physical hard disk cache; the RAID disk includes RAID0, RAID1, RAID5, and RAID10.
[0013] In one embodiment, manually mounting the RAID card to be tested to a specific directory through a system command and setting the write operation to be synchronized to the RAID disk is achieved through the following steps: formatting the RAID disk, manually mounting the RAID disk to the directory in the system for mounting temporary files, and forcing the file system to directly synchronize and write data to the RAID disk during each write operation through the use of system parameters, without using the cache.
[0014] In one embodiment, copying the test file to the RAID disk, performing a power-off operation on the system after the copying is completed and continuously powering off for a period of time is achieved through the following steps: writing the test file to the RAID disk, and waiting for 1 minute to remount the RAID disk after the terminal displays that the writing is completed.
[0015] In one embodiment, comparing the test value with the reference value to obtain a test result is achieved through the following steps: If the test value is consistent with the reference value, it means that the data has not been lost or damaged during power-off, and the power-off protection function of the RAID card is effective; if the test value is inconsistent with the reference value, it means that the data has been lost or damaged, and further check the configuration and performance of the RAID card.
[0016] According to one aspect of the present invention, a test device for the power-off protection module of a RAID card, the device includes: a test file generation module, configured to generate a test file according to the RAID card to be tested through a system command, and obtain a reference value of data integrity according to the test file; a RAID card configuration and mounting module, configured to configure the RAID card to be tested and form a RAID disk, manually mount the RAID card to be tested to a specific directory through a system command and set the write operation to be synchronized to the RAID disk; a file copy and power-off test module, configured to copy the test file to the RAID disk, perform a power-off operation on the system after the copy is completed and continuously power off for a period of time; a data integrity verification module, configured to restart the system and remount the RAID disk, calculate the test value of the file copied in the RAID disk, and compare the test value with the reference value to obtain a test result.
[0017] According to one aspect of the present invention, an electronic device includes at least one processor and at least one memory, wherein, a computer-readable instruction is stored on the memory; the computer-readable instruction is executed by one or more of the processors, so that the electronic device implements the RAID card power-off protection module test method as described above.
[0018] According to one aspect of the present invention, a storage medium stores a computer-readable instruction thereon, and the computer-readable instruction is executed by one or more processors to implement the RAID card power-off protection module test method as described above.
[0019] The beneficial effects brought by the technical solution provided by the present invention are:
[0020] In the above technical solution, the present invention first uses system commands to generate a test file of an appropriate size according to the characteristics of the RAID card to be tested, and calculates the MD5 value of this file as the benchmark value for data integrity. This step ensures the accuracy and representativeness of the test file, providing a reliable benchmark for subsequent tests. Then, configure the RAID card to be tested, form a RAID disk, and manually mount it to a specific directory through system commands, while setting the write operation to be synchronized to the RAID disk. This step ensures the correct configuration and mounting of the RAID card, as well as the synchronization of data during writing, providing a stable environment for testing. Then, copy the test file to the RAID disk, and immediately power off the system after the copy is completed. This step simulates a power-off scenario to test the data protection ability of the RAID card under power-off conditions. Finally, restart the system, calculate the MD5 value of the file copied in the RAID disk, and compare it with the benchmark value. Through the comparison result, it can be judged whether the data remains intact during the power-off process, thereby evaluating whether the power-off protection function of the RAID card is effective. The entire solution realizes a comprehensive test of the performance and data protection ability of the RAID card through steps such as generating a test file, configuring the RAID card, simulating a power-off scenario, and verifying data integrity, providing a strong guarantee for the reliability and stability of the RAID card, and thus effectively solving the problems of limited test scope, dependence on the power-off timing, ignoring the impact of the system and file system, insufficient verification of the BBU function, and high result contingency in the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for description in the embodiments of the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention, and those skilled in the art can obtain other drawings without creative efforts based on these drawings.
[0022] Figure 1 is a flowchart of a method for testing a power-off protection module of a RAID card shown according to an exemplary embodiment;
[0023] Figure 2 is a schematic flowchart of a method for testing a power-off protection module of a RAID card shown according to an exemplary embodiment;
[0024] Figure 3 is a block diagram of a test device for a power-off protection module of a RAID card shown according to an exemplary embodiment;
[0025] Figure 4 is a hardware structure diagram of an electronic device shown according to an exemplary embodiment;
[0026] Figure 5It is a block diagram of an electronic device shown according to an exemplary embodiment. Detailed implementation manners
[0027] Embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.
[0028] Those skilled in the art of the present technology can understand that, unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "including" used in the specification of the present disclosure means the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we say an element is "connected" or "coupled" to another element, it can be directly connected or coupled to other elements, or there may also be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more related listed items.
[0029] RAID: Redundant Array of Independent Disks, is a technology that combines multiple independent physical hard disks into a logical hard disk to improve the performance and reliability of data storage.
[0030] MD5: Message-Digest Algorithm 5, is a widely used hash function for generating a hash value of a fixed length and is commonly used to verify the integrity of data.
[0031] The present invention provides a method for testing a power-off protection module of a RAID card. Through steps such as generating a test file, configuring the RAID card, simulating a power-off scenario, and verifying data integrity, a comprehensive test of the performance and data protection ability of the RAID card is achieved. It can effectively solve the problems of limited test scope, dependence on the power-off timing, ignoring the impact of the system and file system, insufficient verification of the BBU function, and high randomness of the results in the prior art. The method for testing the power-off protection module of the RAID card is applicable to a test device for the power-off protection module of the RAID card, and the test device for the power-off protection module of the RAID card can be an electronic device. The method for testing the power-off protection module of the RAID card in the embodiments of the present invention can be applied to various scenarios, such as testing the power-off protection module of the RAID card.
[0032] Please refer to Figure 1 , an embodiment of the present invention provides a method for testing a power failure protection module of a RAID card, and this method is applicable to electronic devices.
[0033] In the following method embodiments, for ease of description, the execution subject of each step of this method is taken as an electronic device as an example for illustration, but this does not constitute a specific limitation thereto.
[0034] As Figure 1 shown, this method may include the following steps:
[0035] Step 110, generate a test file according to the RAID card to be tested through a system command, and obtain a reference value of data integrity according to the test file.
[0036] In a possible implementation manner, based on the estimation of the cache capacity and the write rate, a file with a size 1.5 times that of the cache capacity of the RAID card to be tested is generated as the test file.
[0037] In a possible implementation manner, calculate the MD5 value of the test file through the Message Digest Algorithm MD5, and use the MD5 value as the reference value of the data integrity of the test file.
[0038] Step 130, configure the RAID card to be tested and form a RAID disk, and manually mount the RAID card to be tested to a specific directory through a system command and set the write operation to be synchronized to the RAID disk.
[0039] In a possible implementation manner, enable the cache function of the RAID card, form a RAID disk, and use the tool command of the RAID card to set the cache write-back mode and turn off the physical hard disk cache.
[0040] Among them, the RAID disk may include RAID0, RAID1, RAID5, and RAID10, and no limitation is imposed here.
[0041] In a possible implementation manner, format the RAID disk, manually mount the RAID disk to the directory in the system for mounting temporary files, and force the file system to directly synchronize and write data to the RAID disk during each write operation through the use of system parameters, and do not use the cache.
[0042] Step 150, copy the test file to the RAID disk, perform a power-off operation on the system after the copy is completed, and remount the RAID disk.
[0043] In a possible implementation manner, write the test file to the RAID disk, and wait for a period of time after the terminal displays that the write is completed and then remount the RAID disk.
[0044] Step 170: Restart the system, calculate the test value of the files copied on the RAID disk, and compare the test value with the reference value to obtain the test result.
[0045] In a possible implementation, if the test value is consistent with the reference value, it means that the data has not been lost or damaged during the power-off process, and the power-off protection function of the RAID card is effective; if the test value is inconsistent with the reference value, it means that the data has been lost or damaged, and further check the configuration and performance of the RAID card.
[0046] Through the above process, in the embodiment of the present invention, first, a test file of an appropriate size is generated according to the characteristics of the RAID card to be tested by using a system command, and the MD5 value of the file is calculated as the reference value for data integrity. This step ensures the accuracy and representativeness of the test file and provides a reliable reference for subsequent tests. Then, the RAID card to be tested is configured to form a RAID disk, and it is manually mounted to a specific directory through a system command. At the same time, the write operation is set to be synchronized to the RAID disk. This step ensures the correct configuration and mounting of the RAID card and the synchronization of data during writing, providing a stable environment for testing. Then, the test file is copied to the RAID disk, and the system is powered off immediately after the copy is completed. This step simulates the power-off scenario to test the data protection ability of the RAID card under power-off conditions. Finally, the system is restarted to calculate the MD5 value of the file copied on the RAID disk and compare it with the reference value. Through the comparison result, it can be judged whether the data remains intact during the power-off process, so as to evaluate whether the power-off protection function of the RAID card is effective. The entire solution realizes a comprehensive test of the performance and data protection ability of the RAID card through steps such as generating a test file, configuring the RAID card, simulating the power-off scenario, and verifying data integrity, providing a strong guarantee for the reliability and stability of the RAID card, and thus effectively solving the problems of limited test scope, dependence on the power-off timing, ignoring the influence of the system and file system, insufficient verification of the BBU function, and high result contingency in the prior art.
[0047] In an exemplary embodiment, the present invention provides a method for testing the power-off protection module of a RAID card to test the power-off protection module of a RAID card in a Linux system.
[0048] As Figure 2 shown, it may specifically include the following steps:
[0049] Step S01: Generate a file with a size 1.5 times the cache capacity.
[0050] Specifically, use the dd command at the system terminal to generate a file that is 1.5 times the capacity of the RAID card cache (for example, if the RAID card cache is 2G, generate a 3072M file), and verify the MD5 value of the file. This step aims to ensure the integrity and consistency of the test file and provide a benchmark for subsequent data comparison.
[0051] Among them, generating a file with a size of 1.5 times the cache capacity is based on the estimation of the cache capacity and write rate, ensuring that even in the case of high-speed data writing and cache backlog, all cache data has enough time for write processing to avoid data loss.
[0052] Step S02, assemble the RAID disk.
[0053] Specifically, enable its cache function through the RAID card configuration tool or command, select an appropriate RAID level according to the test requirements (such as RAID0, RAID1, RAID5, or RAID10, etc.), and then assemble the RAID disk.
[0054] Step S03, set cache write-back.
[0055] Specifically, use the tool command provided by the RAID card to set the cache write-back mode to ensure that during the test, data can be written back to the disk as expected.
[0056] Step S04, set to turn off the physical hard disk cache.
[0057] Specifically, use the RAID card tool command to turn off the cache function of the physical hard disk to ensure the accuracy of the test results and reduce test errors caused by the hard disk cache.
[0058] Among them, after turning off the physical hard disk cache, the write operations of the hard disk will be more strictly synchronized to the disk, ensuring that the test results reflect the data integrity and consistency of the hard disk when a power-off event occurs without cache acceleration.
[0059] Step S05, format the RAID disk.
[0060] Specifically, perform a formatting operation on the assembled RAID disk to ensure that its file system and data storage environment are clean and free of redundancy, and prepare for subsequent tests.
[0061] Step S06, manually mount the RAID disk.
[0062] Specifically, manually mount the RAID disk to the / mnt directory of the system and add the -o sync parameter during mounting to ensure that data can be directly synchronized to the hard disk when writing, avoiding test errors caused by system cache.
[0063] Among them, when manually mounting the RAID disk to the / mnt directory, the -o sync parameter is used to force the file system to directly synchronize and write data to the hard disk during each write operation without using caching, ensuring that the data is consistent and persistent every time it is written to the disk.
[0064] Step S07, immediately power off after copying the files to the RAID disk is completed.
[0065] Specifically, use the cp command to copy the previously generated test files to the mounted RAID disk. When the terminal shows that the copy is completed, immediately perform a power-off operation on the system to simulate a power-off situation.
[0066] Step S08, power on and enter the system to remount the RAID disk.
[0067] Specifically, wait for 1 minute after power-off, then power on and enter the system, and remount the RAID disk manually to the / mnt directory again to prepare for subsequent data verification.
[0068] Step S09, the MD5 values of the original file and the file copied to the RAID disk are the same, success.
[0069] Specifically, after remounting the RAID disk, use the md5sum command to view the MD5 value of the target file and compare it with the MD5 value of the source file. If the two are the same, it means that the power-off protection function of the RAID card is successfully implemented.
[0070] Among them, through MD5 value comparison, it can quickly test whether the power-off protection module function of the computer RAID card is implemented, ensuring the accuracy of the test results.
[0071] In the above process, based on the cache capacity and write rate estimation, the generated cache file size can ensure that the data in the cache will not be lost in case of peak load or sudden situation during the data writing process; using the hash algorithm for data integrity verification, since MD5 has the characteristics of uniqueness, fixed length, sensitivity, etc., it can very effectively verify whether the data is tampered with or lost during the power-off process, ensuring the accuracy of the test results; this test method can be extended to different types of RAID arrays and different RAID card products, applicable to a variety of hardware platforms and operating system environments. By generating files with a size of 1.5 times the cache capacity, setting cache write-back, turning off the physical hard disk cache, manually mounting the RAID disk and using MD5 value comparison, it ensures the accuracy and reliability of the test results, and solves the problems in the prior art such as limited test scope, dependence on the power-off timing, ignoring the influence of the system and file system, insufficient verification of the BBU function, and high contingency of the results.
[0072] In one embodiment, when using the RAID card power failure protection module test method provided by the present invention to perform a test on the RAID card power failure protection module in the Linux system, the following steps may be included:
[0073] In the first step, a file with a size 1.5 times the cache capacity is generated and the MD5 value is verified.
[0074] Specifically, use the command "dd if= / dev / zero of=. / TEST.dat bs=1M count=3072" (estimated according to the cache capacity and write rate) to generate the file, and use md5sum TEST.dat to check the MD5 value of the generated file. The purpose is to generate a sufficiently large file to ensure that all cache data has enough time for write processing in the case of high-speed data writing and cache backlog, avoiding data loss.
[0075] In the second step, the RAID card cache function is enabled and the RAID disk is formed.
[0076] Specifically, use the RAID card tool command (. / storcli64) to enable the cache function and form the RAID disk. The purpose is to utilize the high-speed cache on the RAID card to improve data read and write speeds and overall performance.
[0077] In the third step, the cache write-back is set and the physical hard disk cache is turned off.
[0078] Specifically, use the RAID card tool command (#. / storcli64 / c0 / v0 set wrcache=AWB) to set the cache write-back mode, and use the command (#. / storcli64 / c0 / v0 set pdcache=off) to turn off the physical hard disk cache. The purpose is to ensure that the test device can effectively process data in the scenario of power failure during write-back, reducing data loss due to unwritten-back cache. After turning off the cache, the write operations of the hard disk will be more strictly synchronized to the disk, ensuring that the test results reflect the data integrity and consistency of the hard disk in the event of a power failure without cache acceleration.
[0079] In the fourth step, the RAID disk is formatted.
[0080] Specifically, use the file system tool (#mkfs.ext4 / dev / sdb) to format the RAID disk, where sdb is the actual RAID disk. The purpose is to ensure that the new data storage environment is clean and redundant, preventing errors or bad sectors on the hard disk, or issues with file system incompatibility with the operating system, and ensuring that the RAID disk can be successfully mounted.
[0081] In the fifth step, the RAID disk is manually mounted and synchronous writing is set.
[0082] Specifically, use the command (#mount -o sync / dev / sdb / mnt) to manually mount the RAID disk to the / mnt directory and set synchronous writing. The purpose is to force the file system to directly synchronize and write data to the hard disk during each write operation without using the cache, ensuring that the data is consistent and persistent every time it is written to the disk.
[0083] The sixth step is to copy the file and immediately power off.
[0084] Specifically, use the command (#cp TEST.dat / mnt / ) to copy the file to the RAID disk, and immediately power off after the copy is completed. The purpose is that after the copy operation is completed, the system thinks that the file operation has ended, but the actual hard disk writing process may not be completely finished. At this time, power off to test whether the system can ensure data consistency and whether it can recover data through the redundancy mechanism or the file system log.
[0085] The seventh step is to remount the RAID disk and verify the MD5 value.
[0086] Specifically, wait for 1 minute and then boot into the system. Use the command (#mount -o sync / dev / sdb / mnt) to manually remount the RAID disk to / mnt, and use the command (#md5sum / mnt / TEST.dat) to compare the MD5 value of the RAID.dat file copied to the RAID disk with the MD5 value of the original file for verification. The purpose is to give the system enough time to complete all unfinished data writing operations, ensure data consistency and integrity, and verify whether the data has been tampered with or lost during the power-off process through MD5 value comparison, ensuring the accuracy of the test results.
[0087] In the above process, the cache file size generated by the embodiment of the present invention based on the cache capacity and write rate estimation can prevent data loss in the cache during peak loads or emergencies in the data writing process. The MD5 hash algorithm is used for data integrity verification. Since MD5 has characteristics such as uniqueness, fixed length, and sensitivity, it can very effectively verify whether the data has been tampered with or lost during the power-off process, ensuring the accuracy of the test results. It can be extended to different types of RAID arrays and different RAID card products, and is applicable to a variety of hardware platforms and operating system environments. By generating a file with a size 1.5 times the cache capacity, setting cache write-back, turning off the physical hard disk cache, manually mounting the RAID disk, and using MD5 value comparison, the accuracy and reliability of the test results are ensured, solving problems in the prior art such as limited test scope, dependence on the power-off timing, ignoring the impact of the system and file system, insufficient verification of the BBU function, and high contingency of results.
[0088] The following is an embodiment of the device of the present invention, which can be used to execute the test method of the RAID card power-off protection module involved in the present invention. For the details not disclosed in the embodiment of the device of the present invention, please refer to the method embodiment of the test method of the RAID card power-off protection module involved in the present invention.
[0089] Please refer to Figure 3 , in the embodiment of the present invention, a test device 800 for the RAID card power-off protection module is provided.
[0090] The device 800 includes but is not limited to: a test file generation module 810, a RAID card configuration and mounting module 830, a file copy and power-off test module 850, and a data integrity verification module 870.
[0091] Among them, the test file generation module 810 is used to generate test files according to the RAID card to be tested through system commands, and obtain the reference value of data integrity according to the test files.
[0092] The RAID card configuration and mounting module 830 is used to configure the RAID card to be tested and form a RAID disk, and manually mount the RAID card to a specific directory through system commands and set the write operation to be synchronized to the RAID disk.
[0093] The file copy and power-off test module 850 is used to copy the test files to the RAID disk, perform a power-off operation on the system after the copy is completed, and remount the RAID disk.
[0094] The data integrity verification module 870 is used to restart the system, calculate the test value of the files copied in the RAID disk, and compare the test value with the reference value to obtain the test result.
[0095] It should be noted that when testing the RAID card power-off protection module provided in the above embodiment, only the above-mentioned division of each functional module is used for illustration. In actual application, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the test device for the RAID card power-off protection module will be divided into different functional modules to complete all or part of the functions described above.
[0096] In addition, the test device for the RAID card power-off protection module provided in the above embodiment and the embodiment of the test method for the RAID card power-off protection module belong to the same concept. The specific ways in which each module performs operations have been described in detail in the method embodiment, and will not be repeated here.
[0097] Figure 4 The structural schematic diagram of an electronic device shown according to an exemplary embodiment.
[0098] It should be noted that the electronic device is only an example adapted to the present invention and should not be considered as providing any limitation to the scope of use of the present invention. Nor can the electronic device be construed as requiring dependence on or necessarily having Figure 4 one or more components shown in the exemplary electronic device 2000.
[0099] The hardware structure of the electronic device 2000 may vary significantly due to different configurations or performances. For example, Figure 4 as shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.
[0100] Specifically, the power supply 210 is used to provide working voltage for each hardware device on the electronic device 2000.
[0101] The interface 230 includes at least one wired or wireless network interface 231 for interacting with external devices. Of course, in other examples adapted to the present invention, the interface 230 may further include at least one serial-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc., as Figure 4 shown, and specific limitations are not imposed herein.
[0102] The memory 250, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk, an optical disk, etc. The resources stored thereon include an operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.
[0103] Among them, the operating system 251 is used to manage and control each hardware device and application program 253 on the electronic device 2000 to enable the central processing unit 270 to perform operations and processing on the massive data 255 in the memory 250. It can be Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSD TM, etc.
[0104] The application program 253 is a computer-readable instruction that completes at least one specific task based on the operating system 251. It may include at least one module ( Figure 4 not shown), and each module can separately contain computer-readable instructions for the electronic device 2000. For example, the RAID card power-off protection module testing device can be regarded as an application program 253 deployed on the electronic device 2000.
[0105] The data 255 can be signal information, etc., and is stored in the memory 250.
[0106] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer-readable instructions stored in the memory 250, thereby implementing the operation and processing of the massive data 255 in the memory 250. For example, the power-off protection module test method of the RAID card is completed by reading a series of computer-readable instructions stored in the memory 250 through the central processing unit 270.
[0107] In addition, the present invention can also be implemented by a hardware circuit or a combination of a hardware circuit and software. Therefore, the implementation of the present invention is not limited to any specific hardware circuit, software, or the combination of the two.
[0108] Please refer to Figure 5 , in the embodiments of the present invention, an electronic device 4000 is provided. The electronic device 400 may include: a desktop computer, a laptop computer, a server, etc. with sensor recognition capabilities.
[0109] In Figure 5 , the electronic device 4000 includes at least one processor 4001 and at least one memory 4003.
[0110] Among them, the data interaction between the processor 4001 and the memory 4003 can be realized through at least one communication bus 4002. The communication bus 4002 may include a path for transmitting data between the processor 4001 and the memory 4003. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 5 only a thick line is used to represent it in
[0111] , but it does not mean that there is only one bus or one type of bus.
[0112] The processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in connection with the disclosure of the present invention. The processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0113] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or it may also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or any other medium that can be used to carry or store desired program instructions or code in the form of instruction or data structures and can be accessed by the electronic device 400, but is not limited thereto.
[0114] Computer-readable instructions are stored on the memory 4003, and the processor 4001 can read the computer-readable instructions stored in the memory 4003 through the communication bus 4002.
[0115] The computer-readable instructions are executed by one or more processors 4001 to implement the RAID card power-off protection module test method in the above embodiments.
[0116] In addition, an embodiment of the present invention provides a storage medium on which computer-readable instructions are stored, and the computer-readable instructions are executed by one or more processors to implement the RAID card power-off protection module test method as described above.
[0117] In an embodiment of the present invention, a computer program product is provided. The computer program product includes computer-readable instructions. The computer-readable instructions are stored in a storage medium. One or more processors of an electronic device read the computer-readable instructions from the storage medium, load and execute the computer-readable instructions, so that the electronic device implements the RAID card power-off protection module test method as described above.
[0118] Compared with the related art, the beneficial effects of the present invention are as follows:
[0119] 1. In the present invention, first, a test file of an appropriate size is generated according to the characteristics of the RAID card to be tested by using system commands, and the MD5 value of the file is calculated as the reference value for data integrity. This step ensures the accuracy and representativeness of the test file, providing a reliable reference for subsequent tests. Then, the RAID card to be tested is configured to form a RAID disk, and it is manually mounted to a specific directory through system commands. At the same time, the write operation is set to be synchronized to the RAID disk. This step ensures the correct configuration and mounting of the RAID card, as well as the synchronization of data during writing, providing a stable environment for testing. Then, the test file is copied to the RAID disk, and the system is powered off immediately after the copy is completed. This step simulates the power-off scenario to test the data protection ability of the RAID card under power-off conditions. Finally, the system is restarted to calculate the MD5 value of the file copied in the RAID disk and compare it with the reference value. Through the comparison result, it can be judged whether the data remains intact during the power-off process, so as to evaluate whether the power-off protection function of the RAID card is effective. The entire solution realizes a comprehensive test of the performance and data protection ability of the RAID card through steps such as generating a test file, configuring the RAID card, simulating the power-off scenario, and verifying data integrity, providing a strong guarantee for the reliability and stability of the RAID card, and thus effectively solving the problems of limited test scope, dependence on the power-off timing, ignoring the influence of the system and file system, insufficient verification of the BBU function, and high result contingency in the prior art.
[0120] 2. The present invention can improve the accuracy and reliability of the test: By generating a test file of a specific size and calculating its MD5 value as the reference value, the accuracy and representativeness of the test data can be ensured, thereby improving the accuracy and reliability of the test.
[0121] 3. The present invention can comprehensively evaluate the performance of the RAID card: This solution not only tests the read and write performance of the RAID card under normal conditions, but also evaluates its data protection ability under extreme conditions by simulating the power-off scenario, thereby providing a comprehensive evaluation of the performance of the RAID card.
[0122] 4. The present invention can optimize the RAID card configuration: during the testing process, the configuration of the RAID card can be adjusted and optimized according to the test results to improve its performance and stability.
[0123] 5. The present invention can enhance data security: by verifying whether the data on the RAID disks remains intact after a power outage, potential data loss or damage problems can be detected and solved in a timely manner, thereby enhancing data security.
[0124] 6. The present invention can reduce operation and maintenance costs: this solution provides an efficient testing method that can help operation and maintenance personnel detect problems with the RAID card in a timely manner and repair them, avoiding additional costs caused by data loss and hardware damage.
[0125] 7. The present invention can improve system stability: through comprehensive testing of the RAID card, its stability and reliability during actual operation can be ensured, thereby improving the stability of the entire system.
[0126] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, there is no strict order restriction for the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and their execution order is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0127] The above are only some embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. The test method for the power-off protection module of the RA ID card, characterized in that, The method includes: Generating a test file according to the to-be-tested RA ID card through a system command, and obtaining a reference value of data integrity according to the test file; Configuring the to-be-tested RA ID card and forming an RA ID disk, manually mounting the to-be-tested RA ID card to a specific directory through a system command, and setting the write operation to be synchronized to the RA ID disk; Copying the test file to the RA ID disk, powering off the system after the copying is completed, and remounting the RA ID disk; Restarting the system, calculating a test value of the file copied in the RA ID disk, and comparing the test value with the reference value to obtain a test result.
2. The test method for the power-off protection module of the RA ID card according to claim 1, wherein The generating a test file according to the to-be-tested RA ID card through a system command includes: Based on the estimation of the cache capacity and the write rate, generating a file with a size 1.5 times that of the cache capacity of the to-be-tested RA ID card as the test file.
3. The test method for the power-off protection module of the RA ID card according to claim 1, characterized in that The obtaining a reference value of data integrity according to the test file includes: Calculating the MD5 value of the test file through the message digest algorithm MD5, and using the MD5 value as the reference value of the data integrity of the test file.
4. The test method for the power-off protection module of the RA ID card according to claim 1, characterized in that The configuring the to-be-tested RAID card and forming a RAID disk includes: Enabling the cache function of the RA ID card, forming an RA ID disk, using the tool command of the RA ID card to set the cache write-back mode and closing the physical hard disk cache; the RA ID disk includes RA ID0, RA ID1, RA ID5, and RA ID10.
5. The test method for the power-off protection module of the RA ID card according to claim 1, characterized in that, The manually mounting the to-be-tested RA ID card to a specific directory through a system command and setting the write operation to be synchronized to the RA ID disk includes: Formatting the RA ID disk, manually mounting the RA ID disk to the directory in the system for mounting temporary files, and forcing the file system to directly synchronize and write data to the RAID disk during each write operation through using system parameters, and not using the cache.
6. The test method for the power-off protection module of the RA ID card according to claim 1, characterized in that, The copying the test file to the RA ID disk, powering off the system after the copying is completed, and remounting the RA ID disk includes: Writing the test file to the RA ID disk, and waiting for a period of time after the terminal displays that the writing is completed and then remounting the RA ID disk.
7. The test method for the power-off protection module of the RA ID card according to claim 1, characterized in that, The comparing the test value with the reference value to obtain a test result includes: If the test value is consistent with the reference value, the data is not lost or damaged during the power-off process, and the power-off protection function of the RA ID card is effective; If the test value is inconsistent with the reference value, the data is lost or damaged, and further check the configuration and performance of the RA ID card.
8. The test device for the power-off protection module of the RA ID card, characterized in that, The device includes: A test file generation module, configured to generate a test file according to the to-be-tested RA ID card through a system command, and obtain a reference value of data integrity according to the test file; An RA ID card configuration and mounting module, configured to configure the to-be-tested RA ID card and form an RA ID disk, manually mount the to-be-tested RA ID card to a specific directory through a system command, and set the write operation to be synchronized to the RA ID disk; A file copy and power-off test module, which is used to copy the test file to the RA ID disk, perform a power-off operation on the system after the copy is completed, and remount the RA ID disk. A data integrity verification module, which is used to restart the system, calculate the test value of the file copied in the RA ID disk, and compare the test value with the reference value to obtain a test result.
9. An electronic device, characterized in that, Comprising: At least one processor and at least one memory, wherein, The memory stores computer-readable instructions; The computer-readable instructions are executed by one or more of the processors, so that the electronic device implements the RA ID card power-off protection module test method according to any one of claims 1 to 7.
10. A storage medium having computer-readable instructions stored thereon, characterized in that, The computer-readable instructions are executed by one or more processors to implement the RA ID card power-off protection module test method according to any one of claims 1 to 7.