Data security erasing method capable of automatically processing bad tracks and bad blocks
By automatically detecting and processing bad blocks and bad channels in the hard disk, the problems of slow speed and poor efficiency during the hard disk erasing process are solved, and faster data erasing and higher business processing efficiency are achieved.
Patent Information
- Application Number
- CN202311210029.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-19
- Publication Date
- 2025-03-14
AI Technical Summary
When bad blocks and bad channels are encountered during the erasing of existing hard disks, the data erasing speed is slow, the efficiency is poor, and may lead to disc scratches and hard disk scrapping.
A data safe erasing method that can automatically handle bad blocks is proposed. Through the interface, the disk to be erased is identified and the total number of bad blocks and erased time is detected. If the preset threshold is reached or the time is too long, the total disk bad block detection is performed to automatically determine whether to terminate the erasing or skip the bad block to continue erasing.
When encountering bad blocks and bad channels, speed up data erasure, improve business processing efficiency, reduce the risk of hard disk scrapping, and promptly remind operators to decide whether to perform the physical destruction process of hard disk.
Smart Images

Figure CN119620920A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a data safety erasing method capable of automatically processing bad tracks and bad blocks, and belongs to the technical field of erasing various types of hard disks and memory cards. Background Art
[0002] Electronic data is the most important information storage method at present, and it is also an indispensable carrier for the operation of modern industrial systems. Data is important basic data, and its damage and leakage will affect the safe and smooth operation of various industries and cause significant losses to users. In large units, there are a large number of storage media and devices of various types that need to be erased.
[0003] At present, bad blocks or bad sectors may be encountered during the hard disk erasure process, which causes the erasure time to be too long, seriously affecting the efficiency of business processing. However, during the erasure process, the bad blocks and bad sectors of the source disk and the target disk are generally not detected, but directly erased. In the actual data erasure process, if there are bad blocks or bad sectors, data is repeatedly written to the hard disk with bad blocks. When the number of bad blocks or bad sectors reaches a certain threshold, it may seriously prolong the data erasure time and may also cause scratches on the disk, resulting in greater waste of time and the risk of hard disk scrapping. If the operator is reminded in time to decide whether to execute the hard disk physical destruction process, it will save a lot of time.
[0004] Therefore, it is an urgent problem for technical personnel in this field to propose a data secure erasure method that can automatically process bad sectors and bad blocks, speed up data erasure and improve business processing efficiency when encountering bad blocks and bad sectors. Summary of the invention
[0005] The purpose of the present invention is to solve the problem of slow data erasing speed and poor efficiency when bad blocks and bad sectors appear in the existing hard disk erasing process, and to provide a data security erasing method that can automatically process bad sectors and bad blocks.
[0006] The present invention discloses a data security erasing method capable of automatically processing bad sectors and bad blocks, comprising:
[0007] S1, connect the disk to be erased to the read-write interface, and determine whether the disk to be erased can be correctly identified. If "no", an alarm is given; if "yes", S2 is executed;
[0008] S2, erase the data on the disk to be erased, and determine whether the total number of bad blocks reaches a preset threshold value Th, and determine whether the erasing time T is greater than n times the estimated erasing time T when the data that is less than a% of the source disk is erased. ev If both judgments are "no", S2 is repeatedly executed until the data erasure of the entire disk is completed and an alarm is issued to indicate that the data erasure task is completed. If at least one of the two judgments is "yes", S3 is executed;
[0009] Where n is a positive integer and a is a variable;
[0010] S3. Perform a full-disk bad block detection on the disk to be erased, and automatically judge the real-time bad block detection result of the full-disk bad block according to the full-disk bad block detection scheme. When the real-time bad block detection result of the full-disk bad block meets the termination condition of the full-disk bad block detection scheme, terminate the data erasure and pop up a data destruction prompt at the same time. When the real-time bad block detection result of the full-disk bad block does not meet the termination condition of the full-disk bad block detection scheme, avoid the bad blocks and continue to erase the data until the full-disk data is erased, and an alarm is issued to indicate that the data erasure task is completed.
[0011] Preferably, the data erasing in S2 further includes:
[0012] When judging whether the total number of bad blocks reaches the preset threshold value Th, and judging whether the erasure time T is greater than n times the estimated erasure time T when the data erased from the source disk is less than a% of the data ev At the same time, determine the bad block count BB test Whether the ratio of M / m is greater than w%, where m sectors are taken as a unit and M represents the total number of sectors;
[0013] Among them, w is a variable;
[0014] If the total number of bad blocks reaches the preset threshold Th, or the data erased from the source disk is less than a% of the data, the erasure time T is greater than n times the estimated erasure time T ev , then execute S3;
[0015] If the bad block count BB test If the ratio of M / m is greater than w%, data erasure is terminated.
[0016] Preferably, the specific method of determining whether the total number of bad blocks reaches a preset threshold value Th in S2 includes:
[0017] Initialize the sector number c and the total number of bad blocks BB, so that c=0, BB=0;
[0018] Erasing starts from the sector numbered c=0, and starts counting when the first bad block is found, so that the total number of bad blocks BB=BB+1;
[0019] Continue erasing data. When a bad block is found again within a sector interval of no more than k sectors, set the total number of bad blocks BB = BB + 1.
[0020] The total number of bad blocks BB is compared with a preset threshold value Th. When BB≥Th, it is determined that the total number of bad blocks reaches the preset threshold value Th.
[0021] Preferably, S2 determines whether the erasure time T is greater than n times the estimated erasure time T ev The specific methods include:
[0022] Read the capacity of the source disk S 源 , the capacity of the disk to be erased S 目标 , Standard data erasure rate of source disk V 源 and the standard data erasure rate V of the disk to be erased 目标 ;
[0023] Calculate the estimated erase time T ev :
[0024]
[0025] Start erasing the data on the disk to be erased and determine whether the erasing time T is greater than n times the estimated erasing time T ev , that is: T>n*T ev .
[0026] Preferably, the full disk bad block detection solution in S3 includes:
[0027] Count the number of bad block sectors in the entire disk, calculate the ratio of the number of bad block sectors in the entire disk to the total number of sectors, and determine whether the ratio is greater than d%, where d is a variable.
[0028] Preferably, the full disk bad block detection solution in S3 further includes:
[0029] Count the number of sectors with consecutive bad blocks, calculate the ratio of the number of sectors with consecutive bad blocks to the total number of sectors, and determine whether the ratio is greater than f%, where f is a variable.
[0030] Preferably, the preset threshold value Th of the total number of bad blocks is ≥10; the value range of the interval number k of the sector is 1-10; n≥3, a%>40%; d%>10%; f%>5%.
[0031] Preferably, determine the bad block count BB test The specific methods for determining whether the ratio of M / m is greater than w% include:
[0032] Set the bad block count to BB test Initialize and make BB test =0;
[0033] Determine the proportion of bad blocks in every m sectors. When the proportion of bad blocks in each sector reaches u%, set the bad block count to BB. test =BB test +1;
[0034] Among them, u is a variable;
[0035]
[0036]
[0037] Preferably, the u%=5%-30%, and w%>5%.
[0038] Preferably, the data destruction prompt includes a dialog box and an audio and visual warning.
[0039] Advantages of the present invention: The present invention proposes a data security erasure method that can automatically process bad sectors and bad blocks. When encountering bad blocks and bad sectors, the speed of data erasure can be accelerated, and the efficiency of business processing can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flowchart of a data secure erasing method capable of automatically processing bad sectors and bad blocks according to the present invention;
[0041] Figure 2 It is a flowchart of the data secure erasure method capable of automatically processing bad sectors and bad blocks as described in Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0044] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0045] Embodiment 1:
[0046] Combine the following Figure 1 The present embodiment is described as follows. The present embodiment describes a data secure erasure method capable of automatically processing bad sectors and bad blocks, which comprises:
[0047] S1, connect the disk to be erased to the read-write interface, and determine whether the disk to be erased can be correctly identified. If "no", an alarm is given; if "yes", S2 is executed;
[0048] S2, erase the data on the disk to be erased, and determine whether the total number of bad blocks reaches a preset threshold value Th, and determine whether the erasing time T is greater than n times the estimated erasing time T when the data that is less than a% of the source disk is erased. evIf both judgments are "no", S2 is repeatedly executed until the data erasure of the entire disk is completed and an alarm is issued to indicate that the data erasure task is completed. If at least one of the two judgments is "yes", S3 is executed;
[0049] Where n is a positive integer and a is a variable;
[0050] S3. Perform a full-disk bad block detection on the disk to be erased, and automatically judge the real-time bad block detection result of the full-disk bad block according to the full-disk bad block detection scheme. When the real-time bad block detection result of the full-disk bad block meets the termination condition of the full-disk bad block detection scheme, terminate the data erasure and pop up a data destruction prompt at the same time. When the real-time bad block detection result of the full-disk bad block does not meet the termination condition of the full-disk bad block detection scheme, avoid the bad blocks and continue to erase the data until the full-disk data is erased, and an alarm is issued to indicate that the data erasure task is completed.
[0051] Furthermore, the specific method of determining whether the total number of bad blocks reaches the preset threshold Th in S2 includes:
[0052] Initialize the sector number c and the total number of bad blocks BB, so that c=0, BB=0;
[0053] Continue erasing data, starting from the sector numbered c=0, and start counting when the first bad block is found, so that the total number of bad blocks BB=BB+1;
[0054] When a bad block is found again within a sector interval of no more than k sectors, the total number of bad blocks BB = BB + 1;
[0055] The total number of bad blocks BB is compared with a preset threshold value Th. When BB≥Th, it is determined that the total number of bad blocks reaches the preset threshold value Th.
[0056] Furthermore, S2 determines whether the erasure time T is greater than n times the estimated erasure time T ev The specific methods include:
[0057] Read the capacity of the source disk S 源 , the capacity of the disk to be erased S 目标 , Standard data erasure rate of source disk V 源 and the standard data erasure rate V of the disk to be erased 目标 ;
[0058] Calculate the estimated erase time T ev :
[0059]
[0060] Start erasing the data on the disk to be erased and determine whether the erasing time T is greater than n times the estimated erasing time T ev , that is: T>n*Tev .
[0061] Furthermore, the full disk bad block detection solution in S3 includes:
[0062] Count the number of bad block sectors in the entire disk, calculate the ratio of the number of bad block sectors in the entire disk to the total number of sectors, and determine whether the ratio is greater than d%, where d is a variable.
[0063] Furthermore, the full disk bad block detection solution in S3 also includes:
[0064] Count the number of sectors with consecutive bad blocks, calculate the ratio of the number of sectors with consecutive bad blocks to the total number of sectors, and determine whether the ratio is greater than f%, where f is a variable.
[0065] Furthermore, the preset threshold value Th of the total number of bad blocks is ≥10; the value range of the interval number k of the sector is 1-10; n≥3, a%>40%; d%>10%; f%>5%.
[0066] Embodiment 2:
[0067] Combine the following Figure 2 This embodiment describes a data secure erasure method capable of automatically processing bad sectors and bad blocks, wherein the data erasure described in S2 further includes:
[0068] When judging whether the total number of bad blocks reaches the preset threshold value Th, and judging whether the erasure time T is greater than n times the estimated erasure time T when the data erased from the source disk is less than a% of the data ev At the same time, determine the bad block count BB test Whether the ratio of M / m is greater than w%, where m sectors are taken as a unit and M represents the total number of sectors;
[0069] Among them, w is a variable;
[0070] If the total number of bad blocks reaches the preset threshold Th, or the data erased from the source disk is less than a% of the data, the erasure time T is greater than n times the estimated erasure time T ev , then execute S3;
[0071] If the bad block count BB test If the ratio of M / m is greater than w%, data erasure is terminated.
[0072] Further, determine the bad block count BB test The specific methods for determining whether the ratio of M / m is greater than w% include:
[0073] Set the bad block count to BB test Initialize and make BB test =0;
[0074] Determine the proportion of bad blocks in every m sectors. When the proportion of bad blocks in each sector reaches u%, set the bad block count to BB. test =BB test +1;
[0075] Among them, u is a variable;
[0076]
[0077]
[0078] Furthermore, the u%=5%-30%, and w%>5%.
[0079] Furthermore, the data destruction prompt includes a dialog box and an audio and visual warning.
[0080] Embodiment 3:
[0081] The three full disk bad block detection schemes described in this implementation specifically include:
[0082] Solution 1: Count the number of bad sectors in the entire disk. If "the number of sectors with bad blocks / the total number of sectors>d%" is true, the data erasure program is terminated, and a dialog box and an audible and visual alarm are popped up to prompt the user to execute the hard disk physical destruction process; d is defined by the user, and it is recommended that d>10.
[0083] The meaning of this solution is that when the number of sectors with bad blocks in the hard disk is greater than a certain proportion of the total number of sectors, it means that there are a large number of bad blocks in the hard disk. Even if they are erased, a lot of time will be wasted and irreversible damage will be caused to the hard disk. The hard disk has no value for reuse and the process of physical destruction of the hard disk can be executed.
[0084] Solution 2: Count the number of sectors with consecutive bad blocks, and do not count the sectors with discontinuous bad blocks. If "the number of sectors with consecutive bad blocks / the total number of sectors>f%", the data erasure program will be terminated, and a dialog box and an audible and visual alarm will pop up to prompt the user to execute the hard disk physical destruction process; f is defined by the user, and it is recommended that f>5.
[0085] The meaning of this scheme is that when the number of sectors with continuous bad blocks is greater than f% of the total number of sectors of the hard disk, it can be considered that the entire disk already has a large proportion of continuous bad blocks, and this scheme filters out the possibility of scattered bad blocks, effectively avoiding the situation where bad blocks occasionally appear in a certain area but the overall situation of the area is good, and more accurately determines whether the hard disk has reached the time when it can only be destroyed but not erased.
[0086] Option 3: BB test Initialized to 0, when there are u% bad blocks in every m sectors of the entire hard disk, let BB test =BBtest +1(BB test Every m sectors is a unit. When the bad block ratio in a unit exceeds u%, BB test Add 1, visible, BB test represents the number of units with a bad block ratio exceeding u%); calculate BB test / (total number of sectors on the hard disk / m)>w% whether it is true. If so, the data erasure program is terminated, and a dialog box and an audible and visual alarm are popped up to prompt the user to perform the hard disk physical destruction process;
[0087] Among them, w is defined by the user, and it is recommended that w>5; u% is generally between 5% and 30%, which determines whether it is meaningful to erase m sectors. When the bad block ratio exceeds u%, there are too many bad blocks, which will lead to unsatisfactory erasure and a significant increase in working time. In addition, the hard disk has poor performance after erasure and cannot work normally. In this case, it can be directly destroyed to improve efficiency.
[0088] The core meaning is: take m sectors as a unit, observe whether each unit has a specific proportion (u%) of bad blocks. When the number of units with a large number of bad blocks reaches a certain threshold, that is, w% of (total number of hard disk sectors / m), it means that the bad blocks are evenly dispersed, making most areas unusable. At this time, there is no need to erase the hard disk, and it is more time-saving to destroy it directly.
[0089] The scheme avoids the situation where a hard disk has a large number of bad blocks only in a specific area, but no bad blocks in other areas. In this case, fast erasure can be performed by skipping the specific bad block area. This scheme can effectively detect hard disks with extremely poor availability due to a large number of scattered bad blocks, avoiding a lot of time waste.
[0090] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that features described in conjunction with individual embodiments may be used in other described embodiments.
Claims
1. A data secure erasure method capable of automatically processing bad sectors and bad blocks, characterized in that: It includes: S1, connect the disk to be erased to the read-write interface, and determine whether the disk to be erased can be correctly identified. If "no", an alarm is given, and if "yes", S2 is executed; S2, erasing data on the disk to be erased, and determining whether the total number of bad blocks reaches a preset threshold value Th, and determining whether the erasing time T is greater than n times the estimated erasing time T when the data that is less than a% of the source disk is erased. ev If both judgments are "no", S2 is repeatedly executed until the data erasure of the entire disk is completed and an alarm is issued to indicate that the data erasure task is completed. If at least one of the two judgments is "yes", S3 is executed; Where n is a positive integer and a is a variable; S3. Perform a full-disk bad block detection on the disk to be erased, and automatically judge the real-time bad block detection result of the full-disk bad block according to the full-disk bad block detection scheme. When the real-time bad block detection result of the full-disk bad block meets the termination condition of the full-disk bad block detection scheme, terminate the data erasure and pop up a data destruction prompt at the same time. When the real-time bad block detection result of the full-disk bad block does not meet the termination condition of the full-disk bad block detection scheme, avoid the bad blocks and continue to erase the data until the full-disk data is erased, and an alarm is issued to indicate that the data erasure task is completed.
2. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 1, characterized in that: The data erasure described in S2 also includes: When judging whether the total number of bad blocks reaches the preset threshold value Th, and judging whether the erasure time T is greater than n times the estimated erasure time T when the data erased from the source disk is less than a% of the data ev At the same time, determine the bad block count BB test Whether the ratio of M / m is greater than w%, where m sectors are taken as a unit and M represents the total number of sectors; Among them, w is a variable; If the total number of bad blocks reaches the preset threshold Th, or the data erased from the source disk is less than a% of the data, the erasure time T is greater than n times the estimated erasure time T ev , then execute S3; If the bad block count BB test If the ratio of M / m is greater than w%, data erasure is terminated.
3. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 1, characterized in that: The specific method of determining whether the total number of bad blocks reaches the preset threshold value Th in S2 includes: Initialize the sector number c and the total number of bad blocks BB, so that c=0, BB=0; Erasing starts from the sector numbered c=0, and starts counting when the first bad block is found, so that the total number of bad blocks BB=BB+1; Continue erasing data. When a bad block is found again within a sector interval of no more than k sectors, set the total number of bad blocks BB = BB + 1. The total number of bad blocks BB is compared with a preset threshold value Th. When BB≥Th, it is determined that the total number of bad blocks reaches the preset threshold value Th.
4. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 3, characterized in that: S2: Determine whether the erasing time T is greater than n times the estimated erasing time T ev The specific methods include: Read the capacity of the source disk S 源 , the capacity of the disk to be erased S 目标 , Standard data erasure rate of source disk V 源 and the standard data erasure rate V of the disk to be erased 目标 ; Calculate the estimated erase time T ev : Start erasing the data on the disk to be erased and determine whether the erasing time T is greater than n times the estimated erasing time T ev , that is: T>n*T ev .
5. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 4, characterized in that: The full disk bad block detection solution described in S3 includes: Count the number of bad block sectors in the entire disk, calculate the ratio of the number of bad block sectors in the entire disk to the total number of sectors, and determine whether the ratio is greater than d%, where d is a variable.
6. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 5, characterized in that: The full disk bad block detection solution described in S3 also includes: Count the number of sectors with consecutive bad blocks, calculate the ratio of the number of sectors with consecutive bad blocks to the total number of sectors, and determine whether the ratio is greater than f%, where f is a variable.
7. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 6, characterized in that: The preset threshold value Th of the total number of bad blocks is ≥10; the value range of the interval number k of sectors is 1-10; n≥3, a%>40%; d%>10%; f%>5%.
8. The data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 2, characterized in that: Determine the bad block count BB test The specific methods for determining whether the ratio of M / m is greater than w% include: Set the bad block count to BB test Initialize and make BB test =0; Determine the proportion of bad blocks in every m sectors. When the proportion of bad blocks in each sector reaches u%, set the bad block count to BB. test =BB test +1; Among them, u is a variable; calculate judge Is it greater than w%.
9. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to claim 8, characterized in that: The u%=5%-30%, and w%>5%.
10. A data secure erasure method capable of automatically processing bad sectors and bad blocks according to any one of claims 1 to 9, characterized in that: The data destruction prompt includes a dialog box and an audible and visual warning.