Data recovery method, device, computer equipment and readable storage medium

By combining format scanning and deep scanning methods, the cluster number and sector number information of the file is obtained, and the preset relationship function is used to calculate the sector information of the storage device, which solves the problem of low file recovery success rate and low efficiency in the existing technology. problem, complete attribute and data recovery of files is achieved.

CN112380061BActive Publication Date: 2024-10-11WANXING TECH GRP (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011284150.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-17
Publication Date
2024-10-11
Estimated Expiration
2040-11-17

AI Technical Summary

Technical Problem

In the existing data recovery technology, the file recovery success rate is low and the efficiency is not high, especially when the data recovery fails after the storage device is formatted, or the file attributes are lost during deep recovery, and it is difficult to find the target file among a large number of files, resulting in recovery efficiency. low.

Method used

By performing a format scan and two deep scans on the storage device, the cluster number and sector number information of the file is obtained, and the number of sectors in each cluster and the starting sector number of the first cluster of the storage device are calculated based on the preset relationship function, and the samples are matched to restore target file.

Benefits of technology

It realizes the complete attribute and data recovery of files, improves the recovery success rate and efficiency, avoids the respective shortcomings of format scanning and deep scanning, and provides user-friendly file recovery results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112380061B_ABST
    Figure CN112380061B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data recovery method, device, computer equipment and readable storage medium. The method includes: obtaining the first sample and the second sample of each sector file to obtain the first sample queue and the second sample queue; performing sample matching on the first sample queue and the second sample queue according to the size information of the two samples, and determining that the samples are matched if the size information is equal, until at least two groups of matching samples are obtained; based on the cluster number and the sector number of the two groups of matching samples, the number of sectors per cluster of the storage device and the starting sector number of the first cluster are calculated according to a preset relationship function; the target cluster number of the target recovery file is obtained from the first sample queue, and the target sector number of the target recovery file is calculated according to the relationship function; and the target recovery file is restored according to the target sector number and the target cluster number. The method combines the advantages of the two sample acquisition methods to provide users with complete attributes and data file recovery results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a data recovery method, device, computer equipment and storage medium. Background Art

[0002] Data recovery refers to the technology of rescuing and recovering lost electronic data stored on desktop hard drives, laptop hard drives, server hard drives, storage tape libraries, mobile hard drives, USB flash drives, digital memory cards, MP3s, and other devices through technical means.

[0003] ExFAT file system is a commonly used file system type for external devices such as USB flash drives, mobile disks, and SD cards. This file system has the characteristics of supporting large capacity, large files, fast file location, cross-operating system support, and wide application range. Currently, the commonly used recovery technologies mainly include fast recovery, format recovery, and deep recovery.

[0004] However, after studying the usage scenarios of recovery products, it was found that users often format storage devices due to incorrect operations, resulting in data recovery failure, file inability to open, and low recovery success rate; or when performing deep recovery, even if the file data can be recovered, the key attributes of the file are lost; or because the number of files to be deeply recovered in actual application scenarios is huge, it is difficult for users to directly find the files they want to recover, and they have to traverse all files for recovery, which is inefficient. Summary of the invention

[0005] The embodiments of the present invention provide a data recovery method, apparatus, computer equipment and readable storage medium, aiming to solve the problems of low file recovery success rate and low efficiency in the prior art.

[0006] In a first aspect, an embodiment of the present invention provides a data recovery method, which includes:

[0007] Scan each sector of the storage device once, obtain a first sample of the file in each sector, and store it into a first sample queue of a corresponding type according to the file type, wherein the first sample at least includes a cluster number and size information of the file;

[0008] Perform a second scan on each sector of the storage device to obtain a second sample of the file in each sector, and store the second sample in a second sample queue of a corresponding type according to the file type, wherein the second sample at least includes the sector number and size information of the file;

[0009] Perform sample matching on the first sample queue and the second sample queue of the same type according to the size information to obtain at least two groups of matching samples;

[0010] Respectively obtaining the cluster number and the sector number of each group of samples in the matching samples, and calculating the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function;

[0011] Obtaining a target cluster number of a target recovery file from the first sample queue, and calculating a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster, and the starting sector number of the first cluster;

[0012] The target recovery file is restored according to the target sector number and the target cluster number.

[0013] In a second aspect, an embodiment of the present invention provides a data recovery device, comprising:

[0014] A one-time scanning module, used to scan each sector of the storage device once, obtain a first sample of the file in each sector, and store it into a first sample queue of the corresponding type according to the file type, wherein the first sample at least includes the cluster number and size information of the file;

[0015] A secondary scanning module, used to perform a secondary scan on each sector of the storage device, obtain a second sample of the file in each sector, and store it in a second sample queue of a corresponding type according to the file type, wherein the second sample at least includes the sector number and size information of the file;

[0016] A matching module, used for performing sample matching on the first sample queue and the second sample queue of the same type according to the size information to obtain at least two groups of matching samples;

[0017] A first calculation module, used for respectively obtaining the cluster number and the sector number of each group of matching samples in the matching samples, and calculating the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function;

[0018] A second calculation module is used to obtain a target cluster number of a target recovery file from the first sample queue, and calculate a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster and the starting sector number of the first cluster;

[0019] The file recovery module is used to recover the target recovery file according to the target sector number and the target cluster number.

[0020] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data recovery method described in the first aspect when executing the computer program.

[0021] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the data recovery method described in the first aspect above.

[0022] The embodiment of the present invention provides a data recovery method, device, computer equipment and storage medium. The method includes obtaining the first sample and the second sample of each sector file to obtain the first sample queue and the second sample queue; performing sample matching on the first sample queue and the second sample queue according to the size information of the first sample and the second sample, and determining that the sample matches if the size information is equal, until at least two groups of matching samples are obtained; based on the cluster number and the sector number of the two groups of matching samples, the number of sectors per cluster and the starting sector number of the first cluster of the storage device are calculated according to the preset relationship function; the target cluster number of the target recovery file is obtained from the first sample queue, and the target sector number of the target recovery file is calculated according to the relationship function and the number of sectors per cluster and the starting sector number of the first cluster of the storage device; and the target recovery file is restored according to the target sector number and the target cluster number. The method combines the advantages of the acquisition methods of the first sample and the second sample, and finally provides the user with a file recovery result with complete attributes and data, and at the same time combines the advantages of the above two types of recovery technologies to solve and avoid their respective shortcomings. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0024] Figure 1 A schematic diagram of a data recovery method according to an embodiment of the present invention;

[0025] Figure 2 A schematic diagram of a sub-process of a data recovery method provided by an embodiment of the present invention;

[0026] Figure 3 A schematic diagram of another sub-process of the data recovery method provided by an embodiment of the present invention;

[0027] Figure 4 A schematic diagram of another sub-process of the data recovery method provided by an embodiment of the present invention;

[0028] Figure 5 A schematic diagram of another sub-process of the data recovery method provided by an embodiment of the present invention;

[0029] Figure 6A schematic block diagram of a data recovery device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] 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 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.

[0031] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0032] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0033] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0034] After studying the use scenarios of recovery products, it is found that users often lose the key information of the original ExFAT file system after formatting the external storage device due to incorrect operations, including the number of sectors per cluster (SPC) and the first cluster starting sector number (FCS). In this case, the above-mentioned recovery technology is used for formatting scanning. Even if the attributes of the lost file such as the data storage location mentioned above are obtained, the location is recorded in the smallest unit of the file system: cluster. At this time, it cannot be directly corresponding to the specific sector location of the disk, which eventually leads to the recovery of the attribute information (name, size, time) of the lost file, but the specific file data recovery fails, resulting in the file being unable to be opened, and the recovery success rate is not high. On the other hand, in deep recovery, since only the data area of ​​the file is recovered, even if the file data can be successfully recovered, the key attributes of the file such as the name attribute and the time attributes such as creation and modification are lost. In actual user scenarios, due to the huge number of files to be deeply recovered, such as the number of files that can reach millions of files in deep recovery of a 500G disk, it is difficult for users to directly find the files they want to recover, and the efficiency of traversing one by one is low.

[0035] The method provided by the embodiment of the present invention combines the advantages of deep scanning and formatted scanning, and ultimately provides the user with a file recovery result with complete attributes and data. At the same time, it combines the advantages of the above two types of recovery technologies to solve and avoid their respective shortcomings.

[0036] See also Figure 1 This is a flow chart of a data recovery method provided by an embodiment of the present invention. The method includes steps S110 to S160.

[0037] S110, obtaining a first sample of each sector file, and storing the first sample in a first sample queue, wherein the first sample at least includes a cluster number and size information of the file.

[0038] In this embodiment, the storage device can be a desktop hard disk, a notebook hard disk, a server hard disk, a storage tape library, a mobile hard disk, a USB flash drive, a digital memory card, an MP3, etc. The sample acquisition method is a formatted scan or a deep scan, and this embodiment uses a formatted scan. Each sector of the storage device is formatted and scanned one by one to obtain the cluster number and size information of the file as the first sample, and the first sample is stored in the first sample queue, thereby obtaining the first sample queue that records the cluster number and size information of multiple files.

[0039] For example, format and scan the computer hard disk, find file A and file B, obtain the cluster number and file size information of file A and file B, and store the cluster number and file size information of file A and file B as the first sample in the first sample queue.

[0040] In one embodiment, if Figure 2 As shown, step S110 includes:

[0041] S111, format and scan the files in each sector, and match the directory entries of the files in each sector;

[0042] S112, extracting attribute information of the file from the directory entry, the attribute information at least including the cluster number, size information and type information of the file;

[0043] S113, storing the cluster numbers and size information of all files as first samples in a first sample queue of the corresponding type according to the type information of each file;

[0044] S114, combining the first sample queues of multiple types to obtain a first sample queue group;

[0045] S115. Continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned.

[0046] In this embodiment, the file information in each sector of the storage device is formatted and scanned to obtain the directory entry of each file in each sector. The directory entry records the cluster number of the storage location of the corresponding file in the storage device, the size information of the file, and the type information of the file. The cluster number and size information of each file are extracted from the directory entry as the first sample and stored in the first sample queue of the corresponding file type. Finally, the first sample queues of different file types are summarized to obtain the scanning result of the formatted scan, that is, the first sample queue group. Then, the file of the next sector of the storage device is scanned until all sectors of the storage device are scanned to obtain the formatted scan sample queue group storing the first samples of all sectors.

[0047] For example, a storage device is formatted and scanned to obtain directory entries of files A and B. From the directory entries, it is found that the file type of file A is PDF and the file type of file B is JPG. Then, the cluster number and size information of file A are extracted from the directory entries and stored in the formatted scan sample queue of PDF; the cluster number and size information of file B are extracted and stored in the formatted scan sample queue of JPG type. Finally, the formatted scan sample queues of files A and B are summarized to construct a formatted scan sample queue group of the storage device.

[0048] S120. Obtain a second sample of each sector file, and store the second sample in a second sample queue, where the second sample at least includes the sector number and size information of the file.

[0049] In this embodiment, the sample is obtained by deep scanning. The files in each sector of the storage device are deeply scanned, the file type, the sector number of the file and the size information of the file are recorded, and then the sector number and the size information of the file are extracted as the second sample, and the second sample is stored in the second sample queue.

[0050] For example, a deep scan is performed on each sector of the storage device to obtain the type information of file A as PDF, the sector number 02 where the file is located, and the file size information 200M. The sector number 01 and the file size 200M are combined into a binary information and stored in the deep scan sample queue of the PDF type.

[0051] In one embodiment, if Figure 3 As shown, step S120 includes:

[0052] Step S121, deeply scan the files in each sector, and record the sector number and size information of the files of the specified file type;

[0053] Step S122: storing the sector numbers and size information of all files as second samples in a second sample queue of the corresponding type according to the type information of each file;

[0054] Step S123, combining multiple types of the second sample queues to obtain a second sample queue group;

[0055] Step S124, continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned.

[0056] In this embodiment, the files in each sector are deeply scanned to obtain the file type specified by the user to be read, the sector number and size information of the file are recorded, and according to the type information of the file, the sector number and size information of the file are stored as the second sample in the second sample queue of the corresponding type, and finally the second sample queues of different file types are summarized to construct a second sample queue group storing the second sample of the current sector. Among them, the file type specified to be read can be PDF, Word, JPG or PNG. After reading the currently read sector, continue to read the next sector of the storage device. The scanning steps of the next sector are the same as the scanning steps of the previous sector, which will not be repeated here. Until all sectors of the storage device are scanned.

[0057] For example, if the currently specified file type to be read is PDF, when scanning the storage device, if a PDF file type A file is matched, the sector number 1 and size information 200M of file A in the storage device are recorded and stored in the deep scan sample queue of the PDF file type. Continue scanning the current sector, if other PDF file types B and C files are matched, the sector number and size information of file B and file C are also recorded and stored in the deep scan sample queue of the PDF file type.

[0058] S130. Perform sample matching on the first sample queue and the second sample queue according to the size information of the first sample and the second sample to obtain at least two groups of matching samples.

[0059] In this embodiment, the first sample queue and the second sample queue of the same file type are extracted, and sample matching is performed on the first sample queue and the second sample queue according to the size information of the first sample and the second sample. If there are files with the same size information and the same file type, the first sample and the second sample are determined to be matching samples. The matching is continued to match at least two groups of matching samples from the formatted scan sample queue and the deep scan sample queue.

[0060] In one embodiment, if Figure 4 As shown, step S130 includes:

[0061] Step S131, extracting the first sample from the first sample queue in sequence;

[0062] Step S132: extracting second samples from the second sample queue in order, and comparing the size information of the extracted second samples with the size information of the extracted first samples;

[0063] Step S133: If the size information of the extracted first sample is equal to the size information of the extracted second sample, it is determined that the first sample and the second sample belong to a group of matching samples;

[0064] Step S134: If the size information of the extracted first sample is not equal to the size information of the extracted second sample, then continue to extract the second sample from the deep scan sample queue in sequence and compare them until at least two groups of matching samples are obtained.

[0065] In this embodiment, in order to ensure the matching accuracy of the first sample queue and the second sample queue, it is preset to extract the first first sample from the first sample queue in sequence, and then extract the first second sample from the second sample queue of the same file type, and compare whether the size information of the first sample and the second sample is equal. If the size information of the two samples is equal, it indicates that the two samples belong to the same file and are determined as a group of matching samples; if the size information of the two samples is not equal, then continue to extract the second second sample from the second sample queue and compare it with the first one-time scanning sample until a second sample matching the first first sample is matched or all second samples are matched. Then continue to extract the second one-time scanning sample, and then extract the unmatched second sample from the second sample queue in sequence and compare the size information with the second first sample until two groups of matching samples are obtained.

[0066] For example, the size of the first sample A1 extracted from the formatted scan sample queue A is 20M, and the deep scan samples B1 to B1 are extracted from the deep scan sample queue B in sequence. n Compare the size information with sample A1, and match the size information of B4 to A1. Then A1 and B4 are a set of matching samples. Then extract A2 from the formatted scan sample queue in sequence, and extract all deep scan samples except B4 from the deep scan sample queue in sequence to compare the size information with A2.

[0067] S140, respectively obtaining the cluster number and the sector number of each group of matching samples in the matching samples, and calculating the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function.

[0068] In this embodiment, two groups of matching samples are determined based on the above steps, the cluster numbers and sector numbers of the two groups of matching samples are obtained, and the number of sectors per cluster of the storage device and the starting sector number of the first cluster are calculated according to a preset relationship function, wherein the preset relationship function is as follows:

[0069]

[0070] Where S1 is the sector number of the first group of matching samples, S2 is the sector number of the second group of matching samples, C1 is the cluster number of the first group of matching samples, C2 is the cluster number of the second group of matching samples, FCS is the starting sector number of the first cluster, and SPC is the number of sectors per cluster.

[0071] S150, obtaining a target cluster number of a target recovery file from the first sample queue, and calculating a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster, and the starting sector number of the first cluster;

[0072] S160. Restore the target recovery file according to the target sector number and the target cluster number.

[0073] In this embodiment, based on the first cluster starting sector number and the number of sectors per cluster of the storage device calculated in the above steps, a relationship function is determined. The target cluster number of the target recovery file is obtained from the first sample queue, and the target sector number of the target recovery file storage location is calculated according to the cluster number of the target recovery file and the first cluster starting sector number and the number of sectors per cluster of the storage device according to the relationship function, and then the target recovery file is restored according to the target sector number.

[0074] In one embodiment, if Figure 5 As shown, step S160 includes:

[0075] S161, querying the file operation record of the target recovery file according to the target sector number and the target cluster number;

[0076] S162: Restore the target recovery file according to the file operation record.

[0077] In this embodiment, according to the target sector number and the target cluster number, the file operation record of the target recovery file is queried to find the target recovery file, and the deletion mark of the file header of the target recovery file is changed to restore the target recovery file.

[0078] This method combines the advantages of deep scanning and formatting scanning, and ultimately provides users with file recovery results with complete attributes and data. At the same time, it combines the advantages of the above two types of recovery technologies to solve and avoid their respective shortcomings.

[0079] The embodiment of the present invention further provides a data recovery device, which is used to execute any embodiment of the above-mentioned data recovery method. Figure 6 , Figure 6 1 is a schematic block diagram of a data recovery device provided by an embodiment of the present invention. The data recovery device 100 may be configured in a server.

[0080] like Figure 6As shown, the data recovery device 100 includes a first acquisition module 110 , a second acquisition module 120 , a matching module 130 , a first calculation module 140 , a second calculation module 150 , and a file recovery module 160 .

[0081] A first acquisition module 110 is used to acquire a first sample of each sector file and store the first sample in a first sample queue, where the first sample at least includes a cluster number and size information of the file;

[0082] A second acquisition module 120 is used to acquire a second sample of each sector file and store the second sample in a second sample queue, where the second sample at least includes the sector number and size information of the file;

[0083] A matching module 130, configured to perform sample matching on the first sample queue and the second sample queue based on the size information of the first sample and the second sample to obtain at least two groups of matching samples;

[0084] A first calculation module 140 is used to obtain the cluster number and the sector number of each group of matching samples in the matching samples, and calculate the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function;

[0085] A second calculation module 150 is used to obtain a target cluster number of a target recovery file from the first sample queue, and calculate a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster and the starting sector number of the first cluster;

[0086] The file recovery module 160 is used to recover the target recovery file according to the target sector number and the target cluster number.

[0087] In one embodiment, the first acquisition module 110 includes:

[0088] The format scanning unit is used to format and scan the files in each sector and match the directory entries of the files in each sector;

[0089] An extraction unit, used to extract attribute information of a file from the directory entry, wherein the attribute information at least includes a cluster number, size information and type information of the file;

[0090] A first storage unit, used for storing the cluster numbers and size information of all files as first samples in a first sample queue of a corresponding type according to the type information of each file;

[0091] A combining unit, used for combining a plurality of types of first sample queues to obtain a first sample queue group;

[0092] The format scanning unit is used to continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned.

[0093] In one embodiment, the second acquisition module 120 includes:

[0094] A deep scanning unit is used to deeply scan the files in each sector and record the sector number and size information of the files of the specified file type;

[0095] A second storage unit, used for storing the sector numbers and size information of all files as second samples in a second sample queue of a corresponding type according to the type information of each file;

[0096] A second combining unit, configured to combine a plurality of types of the second sample queues to obtain a second sample queue group;

[0097] The deep scanning unit is used to continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned.

[0098] In one embodiment, the matching module 130 includes:

[0099] An extraction unit, configured to extract first samples from the first sample queue in sequence;

[0100] a comparing unit, configured to extract second samples from the second sample queue in sequence, and compare size information of the extracted second samples with size information of the extracted first samples;

[0101] A determination unit is used to determine that the first sample and the second sample belong to the same file if the size information of the extracted first sample is equal to that of the extracted second sample; if the size information of the extracted first sample and the second sample is not equal, continue to extract the second sample from the second sample queue in sequence and compare them until at least two groups of matching samples are obtained.

[0102] In one embodiment, the file recovery module 160 includes:

[0103] A query unit, used for querying the file operation record of the target recovery file according to the target sector number and the target cluster number;

[0104] The recovery unit is used to recover the target recovery file according to the file operation record.

[0105] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data recovery method as described above when executing the computer program.

[0106] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the data recovery method as described above.

[0107] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0108] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.

[0109] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0110] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0111] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), disk or optical disk and other media that can store program codes.

[0112] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A data recovery method, characterized in that: include: Obtaining a first sample of each sector file, and storing the first sample in a first sample queue, wherein the first sample at least includes a cluster number and size information of the file; Obtain a second sample of each sector file, and store the second sample in a second sample queue, where the second sample at least includes the sector number and size information of the file; Perform sample matching on the first sample queue and the second sample queue according to the size information of the first sample and the second sample to obtain at least two groups of matching samples; Respectively obtaining the cluster number and the sector number of each group of matching samples in the matching samples, and calculating the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function; Wherein, the preset relationship function is as follows: S1=FCS+C1×SPC S2=FCS+C2×SPC, Where S1 is the sector number of the first group of matching samples, S2 is the sector number of the second group of matching samples, C1 is the cluster number of the first group of matching samples, C2 is the cluster number of the second group of matching samples, FCS is the starting sector number of the first cluster, and SPC is the number of sectors per cluster; Obtaining a target cluster number of a target recovery file from the first sample queue, and calculating a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster, and the starting sector number of the first cluster; Recovering the target recovery file according to the target sector number and the target cluster number; The acquiring the first sample of each sector file and storing the first sample in the first sample queue comprises: Format and scan the files in each sector and match the directory entries of the files in each sector; Extracting attribute information of the file from the directory entry, the attribute information at least including the cluster number, size information and type information of the file; According to the type information of each file, the cluster number and size information of all files are stored as first samples in a first sample queue of the corresponding type; Combining the first sample queues of multiple types to obtain a first sample queue group; Continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned; The acquiring the second sample of each sector file and storing the second sample in the second sample queue comprises: Deeply scan the files in each sector and record the sector number and size information of the files of the specified file type; According to the type information of each file, the sector numbers and size information of all files are stored as second samples in a second sample queue of the corresponding type; Combining a plurality of types of the second sample queues to obtain a second sample queue group; Continue reading the file in the next sector of the storage device until all sectors of the storage device are scanned; The performing sample matching on the first sample queue and the second sample queue according to the size information of the first sample and the second sample to obtain at least two groups of matching samples comprises: Extracting a first sample from the first sample queue in sequence; Extracting second samples from the second sample queue in sequence, and comparing size information of the extracted second samples with size information of the extracted first samples; If the size information of the extracted first sample is equal to the size information of the extracted second sample, it is determined that the first sample and the second sample belong to a group of matching samples; If the size information of the extracted first sample is not equal to the size information of the extracted second sample, the second samples are continuously extracted from the second sample queue in sequence and compared until at least two groups of matching samples are obtained.

2. The data recovery method according to claim 1, characterized in that: The step of restoring the target recovery file according to the target sector number and the target cluster number includes: According to the target sector number and the target cluster number, query the file operation record of the target recovery file; The target recovery file is restored according to the file operation record.

3. A data recovery device, characterized in that: include: A first acquisition module, used for acquiring a first sample of each sector file, and storing the first sample in a first sample queue, wherein the first sample at least includes a cluster number and size information of the file; A second acquisition module, used for acquiring a second sample of each sector file, and storing the second sample in a second sample queue, wherein the second sample at least includes the sector number and size information of the file; A matching module, configured to perform sample matching on the first sample queue and the second sample queue according to the size information of the first sample and the second sample, to obtain at least two groups of matching samples; The first calculation module is used to obtain the cluster number and the sector number of each group of matching samples in the matching samples respectively, and calculate the number of sectors per cluster and the starting sector number of the first cluster of the storage device according to a preset relationship function; wherein the preset relationship function is as follows: S1=FCS+C1×SPC S2=FCS+C2×SPC, Where S1 is the sector number of the first group of matching samples, S2 is the sector number of the second group of matching samples, C1 is the cluster number of the first group of matching samples, C2 is the cluster number of the second group of matching samples, FCS is the starting sector number of the first cluster, and SPC is the number of sectors per cluster; A second calculation module is used to obtain a target cluster number of a target recovery file from the first sample queue, and calculate a target sector number of the target recovery file according to the relationship function, the number of sectors per cluster and the starting sector number of the first cluster; A file recovery module, used for recovering the target recovery file according to the target sector number and the target cluster number; The first acquisition module includes: The format scanning unit is used to format and scan the files in each sector and match the directory entries of the files in each sector; An extraction unit, used to extract attribute information of a file from the directory entry, wherein the attribute information at least includes a cluster number, size information and type information of the file; A first storage unit, used for storing the cluster numbers and size information of all files as first samples in a first sample queue of a corresponding type according to the type information of each file; A first combining unit, used for combining a plurality of types of first sample queues to obtain a first sample queue group; A format scanning unit, used for continuing to read the file in the next sector of the storage device until all sectors of the storage device are scanned; The second acquisition module includes: A deep scanning unit is used to deeply scan the files in each sector and record the sector number and size information of the files of the specified file type; A second storage unit, used for storing the sector numbers and size information of all files as second samples in a second sample queue of a corresponding type according to the type information of each file; A second combining unit, configured to combine a plurality of types of the second sample queues to obtain a second sample queue group; A deep scanning unit, used to continue reading files in the next sector of the storage device until all sectors of the storage device are scanned; The matching module comprises: An extraction unit, configured to extract first samples from the first sample queue in sequence; a comparing unit, configured to extract second samples from the second sample queue in sequence, and compare size information of the extracted second samples with size information of the extracted first samples; A determination unit is used to determine that the first sample and the second sample belong to the same file if the size information of the extracted first sample is equal to that of the extracted second sample; if the size information of the extracted first sample and the second sample is not equal, continue to extract the second sample from the second sample queue in sequence and compare them until at least two groups of matching samples are obtained.

4. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the data recovery method according to any one of claims 1 to 2 is implemented.

5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the data recovery method according to any one of claims 1 to 2.