Method for obtaining available NV-RAM of Hitachi hard disk
Technical Field
The invention belongs to the field of data recovery, relates to hard disk data recovery, and particularly relates to a method for acquiring an available NV-RAM (nonvolatile random access memory) of a Hitachi hard disk.
Background
Hard disks play an extremely important role in devices for storing data, and data recovery becomes more important with the rapid increase of data storage amount and the increase of data importance.
For the failures of Hitachi hard disks, the firmware layer failures are common, for example, the NV-RAM of the Hitachi hard disks is damaged or lost, and the key for repairing the firmware layer failures is the acquisition and write-back of the available NV-RAM. In the prior art, because a simple and effective method for acquiring the available NV-RAM is not available, a certain module in firmware cannot be written back, so that the hard disk cannot be identified by a computer, when hard disk data cannot be accessed, a maintenance worker has to adopt methods of directly disassembling and replacing a magnetic head, and the like, so that not only are manpower and material resources consumed, but also the hard disk is frequently subjected to secondary damage due to expansion of hard disk faults caused by human factors, and even the hard disk is completely damaged, and therefore, the acquisition of the available NV-RAM is particularly important.
Disclosure of Invention
Aiming at the defects of the prior art and the problems, the invention provides a method for acquiring the available NV-RAM of the Hitachi hard disk, which is characterized in that the difference between the NV-RAM in a firmware area and the original NV-RAM data is compared, searched and modified, and the modified NV-RAM data is written back to a fault hard disk as the available NV-RAM of the Hitachi hard disk. The method has the advantages of simplicity, effectiveness and low cost, and avoids secondary damage to the hard disk caused by disassembling the hard disk and replacing the magnetic head, even completely damaging the hard disk, and the method comprises the following steps:
s1, connecting the hard disk to the computer and obtaining the handle of the hard disk;
s2, sending an instruction to the hard disk to acquire an original NV-RAM in the ROM of the hard disk;
s3, searching fixed features in the original NV-RAM;
s4, searching and matching the fixed characteristic in the effective searching address range of the firmware area;
s5: judging whether the matching is successful, if so, executing step S6, otherwise, executing step S4;
s6: extracting continuous 1024 bytes of data including the fixed features in the firmware area, wherein the continuous 1024 bytes of data are backup NV-RAM in the firmware area;
s7, comparing the backup NV-RAM with the original NV-RAM by taking the data of the original NV-RAM as a standard, searching and modifying the data which is different from the original NV-RAM in the backup NV-RAM, and saving the modified backup NV-RAM as an available NV-RAM;
and S8, writing the modified backup NV-RAM back to a failed hard disk and verifying that the failed hard disk can be identified and read.
Preferably, the fixed feature in the original NV-RAM is E2 PR.
Preferably, in the original NV-RAM and the backup NV-RAM, 4 bytes from address 0x00000000 to address 0x00000003 are the fixed features, 8 bytes from address 0x00000004 to address 0x0000000B are the firmware version number of the hard disk, and the fixed features and the firmware version number are both stored in ASCII encoding form.
Preferably, in step S7, the backup NV-RAM data is different from the original NV-RAM data by 1 byte of data in the backup NV-RAM at address 0x0000000B, where the content of address 0x0000000B is bit 8 of the firmware version number.
Compared with the prior art, the invention has the advantages of simplicity, effectiveness and low cost, and avoids secondary damage to the hard disk caused by disassembling the hard disk and replacing the magnetic head, and even completely damages to the hard disk.
Drawings
FIG. 1 is a main flow diagram of the present invention;
FIG. 2 is a data structure diagram of the original NV-RAM of the present invention;
FIG. 3 is a diagram of a data structure for backing up NV-RAM in the present invention;
Detailed Description
The invention is further illustrated with reference to the figures and examples.
As shown in fig. 1, a method for acquiring available NV-RAM of a hitachi hard disk includes the following steps:
s1, connecting the hard disk to the computer and obtaining the handle of the hard disk so that the computer can access the resource of the fault hard disk;
s2, sending an instruction to the hard disk to obtain the original NV-RAM in the ROM of the hard disk;
s3, searching a fixed characteristic E2PR in the original NV-RAM;
s4, if fixed characteristic E2PR is found in step S3, fixed characteristic E2PR is found and matched in the effective search address range 0x0001B 02B-0 x0002182E of the firmware area;
s5: judging whether the matching is successful, if so, executing step S6, otherwise, executing step S4;
s6: extracting continuous 1024 bytes of data including the fixed characteristic E2PR from the firmware area, wherein the 1024 bytes of data are backup NV-RAM in the firmware area;
s7, as shown in FIG. 2 and FIG. 3, in the original NV-RAM and the backup NV-RAM, 4 bytes from address 0x00000000 to address 0x00000003 are fixed feature E2PR, 8 bytes from address 0x00000004 to address 0x0000000B are firmware version numbers of the hard disk, and both the fixed feature E2PR and the firmware version numbers are stored in ASCII coding form;
comparing the backup NV-RAM with the original NV-RAM, as shown in fig. 2 and 3, with respect to the data of the original NV-RAM, where the backup NV-RAM data is different from the original NV-RAM data by 1 byte of data with an address of 0x0000000B in the backup NV-RAM, the address of 0x0000000B is the 8 th bit of the firmware version number, the byte of data in the backup NV-RAM is 0xC1, and the byte of data in the original NV-RAM is 0x41, modifying the byte of data in the backup NV-RAM to 0x41, and saving the modified byte of data in the backup NV-RAM as an available NV-RAM;
and S8, writing the modified backup NV-RAM back to the failed hard disk, verifying that the failed hard disk can be identified and read, and recovering data.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations are possible to those skilled in the art in light of the above teachings, and that all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.