Method for realizing defect hard disk isolation based on PCI-E device

文档序号:877479 发布日期:2021-03-19 浏览:6次 中文

阅读说明:本技术 一种基于pci-e装置实现隔离缺陷硬盘的方法 (Method for realizing defect hard disk isolation based on PCI-E device ) 是由 梁效宁 董超 许超明 彭炼 于 2020-12-04 设计创作,主要内容包括:本发明公开了一种基于PCI-E装置实现隔离缺陷硬盘的方法,其特征在于,所述方法包括以下步骤:S100:将所述缺陷硬盘连接至PCI-E装置,并将所述PCI-E装置连接至电脑主板的PCI-E通道,其中,所述PCI-E装置具有转接SATA接口的功能且包括PCI-E转SATA的转接芯片、PCI-E接口、SATA接口;S200:上位机加密原指令并将加密后的伪指令及数据发送至所述PCI-E装置的驱动程序;S300:所述PCI-E装置的驱动程序接收并解密上位机发送的伪指令,并将解密后的指令发送至指定端口的所述缺陷硬盘;S400:所述PCI-E装置的驱动程序等待所述缺陷硬盘响应,并将结果返回至上位机。(The invention discloses a method for realizing the isolation of a defective hard disk based on a PCI-E device, which is characterized by comprising the following steps: s100: connecting the defect hard disk to a PCI-E device, and connecting the PCI-E device to a PCI-E channel of a computer mainboard, wherein the PCI-E device has the function of switching SATA interfaces and comprises a switching chip for switching PCI-E to SATA, a PCI-E interface and an SATA interface; s200: the upper computer encrypts an original instruction and sends the encrypted pseudo instruction and data to a driver of the PCI-E device; s300: the driver of the PCI-E device receives and decrypts the pseudo instruction sent by the upper computer and sends the decrypted instruction to the defective hard disk of the designated port; s400: and the driver of the PCI-E device waits for the response of the defective hard disk and returns the result to the upper computer.)

1. A method for realizing the isolation of a defective hard disk based on a PCI-E device is characterized by comprising the following steps:

s100: connecting the defect hard disk to a PCI-E device, and connecting the PCI-E device to a PCI-E channel of a computer mainboard, wherein the PCI-E device has the function of switching SATA interfaces and comprises a switching chip for switching PCI-E to SATA, a PCI-E interface and an SATA interface;

s200: the upper computer encrypts an original instruction and sends the encrypted pseudo instruction and data to a driver of the PCI-E device;

s300: the driver of the PCI-E device receives and decrypts the pseudo instruction sent by the upper computer and sends the decrypted instruction to the defective hard disk of the designated port;

s400: and the driver of the PCI-E device waits for the response of the defective hard disk and returns the result to the upper computer.

2. The method according to claim 1, wherein the step S200 comprises the following steps:

s201: the upper computer encrypts the original instruction, which comprises the following steps:

s2011: installing a driver of the PCI-E device on a device manager;

s2012: after the defective hard disk is connected to the PCI-E device, confirming that the computer cannot access the defective hard disk;

s2013: encrypting original commands 0x00,0x00,0x00,0x00,0x00,0x00 and 0xEC for obtaining basic information of the defective hard disk into 0x0D,0x01,0x1,0x1,0x01,0x1,0x1 and 0xED, and marking as a pseudo command 1, wherein 0x0D is a check bit;

s202: sending pseudo instruction 1 to a driver of the PCI-E device: and allocating a storage space with the same size as the data buffer area at the upper computer, and sending the pseudo instruction 1 and the data contained in the data buffer area to a driving program of the PCI-E device.

3. The method according to claim 1, wherein the step S300 comprises the steps of:

s301: the driver decryption pseudo-instruction of the PCI-E device comprises the following steps:

s3011: the driver verification pseudo-instruction 1 of the PCI-E device: adding the values of all the instructions and recording the sum after the addition;

s3012: judging whether the added sum is equal to 0x100, if so, indicating that the verification is successful, executing a step S3013, otherwise, executing a step S405;

s3013: decrypting the encrypted pseudo-instruction 1: removing the check bit 0x0D of the pseudo instruction 1, and subtracting one from the value of each remaining byte to obtain an instruction 0x00,0x00,0x00,0x00,0x00,0x00 and 0xEC, and recording the instruction as data 2;

s302: and the driver of the PCI-E device sends the data 2 to the defective hard disk of the appointed port.

4. The method according to claim 1, wherein the step S400 comprises the following steps:

s401: acquiring the basic state of the defective hard disk: acquiring the value of a state register of the defective hard disk of the designated port;

s402: judging whether the value of the currently acquired status register is normal, if so, executing a step S403, otherwise, executing a step S404;

s403: process and respond to the data, perform step S405, including the steps of:

the driving program of the PCI-E device acquires the state of the defective hard disk and the data returned by the defective hard disk, then sends the state and the data to an upper computer, marks the result of the instruction execution as successful, and executes the step S405;

s404: after resetting the defective hard disk, judging whether the value of the currently acquired status register is normal, if so, executing a step S403, otherwise, executing a step S405;

s405: and returning the instruction execution result.

5. The method according to claim 4, wherein the step S405 comprises the steps of:

s4051: the upper computer judges the execution result of the current instruction, if the execution result is successful, the step S4052 is executed, and if the execution result is not successful, the step S4053 is executed;

s4052: the upper computer receives and displays the state and the data of the defective hard disk, and the process is ended;

s4053: and the upper computer displays the failed state information and prevents the computer from being stuck when accessing the defective hard disk.

Technical Field

The invention belongs to the field of data recovery, relates to a method for isolating a defective hard disk, and particularly relates to a method for isolating a defective hard disk based on a PCI-E device.

Background

In the field of data recovery, with the continuous expansion of the capacity of a hard disk and the continuous increase of user groups of the hard disk, the hard disk is damaged more and more, when a computer end is directly connected with the hard disk, the computer end can directly use a reading ATA instruction to access the hard disk, and if the defective hard disk is directly connected to the computer end, the computer end and the hard disk are possibly blocked.

In the case of needing to extract data of the hard disk or in other cases needing to access the hard disk, the hard disk is generally directly connected with an operating system at a computer end, and a read instruction is used for accessing the data of the hard disk.

Disclosure of Invention

Aiming at the defects of the prior art, the invention provides a method for realizing the isolation of a defective hard disk based on a PCI-E device, which realizes the isolation of the defective hard disk by adopting the interaction between an upper computer and a driving program of the PCI-E device and avoids the jamming of a computer end and/or the hard disk, and the method comprises the following steps:

s100: connecting the defect hard disk to a PCI-E device, and connecting the PCI-E device to a PCI-E channel of a computer mainboard, wherein the PCI-E device has the function of switching SATA interfaces and comprises a switching chip for switching PCI-E to SATA, a PCI-E interface and an SATA interface;

s200: the upper computer encrypts an original instruction and sends the encrypted pseudo instruction and data to a driver of the PCI-E device;

s300: the driver of the PCI-E device receives and decrypts the pseudo instruction sent by the upper computer and sends the decrypted instruction to the defective hard disk of the designated port;

s400: and the driver of the PCI-E device waits for the response of the defective hard disk and returns the result to the upper computer.

Preferably, the step S200 includes the steps of:

s201: the upper computer encrypts the original instruction, which comprises the following steps:

s2011: installing a driver of the PCI-E device on a device manager;

s2012: after the defective hard disk is connected to the PCI-E device, confirming that the computer cannot access the defective hard disk;

s2013: encrypting original commands 0x00,0x00,0x00,0x00,0x00,0x00 and 0xEC for obtaining basic information of the defective hard disk into 0x0D,0x01,0x1,0x1,0x01,0x1,0x1 and 0xED, and marking as a pseudo command 1, wherein 0x0D is a check bit; s202: sending pseudo instruction 1 to a driver of the PCI-E device: and allocating a storage space with the same size as the data buffer area at the upper computer, and sending the pseudo instruction 1 and the data contained in the data buffer area to a driving program of the PCI-E device.

Preferably, the step S300 includes the steps of:

s301: the driver decryption pseudo-instruction of the PCI-E device comprises the following steps:

s3011: the driver verification pseudo-instruction 1 of the PCI-E device: adding the values of all the instructions and recording the sum after the addition;

s3012: judging whether the added sum is equal to 0x100, if so, indicating that the verification is successful, executing a step S3013, otherwise, executing a step S405;

s3013: decrypting the encrypted pseudo-instruction 1: removing the check bit 0x0D of the pseudo instruction 1, and subtracting one from the value of each remaining byte to obtain an instruction 0x00,0x00,0x00,0x00,0x00,0x00 and 0xEC, and recording the instruction as data 2;

s302: and the driver of the PCI-E device sends the data 2 to the defective hard disk of the appointed port.

Preferably, the step S400 includes the steps of:

s401: acquiring the basic state of the defective hard disk: acquiring the value of a state register of the defective hard disk of the designated port;

s402: judging whether the value of the currently acquired status register is normal, if so, executing a step S403, otherwise, executing a step S404;

s403: process and respond to the data, perform step S405, including the steps of:

the driving program of the PCI-E device acquires the state of the defective hard disk and the data returned by the defective hard disk, then sends the state and the data to an upper computer, marks the result of the instruction execution as successful, and executes the step S405;

s404: after resetting the defective hard disk, judging whether the value of the currently acquired status register is normal, if so, executing a step S403, otherwise, executing a step S405;

s405: and returning the instruction execution result.

Preferably, the step S405 includes the steps of:

s4051: the upper computer judges the execution result of the current instruction, if the execution result is successful, the step S4052 is executed, and if the execution result is not successful, the step S4053 is executed;

s4052: the upper computer receives and displays the state and the data of the defective hard disk, and the process is ended;

s4053: and the upper computer displays the failed state information and prevents the computer from being stuck when accessing the defective hard disk.

The invention has the beneficial effect of solving the technical problem that the computer end and/or the hard disk can be blocked when accessing the hard disk, particularly the defective hard disk.

Drawings

Fig. 1 is a general flow chart of the method provided by the present invention.

Detailed Description

Fig. 1 shows a general flow chart of the method provided by the present invention. As shown in fig. 1, the method comprises the following steps:

s100: connecting the defective hard disk to a PCI-E device, and connecting the PCI-E device to a PCI-E channel of a computer mainboard, wherein the PCI-E device has the function of switching SATA interfaces and comprises a switching chip for switching PCI-E to SATA, a PCI-E interface and an SATA interface;

s200: the upper computer encrypts an original instruction and sends the encrypted pseudo instruction and data to a driver of the PCI-E device;

step S200 includes the steps of:

s201: the upper computer encrypts the original instruction, which comprises the following steps:

s2011: for the PCI-E to SATA expansion chip contained in the standard PCI-E device, a custom driver is needed to take over the device, namely, the driver of the PCI-E device is installed on the device manager;

s2012: after the defective hard disk is connected to the PCI-E device, confirming that the computer cannot access the defective hard disk;

s2013: when a 0xEC instruction needs to be sent to obtain basic information of a hard disk, for example, an original instruction 0x00,0x00,0x00,0x00,0x00,0x00,0xEC for obtaining basic information of a defective hard disk is encrypted to be 0x0D,0x01,0x1,0x1,0x01,0x1,0x1,0xED and recorded as a pseudo instruction 1, wherein 0x0D is a check bit;

s202: sending pseudo-instruction 1 to the driver of the PCI-E device: and the upper computer allocates a storage space with the same size as the data buffer area, and sends the pseudo instruction 1 and the data contained in the data buffer area to a driving program of the PCI-E device.

S300: a driver of the PCI-E device receives and decrypts the pseudo instruction sent by the upper computer and sends the decrypted instruction to a defective hard disk of a specified port;

step S300 includes the steps of:

s301: the driver decryption pseudo-instruction of the PCI-E device comprises the following steps:

s3011: driver verification pseudo instruction 1 of PCI-E device: adding the values of all the instructions and recording the sum after the addition;

s3012: judging whether the added sum is equal to 0x100, if so, indicating that the verification is successful, executing a step S3013, otherwise, executing a step S405;

s3013: decrypting the encrypted pseudo-instruction 1: removing the check bit 0x0D of the pseudo instruction 1, and subtracting one from the value of each remaining byte to obtain an instruction 0x00,0x00,0x00,0x00,0x00,0x00 and 0xEC, and recording the instruction as data 2;

s302: the driver of the PCI-E device sends data 2 to the defective hard disk of the designated port. The driver plays a crucial role in the system, the host computer needs to transmit data to the defective hard disk and only needs to forward the data through the driver of the PCI-E device, the operating system at the computer end can map the resources of the defective hard disk into the memory of the operating system, the resources include command transmission flag bits of different SATA ports, states of the ports, instructions of the ports, and transmitted data, which are all mapped into the memory of the operating system, and the driver needs to fill the data into a specified memory space structure and then start the task of command transmission. Each PCI-E device supports multiple SATA interfaces, and when sending an instruction for data 2 to a defective hard disk, it needs to specify the hard disk to be sent to that port, then determine the memory space of the instruction according to the port, and send the instruction and data to the defective hard disk.

S400: and the driver of the PCI-E device waits for the response of the defective hard disk and returns the result to the upper computer.

Step S400 includes the following steps:

s401: acquiring the basic state of a defective hard disk: waiting for a period of time, generally not more than 3 seconds, checking the state of the defective hard disk of the designated port, wherein the state is obtained through a state register, namely, obtaining the value of the state register of the defective hard disk of the designated port;

s402: judging whether the value of the currently acquired state register is normal or not, if so, executing step S403, otherwise, executing step S404, namely, executing step S404 when the value of the currently acquired state register is BUSY \ ERR or in an abnormal ready state;

s403: process and respond to the data, perform step S405, including the steps of:

a driving program of the PCI-E device acquires the state of the defective hard disk and data returned by the defective hard disk, then sends the state and the data to an upper computer, marks the result of the execution of the instruction as successful, and executes the step S405;

s404: after resetting the defective hard disk, judging whether the value of the currently acquired status register is normal, if so, executing step S403, otherwise, executing step S405;

s405: returning to the execution result of the instruction, step S405 includes the steps of:

s4051: the upper computer judges the execution result of the current instruction, if the execution result is successful, the step S4052 is executed, and if the execution result is not successful, the step S4053 is executed;

s4052: the upper computer receives and displays the state and data of the defective hard disk, and the process is ended;

s4053: the upper computer displays the failed state information and prevents the computer from being stuck when accessing the defective hard disk.

Through the steps from S4051 to S4053, the situation that the computer end and/or the hard disk is/are locked due to the fact that the operating system cannot directly access the defective hard disk when the normal hard disk and the defective hard disk are accessed to the operating system of the computer end is realized.

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.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:多系统联动控制方法、装置、设备和计算机可读存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!