CN116069552B - Data recovery method, data recovery device and computer readable storage medium - Google Patents
Data recovery method, data recovery device and computer readable storage mediumInfo
- Publication number
- CN116069552B CN116069552B CN202111284231.6A CN202111284231A CN116069552B CN 116069552 B CN116069552 B CN 116069552B CN 202111284231 A CN202111284231 A CN 202111284231A CN 116069552 B CN116069552 B CN 116069552B
- Authority
- CN
- China
- Prior art keywords
- data
- storage device
- storage
- data recovery
- writing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Abstract
The application discloses a data recovery method, a data recovery device and a computer readable storage medium, wherein the data recovery method comprises the steps of establishing communication connection with a first storage device, responding to the first storage device to operate in an engineering mode, reading storage data of the first storage device, responding to the storage data as logic data, obtaining a logic address of the storage data, and writing the storage data into a second storage device based on the logic address. Through the scheme, the method and the device can autonomously, safely and reliably recover the data of the storage device which cannot normally work, and effectively avoid the loss of key sensitive data.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data recovery method, a data recovery device, and a computer readable storage medium.
Background
Nowadays, due to the immaturity of firmware technology in a storage device, NAND (NAND FLASH memory) has poor quality of particles, a firmware is started up and fails, or a master control works abnormally, etc., inevitably, SSD (Solid STATE DISK) cannot work normally.
The general manufacturer only needs to choose to return the customer within the range allowed by RMA (Return Material Authorization, main process of returning and checking the bad products and handling the bad products, however, the method can cause the original data loss of the customer, or send the bad SSD back to the technicians in the factory for data recovery, but the method has complicated steps, long period and related data confidentiality. Some critical sensitive data within the SSD may be compromised during return to the factory and there is a significant risk.
Disclosure of Invention
The application mainly solves the technical problems of complicated steps, long period and larger risk of key sensitive information leakage of the data recovery method in the prior art.
In order to solve the problems, a first aspect of the present application provides a recovery writing method of a storage device, wherein the data recovery method includes establishing a communication connection with a first storage device, reading storage data of the first storage device in response to the first storage device operating in an engineering mode, obtaining a logical address of the storage data in response to the storage data being logical data, and writing the storage data to a second storage device based on the logical address.
The step of reading the storage data of the first storage device comprises the steps of sending data recovery firmware to the first storage device to enable the first storage device to operate the data recovery firmware, and sending a data reading instruction to the first storage device operating the data recovery firmware to read the storage data.
The method comprises the steps of responding to the first storage device to operate in an engineering mode, after the step of reading the storage data of the first storage device, responding to the storage data as logic data, and before the step of acquiring the logic address and the writing sequence of the storage data, reading metadata of the storage data, and judging whether the storage data is logic data or not based on data attributes of the storage data correspondingly recorded in the metadata.
The step of obtaining the logical address of the storage data comprises the step of obtaining the logical address of the storage data corresponding to the record in the metadata.
The step of writing the storage data to the second storage device based on the logical address comprises the step of writing the storage data to a storage position corresponding to the logical address in the second storage device.
The method comprises the steps of obtaining the writing sequence of storage data, and writing last written data in the storage data with the same logical address written in the first storage device into a storage position corresponding to the logical address in the second storage device according to the writing sequence.
The step of writing the storage data into the second storage device based on the logical address comprises writing the storage data into a corresponding offset position of the setting mirror image file according to the logical address, and storing the setting mirror image file into the second storage device.
The step of writing the storage data into the corresponding offset position of the set mirror image file according to the logic address comprises the steps of obtaining the writing sequence of the storage data, and writing the last written data in the storage data with the same logic address written into the first storage device for multiple times into the offset position corresponding to the logic address in the set mirror image file according to the writing sequence.
The method comprises the steps of establishing communication connection with a first storage device, responding to the first storage device operating in an engineering mode, and reading storage data of the first storage device, wherein the method further comprises the steps of acquiring characteristic parameters of the first storage device, judging whether the first storage device is in a preset support list or not based on the characteristic parameters, responding to the first storage device operating in the engineering mode, and reading the storage data of the first storage device, and the method comprises the steps of responding to the first storage device operating in the engineering mode and reading the storage data of the first storage device.
The step of writing the storage data into the second storage device based on the logical address further comprises the steps of obtaining the model number of the first storage device and the number of the storage chips included in the first storage device, judging whether all storage spaces of the first storage device have been traversed currently based on the model number and the number, and ending the current data recovery flow in response to the fact that all storage spaces of the first storage device have been traversed.
In order to solve the above problems, a second aspect of the present application provides a data recovery device, where the data recovery device includes a memory and a processor coupled to each other, the memory storing program data, and the processor is configured to execute the program data to implement the data recovery method according to any one of the above.
In order to solve the above-described problems, a third aspect of the present application provides a computer-readable storage medium having stored thereon program instructions, wherein the program instructions, when executed by a processor, implement the resume write method of any of the above.
The method has the advantages that the method is different from the situation in the prior art, when the method is in communication connection with the first storage device and determines that the first storage device runs in an engineering mode, the stored data of the first storage device can be read, so that when the stored data is logic data, the logic address of the stored data is obtained, the stored data can be written into the appointed second storage device based on the logic address, the data of the first storage device which cannot normally work can be automatically, safely and reliably recovered, and the problems that the recovery period is long, the steps are complicated and some key sensitive data are leaked and lost caused by sending the first storage device back to a manufacturing factory for data recovery are effectively avoided.
Drawings
FIG. 1 is a flowchart of a first embodiment of a data recovery method according to the present application;
FIG. 2 is a flow chart of an embodiment of S12 in FIG. 1;
FIG. 3 is a flow chart of an embodiment of S14 in FIG. 1;
FIG. 4 is a schematic flow chart of a further embodiment of S14 in FIG. 1;
FIG. 5 is a flow chart of a further embodiment of S1411 in FIG. 4;
FIG. 6 is a flowchart of a second embodiment of the data recovery method of the present application;
FIG. 7 is a flowchart of a third embodiment of a data recovery method according to the present application;
FIG. 8 is a flowchart of a data recovery method according to a fourth embodiment of the present application;
FIG. 9 is a flowchart of a data recovery method according to an embodiment of the present application;
FIG. 10 is a schematic diagram of an embodiment of a memory device according to the present application;
FIG. 11 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
The following describes embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
The terms "system" and "network" are often used interchangeably herein. The term "and/or" is merely an association relationship describing the associated object, and means that three relationships may exist, for example, a and/or B may mean that a exists alone, while a and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two.
Referring to fig. 1, fig. 1 is a flowchart of a data recovery method according to a first embodiment of the present application. It should be noted that the terms "comprising" and "having" and any variations thereof herein are intended to cover a non-exclusive inclusion. Specifically, the present embodiment includes the steps of:
And S11, establishing communication connection with the first storage device.
The data recovery method provided by the application can be particularly applied to an intelligent terminal, for example, a data recovery application program running on a user terminal is used for reading data of a storage device which cannot normally work so as to recover the data written in the storage device before abnormal work. Of course, in other embodiments, the data recovery method may be applied to a cloud server, or a background computer of a storage device manufacturing factory, which is not limited in this embodiment.
Specifically, the first storage device which cannot normally work can establish communication connection with the intelligent terminal aiming at recovering data of the first storage device by plugging an interface of the first storage device into a corresponding interface of the intelligent terminal.
It can be understood that the intelligent terminal can be a user terminal specifically, and the first storage device is connected with the communication connection realized by the user terminal locally in an interface plugging manner without networking, so as to request network services, and specifically, the data recovery of the first storage device is realized through a data recovery application program running on the user terminal without professional operation, so that the safety and reliability of corresponding data information in the data recovery process can be effectively ensured.
In another embodiment, the intelligent terminal may further include a cloud server and a user terminal that are communicatively connected to each other, for example, a corresponding data recovery application program runs on an official website of the factory to enable data recovery of the first storage device connected to the user terminal by way of network communication, or the intelligent terminal may specifically further include a background computer and a user terminal of the factory that are communicatively connected to each other, and the corresponding recovery application program runs on the background computer, while the first storage device is connected to the user terminal through an interface of the background computer, and the background computer is capable of sending a corresponding program control instruction to the first storage device by way of the user terminal to enable data recovery of the first storage device, which is not limited in the present application.
It should be noted that, the data interaction between the cloud server or the background computer and the user terminal only involves the transmission of the program control instruction, but the interaction and the acquisition of the data information cannot be performed.
Optionally, the first storage device may be specifically any one of reasonable storage devices such as SSD (Solid STATE DISK ), UFS (Universal Flash Storage, universal flash memory storage), eMMC (embedded Multi MEDIA CARD ), and the like, which is not limited in the present application.
Optionally, the intelligent terminal may be any reasonable intelligent terminal capable of running an application program, such as a computer, a tablet computer, a smart phone, a server, and the like, which is not limited in the present application.
And S12, in response to the first storage device operating in the engineering mode, reading the storage data of the first storage device.
It can be understood that the first storage device cannot normally work currently, and is different from a storage device which normally works, and the first storage device which cannot normally work is ensured to be subjected to data interaction, and special treatment needs to be performed on the first storage device, for example, a user needs to make the first storage device which cannot normally work enter an engineering mode by shorting a reserved pin or any other reasonable mode according to operation guidance.
Specifically, when the intelligent terminal detects that the first storage device which is currently in communication connection with the intelligent terminal runs in an engineering mode, it can be determined that the first storage device cannot work normally, and a data recovery program needs to be started so as to further read the stored data before the first storage device works abnormally.
And S13, responding to the stored data as logic data, and acquiring a logic address of the stored data.
It can be understood that after the intelligent terminal obtains the current stored data in the first storage device, the stored data needs to be identified and distinguished, for example, the program data in the stored data does not relate to private data of a user, and recovery is not needed.
Specifically, when the intelligent terminal detects that the currently acquired storage data is logic data, the intelligent terminal can sequentially restore and save the logic data, and further acquire the logic address of the logic data, for example, by reading a mapping table stored in the first storage device to acquire the logic address of the logic data, or reading a metadata space of the first storage device to acquire the logic address of the logic data recorded by the corresponding firmware.
It should be noted that the logic data is an operand type, and is data used to represent two states of "yes" and "no" or "true" and "false" in the binary logic. The logical address refers to an address of a memory cell (memory cell), a storage unit (storage element), or a network host (network host) from the viewpoint of an application program in the computer architecture. The logical address is often different from the physical address (PHYSICAL ADDRESS), which can be translated to a physical address by an address translator (address translator) or a mapping function.
Firmware (Firmware) is a program written in EPROM (erasable programmable read only memory) or EEPROM (electrically erasable programmable read only memory). The firmware refers to a device "driver" stored in the device, through which an operating system can implement operation of a specific machine according to a standard device driver, for example, an optical drive, a recorder, and the like all have internal firmware. Firmware is software that serves as the bottommost layer of the system's most basic. In the hardware device, the firmware is the soul of the hardware device, and because some hardware devices have no other software components except the firmware, the firmware also determines the functions and performances of the hardware device.
And S14, writing the storage data into the second storage device based on the logic address.
Specifically, after the logical address of the storage data to be restored is obtained, the storage data can be written into a storage position corresponding to the logical address in the second storage device according to the logical address, or when the storage data is intended to be restored into the set mirror image file, the corresponding offset position of the storage data written into the set mirror image file can be obtained through calculation according to the logical address, so that after the storage data is correspondingly restored into the set mirror image file, the set mirror image file is further stored into the second storage device.
It can be understood that the second storage device is a storage device which is different from the first storage device and can work normally, and specifically can be a storage space in the intelligent terminal for data recovery, or can be any other reasonable storage device which is connected to the intelligent terminal in a communication manner, and the application is not limited to this.
According to the scheme, when the communication connection is established with the first storage device which cannot normally work, and the first storage device is determined to operate in the engineering mode, the storage data of the first storage device is read, so that when the storage data is logic data, the logic address of the storage data is obtained, the storage data can be written into the appointed second storage device based on the logic address, the first storage device which cannot normally work can be automatically, safely and reliably recovered, and the problems that the recovery period is long, the steps are complicated, and some key sensitive data are leaked and lost due to the fact that the first storage device is sent back to a manufacturing factory to recover the data are effectively avoided.
Referring to fig. 2 in combination, fig. 2 is a flow chart of an embodiment of S12 in fig. 1. In one embodiment, the first embodiment of the data writing method of the memory device of the present application further includes some more specific steps in addition to S11-S14 described above. Specifically, the step S12 may specifically further include the following steps:
s121, sending the data recovery firmware to the first storage device so that the first storage device runs the data recovery firmware.
It can be understood that, because the first storage device cannot normally operate, in order to ensure that the first storage device can perform effective data reading or acquiring, the intelligent terminal specifically sends the data recovery firmware to the first storage device so as to cover the original firmware in the first storage device, so that the first storage device runs the data recovery firmware.
And S122, transmitting a data reading instruction to a first storage device running the data recovery firmware to read the storage data.
Further, after the first storage device runs the data recovery firmware, the intelligent terminal can send a data reading instruction which can be recognized and responded by the first storage device to the first storage device, so that the stored data in the first storage device can be read.
In a specific application scenario, after the first storage device adjusted to the engineering mode is plugged into the user terminal through the interface, the data recovery application program running on the user terminal identifies the first storage device in the engineering mode, specifically, downloads a firmware for data recovery to the main control of the first storage device, so that a special data reading instruction capable of being identified and responded by the first storage device can be sent to the first storage device based on the data recovery firmware.
Further, in an embodiment, the step S13 may specifically further include obtaining a logical address of the storage data corresponding to the record in the metadata.
It will be appreciated that in the metadata space of the first storage device, e.g., NAND, the response firmware will record the write sequence, logical address, and data attribute of each 4K logical data sent from the host.
Specifically, the intelligent terminal may obtain the logical address of the storage data corresponding to the record in the metadata by reading the metadata space of the first storage device. In other embodiments, the intelligent terminal may further obtain the logical address of the logical data by reading the mapping table stored in the first storage device, which is not limited in the present application.
Further, in an embodiment, the step S14 may specifically further include writing the storage data to a storage location corresponding to the logical address in the second storage device.
It can be understood that after the logical address of the logical data is obtained, the storage data to be recovered can be written into the storage position corresponding to the logical address in the second storage device correspondingly.
Referring to fig. 3 in combination, fig. 3 is a flow chart of an embodiment of S14 in fig. 1. In an embodiment, the step S14 may specifically further include the following steps:
s1401, acquiring a writing order of the storage data.
It will be appreciated that in the data storage of the storage device, the same storage data is generally unavoidable, for example, when the storage data with the same logical address is written into the first storage device multiple times, and in order to ensure that the occupation of the storage space of the second storage device by the invalid data is reduced as much as possible, the writing sequence of the same storage data needs to be identified.
Specifically, the intelligent terminal may obtain the writing sequence of the storage data corresponding to the record in the metadata by reading the metadata space of the first storage device. In other embodiments, the intelligent terminal may further directly obtain the writing sequence of each storage data written into the first storage device by reading any reasonable information such as a time stamp of the storage data, which is not limited in the present application.
And 1402, writing the last written data in the storage data with the same logical address written in the first storage device into a storage position corresponding to the logical address in the second storage device according to the writing sequence.
It can be understood that the recovery of the corresponding storage data by the intelligent terminal is performed sequentially according to the reading sequence, so that the currently acquired storage data is written into the storage position corresponding to the logic address in the second storage device sequentially. And when the corresponding logic addresses of the front and rear storage data are the same in the recovery process, the storage data which is finally written into the first storage device can be covered with the same storage data which is written before, so that the last written data in the storage data which is written into the first storage device for multiple times and has the same logic address can be reserved.
The storage data may be sequentially restored according to the position sequence of the storage space of the first storage device, for example, from the storage data in the first storage page to the last storage page, where when the storage data to be restored in the third storage page appears in the first storage page, that is, is the same as the logical address of one storage data in the first storage page, and has been restored to the second storage device, if the storage data in the third storage page is written to the first storage device after the previous comparison, the restored storage data in the first storage page is covered when the same storage data in the third storage page is restored to the storage position corresponding to the corresponding logical address in the second storage device, and when the storage data in the third storage page is earlier than the previous comparison, the storage data in the first storage page is retained to the second storage device, and the storage data in the third storage page is not restored to the second storage device, and so on, until the storage data in each storage page of the first storage device is restored to the first storage device, and the last storage data is retained to the logical address of the first storage device.
Referring to fig. 4 in combination, fig. 4 is a flowchart of a further embodiment of S14 in fig. 1. In an embodiment, the step S14 may specifically further include the following steps:
s1411, writing the storage data into the corresponding offset position of the set mirror image file according to the logic address.
Specifically, when the stored data is to be restored to the setting image file, the corresponding offset position of the stored data written to the setting image file is calculated according to the obtained logical address of the stored data, so as to restore the stored data to the setting image file correspondingly.
And S1412, storing the setting mirror image file in the second storage device.
Further, after the stored data is correspondingly restored to the set image file, the set image file can be stored in the second storage device.
Referring to fig. 5 in combination, fig. 5 is a flowchart of a further embodiment of S1411 in fig. 4.
In an embodiment, the step S1411 may specifically further include the following steps:
s14111, acquiring the writing sequence of the storage data.
It will be appreciated that the same storage data will generally inevitably exist in the data storage of the storage device, for example, when the storage data with the same logical address is written into the first storage device many times, and in order to ensure that the occupation of the storage space of the second storage device by the invalid data is reduced as much as possible, the writing sequence of the same storage data needs to be identified.
Specifically, the intelligent terminal may obtain the writing sequence of the storage data corresponding to the record in the metadata by reading the metadata space of the first storage device. In other embodiments, the intelligent terminal may further directly obtain the writing sequence of each storage data written into the first storage device by reading any reasonable information such as a time stamp of the storage data, which is not limited in the present application.
And S14112, writing the last written data in the storage data with the same logical address written in the first storage device for multiple times into an offset position corresponding to the logical address in the set mirror image file according to the writing sequence.
Specifically, when the stored data is to be restored to the set mirror image file, the corresponding offset position of the stored data written to the set mirror image file is calculated according to the obtained logical address of the stored data, so as to restore the stored data to the set mirror image file correspondingly, and according to the obtained writing sequence of the stored data, it is ensured that the last written data in the stored data with the same logical address written to the first storage device for multiple times is restored to the set mirror image file.
Referring to fig. 6, fig. 6 is a flowchart of a data recovery method according to a second embodiment of the application. The data recovery method of the present embodiment is a flowchart of a refinement embodiment of the data recovery method in fig. 1, and includes the following steps:
And S21, establishing communication connection with the first storage device.
And S22, in response to the first storage device operating in the engineering mode, reading the storage data of the first storage device.
The S21 and S22 are the same as S11 and S12 in fig. 1, and specific reference is made to S11 and S12 and the related text descriptions thereof, which are not repeated here.
S23, reading metadata of the stored data.
It will be appreciated that in the metadata space of the first storage device, e.g., NAND, the response firmware will record the write sequence, logical address, and data attribute of each 4K logical data sent from the host.
Wherein the data attribute is used for distinguishing whether the 4K data is program data or logic data of firmware.
Specifically, when the intelligent terminal determines that the first storage device is operated in the engineering mode, the first storage device metadata space is further read to read metadata of the storage data, that is, a writing sequence, a logic address and a data attribute of each logic data.
S24, judging whether the storage data is logic data or not based on the data attribute of the storage data corresponding to the record in the metadata.
Therefore, by reading the metadata of the storage data, whether the storage data is logic data can be further judged according to the data attribute of the storage data correspondingly recorded in the metadata.
If it is determined that the storage data is logic data, S25 is executed, and if it is determined that the storage data is not logic data, S22 is executed again until all storage spaces of the first storage device are traversed.
S25, acquiring a logic address of the stored data.
And S26, writing the storage data into the second storage device based on the logic address.
The S25 and S26 are the same as S13 and S14 in fig. 1, and specific reference is made to S13 and S14 and the related text descriptions thereof, which are not repeated here.
Referring to fig. 7, fig. 7 is a flowchart of a data recovery method according to a third embodiment of the application. The data recovery method of the present embodiment is a flowchart of a refinement embodiment of the data recovery method in fig. 3, and includes the following steps:
And S31, establishing communication connection with the first storage device.
The S31 is the same as S11 in fig. 1, please refer to S11 and the related text descriptions thereof, and the detailed description is omitted herein.
S32, acquiring characteristic parameters of the first storage device.
It can be understood that in order to distinguish products of different companies and protect user data privacy, when recovering data in the first storage device which cannot normally work, whether the corresponding intelligent terminal has data recovery authority to the current first storage device is also required to be judged.
Specifically, the feature code or signal corresponding to the first storage device and sent to the intelligent terminal is detected, so as to obtain the feature parameter of the first storage device, for example, any reasonable feature parameter such as the model number or the product serial number of the first storage device, so that the first storage device is identified and distinguished through the feature parameter.
S33, judging whether the first storage device is in a preset support list or not based on the characteristic parameters.
Further, a preset support list with data recovery authority is established in advance according to the characteristic parameters of the first storage device in the intelligent terminal, so that when the characteristic parameters of the first storage device are acquired, whether the first storage device currently connected to the intelligent terminal has the data recovery authority can be judged based on whether the characteristic parameters exist in the preset support list.
Wherein, if the first storage device is in the preset support list of the intelligent terminal, S34 is performed, and if the first storage device is not in the preset support list of the intelligent terminal, S37 is performed.
And S34, in response to the first storage device operating in the engineering mode, reading the storage data of the first storage device.
And S35, responding to the stored data as logic data, and acquiring a logic address of the stored data.
And S36, writing the storage data into the second storage device based on the logic address.
The S34, S35 and S36 are the same as S12, S13 and S14 in fig. 1, and refer to S12, S13 and S14 and their related text descriptions, and are not repeated here.
S37, ending the current recovery program.
Specifically, when it is determined that the first storage device does not exist in the preset support list of the intelligent terminal, it is indicated that the intelligent terminal does not have data recovery authority on the first storage device, the current data recovery program needs to be ended, and corresponding prompt information is popped up to inform the user.
Referring to fig. 8, fig. 8 is a flowchart of a data recovery method according to a fourth embodiment of the application. The data recovery method of the present embodiment is a flowchart of a refinement embodiment of the data recovery method in fig. 1, and includes the following steps:
and S41, establishing communication connection with the first storage device.
And S42, in response to the first storage device operating in the engineering mode, reading the storage data of the first storage device.
S43, responding to the stored data as logic data, and acquiring the logic address of the stored data.
And S44, writing the storage data into the second storage device based on the logic address.
The S41, S42, S43 and S44 are the same as S11, S12, S13 and S14 in fig. 1, and specific reference is made to S11, S12, S13 and S14 and the related text descriptions thereof, and are not repeated here.
And S45, acquiring the model number of the first storage device and the number of the storage chips included in the first storage device.
It can be understood that, since the data recovery of the stored data in the first storage device is specifically performed sequentially, the specific storage space of the first storage device needs to be determined, so as to prevent the data recovery program from ending in advance, and ensure that important data is not missed.
Since mass production mode is a mainstream production mode in the industry, industrial products of the same model will generally have the same functional parameters, for example, storage devices of the same model will generally have the same storage space size.
Specifically, to obtain a specific storage space size of the first storage device, before or during data recovery of the first storage device, the model number of the first storage device and the number of storage chips included in the first storage device need to be obtained, so as to further determine the storage space size of the first storage device.
And S46, judging whether all storage spaces of the first storage device are traversed currently or not based on the model numbers and the quantity.
Further, after the model number of the first storage device and the number of the storage chips included in the first storage device are obtained, the storage space size of the first storage device can be further determined, so as to determine whether the currently performed data recovery has traversed all storage spaces of the first storage device.
If all the storage spaces of the first storage device have been traversed currently, S47 is executed, and if all the storage spaces of the first storage device have not been traversed currently, S42 is executed again until all the storage spaces of the first storage device have been traversed.
And S47, ending the current data recovery flow in response to the fact that all the storage spaces of the first storage device have been traversed.
Specifically, when it is determined that all the storage spaces of the first storage device have been traversed, it indicates that the data originally stored in the first storage device has been completely restored to the specified image file or the specified second storage device for restoration, and the current data restoration process may be ended.
Referring to fig. 9, fig. 9 is a flowchart of a data recovery method according to an embodiment of the application. The embodiment comprises the following steps:
S51, selecting a storage device.
Specifically, a storage device that has failed to function properly is selected to connect to the intelligent terminal loaded with the restore application.
S52, judging whether the storage device is in a preset support list of the recovery application program.
And acquiring characteristic parameters of the storage device, such as a product model, so as to determine whether the product model exists in a preset support list preset in a recovery application program of the intelligent terminal.
Wherein S53 is performed if the storage device is in the preset support list of the resume application, and S54 is performed if the storage device is not in the preset support list of the resume application.
S53, whether to enter an engineering mode.
Further, it is detected whether the memory device enters an engineering mode, for example, whether a preset pin of the memory device is shorted.
Wherein S55 is performed if the storage device enters the engineering mode, and S54 is performed if the storage device does not enter the engineering mode.
S54, recovery fails.
Specifically, when it is determined that the storage device is not in a preset support list of the recovery application program or the storage device does not enter the engineering mode, it is determined that the recovery fails, and corresponding prompt information is popped up to remind a user.
S55, downloading special data recovery firmware.
Specifically, because the storage device cannot normally work, in order to ensure that the storage device can be effectively read or obtained data, the intelligent terminal specifically sends the data recovery firmware to the storage device so as to cover the original firmware in the first storage device, so that the storage device runs the data recovery firmware.
S56, acquiring characteristic parameters of the storage device.
It can be understood that, in order to distinguish products of different companies and protect privacy of user data, when recovering data in the first storage device which cannot normally work, it is also required to determine whether the first storage device has a right to recover the data.
Specifically, the feature code or signal corresponding to the first storage device and sent to the intelligent terminal is detected, so as to obtain the feature parameter of the first storage device, for example, any reasonable feature parameter such as the model number or the product serial number of the first storage device, so as to identify and distinguish the first storage device.
S57, traversing all storage spaces of the storage device.
Specifically, the storage space of the storage device is traversed to sequentially acquire the storage data in the storage device until all the storage spaces of the storage device are traversed.
S58, whether the data type of the metadata record of the currently acquired storage data is logic data or not.
It will be appreciated that, for example, when an SSD is used as an example of a storage device, data written into its NAND FLASH (flash memory) host is programmed, its corresponding data attribute, logical address, and writing order, that is, metadata, are recorded in metadata of each 4K data.
When data recovery is needed, the SSD can enter an engineering mode through a preset method, and then the main control operation special data recovery firmware is downloaded and enabled. The private data recovery firmware may be responsive to a vendor provided private data recovery application. The special data recovery tool traverses all NAND FLASH spaces in the SSD through commands, namely traverses from Page 0 (the 0 th sequence number of the minimum storage and processing unit in the database) to the last Page of the last Block in sequence, and decides whether to recover the data, the recovered logical address and other operations according to the content of the metadata of each 4K. After the traversing is completed, the content of the original disk is completely backed up to the appointed mirror image file or the appointed new disk.
Wherein S59 is performed if the current storage data is logic data, and S57 is performed if the current storage data is not logic data.
S59, whether the data writing sequence of the metadata record is the latest.
It will be appreciated that it is generally unavoidable that the same memory data will be present in the data storage of the memory device, for example, where memory data having the same logical address is written to the memory device multiple times.
Specifically, the intelligent terminal may obtain the writing sequence of the storage data corresponding to the record in the metadata by reading the metadata space of the storage device, and determine whether the currently restored storage data is the storage data that is newly written into the storage device according to the writing sequence, that is, the writing sequence is the storage data that is finally written into the storage device.
Wherein S510 is performed if the current writing order is up-to-date, and S57 is performed if the current writing order is not up-to-date.
S510, recovering to the image file or recovering to the appointed hard disk.
Further, determining whether the current restore and storage mode restores the stored data to an image file or to a specified hard disk, specifically, may be determined by program setting or receiving a selection instruction input by a user.
Wherein S511 is performed if it is determined to restore the current storage data to the image file, and S512 is performed if it is determined to restore the current storage data to the specified hard disk.
S511, writing the data just read out into the offset position of the appointed mirror image file according to the logical address of the metadata record, and completing the recovery of one data.
And when the current stored data is restored to the mirror image file, writing the data which is just read out into the offset position of the appointed mirror image file according to the logic address of the metadata record so as to finish the restoration of one data.
And S512, writing the data just read out into the same logical address of the appointed hard disk according to the logical address of the metadata record, and completing the recovery of one data.
When the current stored data is restored to the appointed hard disk, the data which is just read out is written into the same logic address of the appointed hard disk according to the logic address recorded by the metadata, and the restoration of one data is completed.
S513, detecting whether all storage space has been traversed.
Specifically, whether all storage spaces have been traversed is detected, for example, by determining whether all storage spaces have been traversed currently through a predetermined storage space size of the storage device.
Wherein, if all the storage spaces have been currently traversed, S514 is performed, and if all the storage spaces have not been currently traversed, S57 is performed.
S514, recovering.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a memory device according to an embodiment of the application. The data recovery device 61 comprises a memory 611 and a processor 612 coupled to each other, the memory 611 storing program data, the processor 612 for executing the program data to implement the data recovery method as described in any of the above.
In an embodiment, the data recovery device 61 specifically includes an interface (not shown) coupled to each other, a first storage space (not shown) and a second storage space (not shown), where the interface is used to connect to a storage device to be recovered, the first storage space stores program data, and the processor 612 is used to execute the program data, so as to implement the data recovery method according to any one of the above, so as to store the stored data in the storage device to the second storage space.
Optionally, the storage device may be any reasonable storage device, such as SSD (Solid STATE DISK ), UFS (Universal Flash Storage, universal flash memory storage), eMMC (embedded Multi MEDIA CARD), and the application is not limited thereto.
Optionally, the data recovery device 61 may be any reasonable intelligent terminal capable of running an application program, such as a computer, a tablet computer, a smart phone, and a server, which is not limited in this application.
Specifically, the processor 612 may also be referred to as a CPU (Central Processing Unit ). The processor 612 may be an integrated circuit chip having signal processing capabilities. The Processor 612 may also be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), a Field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 612 may be commonly implemented by an integrated circuit chip.
Referring to fig. 11, fig. 11 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present application. The computer-readable storage medium 71 stores program instructions 711 executable by a processor, the program instructions 711 for implementing the data recovery method according to any one of the above.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
The elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over network elements. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
Claims (12)
1. A data recovery method for a storage device, the data recovery method comprising:
Establishing a communication connection with a first storage device;
responding to the short circuit of reserved pins of the first storage device, determining that the first storage device operates in an engineering mode, and acquiring a program control instruction sent by a background computer;
Transmitting the program control instruction to the first storage device so as to enable the first storage device to start a data recovery program;
Reading the stored data before the first storage device works abnormally;
Responding to the stored data as logic data, and acquiring a logic address of the stored data;
The stored data is written to a second storage device based on the logical address.
2. The data recovery method according to claim 1, wherein the step of reading the stored data of the first storage device includes:
Transmitting data recovery firmware to the first storage device to enable the first storage device to run the data recovery firmware;
and sending a data reading instruction to the first storage device running the data recovery firmware so as to read the storage data.
3. The data recovery method according to claim 1, wherein after the step of reading the stored data of the first storage device, the step of acquiring the logical address and the writing order of the stored data in response to the stored data being logical data, comprises:
Reading metadata of the stored data;
and judging whether the stored data is logic data or not based on the data attribute of the stored data which is correspondingly recorded in the metadata.
4. A data recovery method according to claim 3, wherein the step of obtaining the logical address of the stored data comprises:
and acquiring the logic address of the storage data corresponding to the record in the metadata.
5. The data recovery method of claim 1, wherein the step of writing the stored data to a second storage device based on the logical address comprises:
And writing the storage data into the second storage device at a storage position corresponding to the logic address.
6. The data recovery method of claim 1, wherein the step of writing the stored data to a second storage device based on the logical address comprises:
acquiring the writing sequence of the storage data;
And writing the last written data in the storage data which is written into the first storage device for multiple times and has the same logical address into a storage position corresponding to the logical address in the second storage device according to the writing sequence.
7. The data recovery method of claim 1, wherein the step of writing the stored data to a second storage device based on the logical address comprises:
Writing the storage data into a corresponding offset position of a set mirror image file according to the logic address;
and storing the setting image file to the second storage device.
8. The data recovery method according to claim 7, wherein the step of writing the stored data to the corresponding offset position of the set image file according to the logical address includes:
acquiring the writing sequence of the storage data;
And writing the last written data in the storage data with the same logical address written into the first storage device for multiple times into the offset position corresponding to the logical address in the setting mirror image file according to the writing sequence.
9. The data recovery method of claim 1, wherein after the step of establishing a communication connection with a first storage device, the step of reading the stored data of the first storage device in response to the first storage device operating in an engineering mode further comprises:
Acquiring characteristic parameters of the first storage device;
Judging whether the first storage device is in a preset support list or not based on the characteristic parameters;
The step of reading the stored data of the first storage device in response to the first storage device operating in the engineering mode, comprises:
And in response to the first storage device being in the preset support list and the first storage device being operating in the engineering mode, reading the stored data in the first storage device.
10. The data recovery method according to claim 1, further comprising, after the step of writing the stored data to a second storage device based on the logical address:
acquiring the model number of the first storage device and the number of the storage chips included in the first storage device;
Judging whether all storage spaces of the first storage device are traversed currently or not based on the model number and the number;
and ending the current data recovery flow in response to traversing all the storage spaces of the first storage device.
11. A data recovery device, wherein the data recovery device comprises a memory and a processor coupled to each other;
the memory stores program data;
the processor is configured to execute the program data to implement the data recovery method according to any one of claims 1-10.
12. A computer readable storage medium having stored thereon program instructions, which when executed by a processor implement the data recovery method of any of claims 1-10.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111284231.6A CN116069552B (en) | 2021-11-01 | Data recovery method, data recovery device and computer readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111284231.6A CN116069552B (en) | 2021-11-01 | Data recovery method, data recovery device and computer readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN116069552A CN116069552A (en) | 2023-05-05 |
| CN116069552B true CN116069552B (en) | 2026-05-05 |
Family
ID=
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103678039A (en) * | 2013-12-05 | 2014-03-26 | 华为技术有限公司 | Data recovery method and device |
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103678039A (en) * | 2013-12-05 | 2014-03-26 | 华为技术有限公司 | Data recovery method and device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112015587B (en) | Method and device for enhancing reliability of operating system | |
| CN111522562B (en) | Dishwasher software burning method, device and equipment thereof | |
| US10268845B2 (en) | Securing of the loading of data into a nonvolatile memory of a secure element | |
| CN106155596B (en) | Data writing method and device | |
| JPS6150354B2 (en) | ||
| CN110347571A (en) | A kind of crash log acquisition method, analysis method and relevant apparatus | |
| CN108596634A (en) | A kind of detection method and system of genuine component | |
| CN114281065A (en) | Electronic control unit flashing method and device for vehicle and diagnostic equipment | |
| CN116069552B (en) | Data recovery method, data recovery device and computer readable storage medium | |
| CN112052032A (en) | Flash method and device of electronic control unit | |
| CN114020306B (en) | A method, device, electronic device and storage medium for updating hard disk firmware | |
| CN110505225B (en) | Terminal card locking method and device and computer readable storage medium | |
| JP3028055B2 (en) | PC card system and program rewriting method | |
| CN115525933B (en) | Data tamper-proof method, device, electronic equipment and storage medium | |
| CN119127251A (en) | Firmware refreshing method, device, electronic device and storage medium | |
| CN106776134A (en) | A kind of method and device for rewriting chip data | |
| CN113505026B (en) | Method, device and equipment for verifying backup data and storage medium | |
| CN113470726B (en) | A method and apparatus for hard drive online detection | |
| CN116069552A (en) | Data recovery method, data recovery device and computer-readable storage medium | |
| CN109802846A (en) | USB Key certificate environment detection method and device | |
| CN115712586A (en) | Flash memory write protection method and device, electronic equipment and storage medium | |
| CN115563135A (en) | Data updating method, device, equipment and storage medium | |
| CN114996120B (en) | Debugging method, system, electronic device and storage medium | |
| CN112052125A (en) | Dump processing method and device for operating system kernel and electronic equipment | |
| JP5786702B2 (en) | Security token, instruction execution method in security token, and computer program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant |