Abstract:
A hard disk and methods for forwarding and acquiring data implemented by a hard disk. The hard disk includes: a storage module, configured to store data; an interaction interface, configured to implement data interaction between the hard disk and an external device; and a data control module, configured to control, by using the interaction interface, data interaction between the hard disk and the external device. In a process of performing backup implemented by the hard disk, a write data operation does not need to be performed on each backup hard disk when a server performs data backup by using the hard disk, which reduces operations performed by the server and releases resources of the server.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application is a continuation of International Application No. PCT/CN2014/071038, filed on Jan. 22, 2014, which claims priority to Chinese Patent Application No. 201310275096.8, filed on Jul. 2, 2013, both of which are incorporated herein by reference in their entireties. 
     
    
     TECHNICAL FIELD 
       [0002]    The present invention relates to the field of computer and network technologies, and in particular, to a hard disk and methods for forwarding and acquiring data by a hard disk. 
       BACKGROUND 
       [0003]    Currently, with the development of computer network technologies, a cloud storage technology is becoming a main trend of the storage industry, and the cloud storage technology requires a hard disk that features a large capacity and a low price and can be connected by using a network. However, hard disks commonly used in the prior art include a Serial Attached Small Computer System Interface (SAS) hard disk and a Serial Advanced Technology Attachment (SATA) hard disk. These hard disks can implement a network function by using controllers and extenders, which increases an additional cost. 
         [0004]    A cloud server in the prior art is generally connected to a hard disk in the following two manners. 
         [0005]    1. The cloud server is connected to a network storage device by using a network switch, and the cloud server needs to convert data that is written to a hard disk medium into a network-based packet. The packet is forwarded, by using a network, to the Internet Protocol (IP)-based network storage device; and the network storage device reorganizes the network-based packet to be a Small Computer System Interface (SCSI) command, and sends the SCSI command to a SAS hard disk or a SATA hard disk by using a SAS link. 
         [0006]    2. The cloud server is connected to a storage device by using a Fiber Channel (FC); the cloud server needs to convert data that is written to a hard disk medium to a SCSI command, and then converts the SCSI command to a data frame transmitted on the FC; and a network storage device receives the FC data frame, converts the FC data frame to a SCSI command, and sends the SCSI command to a SAS hard disk or a SATA hard disk by using a SAS link. 
         [0007]    A typical backup mechanism of the cloud server is that three copies are saved in a hard disk to ensure data reliability. During a backup process, the cloud server needs to perform a write data operation on each copy, and the write data operation needs to be performed three times, which occupies more resources of the cloud server. 
       SUMMARY 
       [0008]    Embodiments of the present invention provide a hard disk and methods for forwarding and acquiring data by a hard disk, to resolve a problem in the prior art that cloud backup occupies resources of a cloud server. 
         [0009]    To resolve the foregoing technical problem, the embodiments of the present invention disclose the following technical solutions. 
         [0010]    According to a first aspect, a hard disk is provided, where the hard disk includes a storage module configured to store data, an interaction interface configured to implement data interaction between the hard disk and an external device, and a data control module configured to control, by using the interaction interface, data interaction between the hard disk and the external device. 
         [0011]    In a first possible implementation manner of the first aspect, the external device is an external computer or an external hard disk. 
         [0012]    In a second possible implementation manner of the first aspect, the interaction interface is a SAS interface, a SATA interface, a universal serial bus (USB) interface, or a wireless network interface. 
         [0013]    In a third possible implementation manner of the first aspect, the interaction interface is an Internet Small Computer System Interface (iSCSI) and configured to receive, disassemble, assemble, and send iSCSI data. 
         [0014]    In a fourth possible implementation manner of the first aspect, the data control module includes a data forwarding unit configured to forward the data stored in the storage module to an external hard disk. 
         [0015]    In a fifth possible implementation manner of the first aspect, the data forwarding unit further includes a forwarding command receiving subunit configured to receive a forwarding request and forwarding configuration information, a forwarding control subunit configured to control a data forwarding process, and a forwarding status feedback subunit configured to feed back a state in which the hard disk forwards the data. 
         [0016]    In a sixth possible implementation manner of the first aspect, the data control module includes a data acquiring unit configured to acquire data from the external device and store the data in the storage module. 
         [0017]    According to a second aspect, a method for forwarding data implemented by a hard disk is provided, where the method includes receiving data, and storing the data and forwarding the data to an external device. 
         [0018]    In a first possible implementation manner of the second aspect, the method further includes a step of receiving a forwarding request and forwarding configuration information. 
         [0019]    In a second possible implementation manner of the second aspect, the method further includes a step of feeding back a state in which the hard disk forwards the data. 
         [0020]    In a third possible implementation manner of the second aspect, the data is forwarded to the external device at the same time when the data is stored. 
         [0021]    In a fourth possible implementation manner of the second aspect, the data is forwarded to the external device after the data is stored. 
         [0022]    According to a third aspect, a method for acquiring data implemented by a hard disk is provided, where the method includes receiving a data acquiring command, establishing a data connection with an external device, and acquiring required data. 
         [0023]    In a first possible implementation manner of the third aspect, the external device is an external hard disk. 
         [0024]    In a second possible implementation manner of the third aspect, the data acquiring command includes a network address of the external device. 
         [0025]    According to the hard disk in the embodiments of the present invention, an interaction interface and a data control module are added to the hard disk, so that the hard disk may actively implement a function of data interaction; therefore, a write data operation does not need to be performed on each backup hard disk when a server performs data backup by using the hard disk, which reduces operations performed by the server and greatly releases resources of the server. The method for forwarding data implemented by a hard disk in the embodiments of the present invention is a method for forwarding data by using the foregoing hard disk to implement data backup; and the method for acquiring data implemented by a hard disk in the embodiments of the present invention is a method for acquiring data from an external device by using the foregoing hard disk to implement data backup. Both of the foregoing two methods may implement automatic backup of the hard disk, reduce operations performed by the server, and release resources of the server. 
     
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         [0026]    To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show some embodiments of the present invention, and persons of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts. 
           [0027]      FIG. 1  is a schematic structural diagram of a hard disk according to an embodiment of the present invention. 
           [0028]      FIG. 2  is a schematic diagram of a connection architecture between a server and a hard disk according to an embodiment of the present invention. 
           [0029]      FIG. 3  is a schematic structural diagram of a data forwarding unit according to an embodiment of the present invention. 
           [0030]      FIG. 4  is a schematic flowchart of a first method for forwarding data implemented by a hard disk according to an embodiment of the present invention. 
           [0031]      FIG. 5  is a schematic flowchart of a second method for forwarding data implemented by a hard disk according to an embodiment of the present invention. 
           [0032]      FIG. 6  is a schematic flowchart of a third method for forwarding data implemented by a hard disk according to an embodiment of the present invention. 
           [0033]      FIG. 7  is a schematic flowchart of a method for acquiring data implemented by a hard disk according to an embodiment of the present invention. 
           [0034]      FIG. 8  is a schematic flowchart of interaction between a server and a hard disk according to Embodiment 1 of the present invention. 
           [0035]      FIG. 9  is a schematic flowchart of interaction between a server and a hard disk according to Embodiment 2 of the present invention. 
       
    
    
     DESCRIPTION OF EMBODIMENTS 
       [0036]    To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. The described embodiments are a part rather than all of the embodiments of the present invention. 
         [0037]    With reference to the accompanying drawings and the embodiments, the following further describes in detail specific implementation manners of the present invention. The following embodiments are used for illustrating the present invention, but not limiting the scope of the present invention. 
         [0038]    As shown in  FIG. 1 , according to a first aspect, a hard disk is provided, where the hard disk includes a storage module configured to store data, an interaction interface configured to implement data interaction between the hard disk and an external device, and a data control module configured to control, by using the interaction interface, data interaction between the hard disk and the external device. 
         [0039]    The external device may be an external computer or an external hard disk; and the interaction interface may be a SAS interface, a SATA interface, a USB interface, or a wireless network interface. 
         [0040]    As shown in  FIG. 2 , the interaction interface may also be an iSCSI and configured to receive, disassemble, assemble, and send iSCSI data. When the interaction interface is an iSCSI, the iSCSI may enable the hard disk to directly connect to a server and another hard disk that are on an iSCSI network; therefore, a storage architecture of network storage is simplified, and storage efficiency is improved. 
         [0041]    The data control module may include a data forwarding unit configured to forward the data stored in the storage module to an external hard disk. 
         [0042]    As shown in  FIG. 3 , the data forwarding unit may include a forwarding command receiving subunit configured to receive a forwarding request and forwarding configuration information, a forwarding control subunit configured to control a data forwarding process, and a forwarding status feedback subunit configured to feed back a state in which the hard disk forwards the data. 
         [0043]    The forwarding request and the forwarding configuration information received by the forwarding command receiving subunit may be set by a user by using a network server, and sent by the network server to the hard disk. The state in which the hard disk forwards the data includes three states: forwarding not started, being forwarded, and forwarding completed. 
         [0044]    Certainly, an implementation manner in which the hard disk forwards data to perform backup is corresponding to an implementation manner in which the hard disk acquires data from the external device to perform backup. In an embodiment of the present invention, the data control module includes a data acquiring unit configured to acquire data from the external device and store the data in the storage module. This manner may also implement a function of data backup. 
         [0045]    As shown in  FIG. 4 , according to a second aspect, a method for forwarding data implemented by a hard disk is provided, where the method includes the following steps. 
         [0046]    S 1 : Receive data. 
         [0047]    S 2 : Store the data and forward the data to an external device. 
         [0048]    The foregoing method is used in a case in which data received by a hard disk needs to be forwarded and backed up to a backup hard disk and the backup hard disk has been specified. 
         [0049]    Certainly, the hard disk may determine, by receiving a forwarding request, whether to perform forwarding. In this case, the forwarding method may further include step S 0 : Receive a forwarding request and forwarding configuration information. As shown in  FIG. 5 , the method for forwarding data implemented by a hard disk includes the following steps. 
         [0050]    S 0 : Receive a forwarding request and forwarding configuration information. 
         [0051]    S 1 : Receive data. 
         [0052]    S 2 : Store the data and forward the data to an external device. 
         [0053]    After forwarding the data to a backup hard disk, the hard disk may feed back a state in which the hard disk forwards the data to a party that sends the request. In this case, as shown in  FIG. 6 , the method for forwarding data implemented by a hard disk includes the following steps. 
         [0054]    S 1 : Receive data. 
         [0055]    S 2 : Store the data and forward the data to an external device. 
         [0056]    S 3 : Feed back a state in which the hard disk forwards the data. 
         [0057]    Forwarding modes of the hard disk include a synchronous forwarding mode and an asynchronous forwarding mode. 
         [0058]    In the synchronous forwarding mode of the hard disk, in the step S 2  of the method for forwarding data implemented by a hard disk, the data is forwarded to the external device at the same time when the data is stored. 
         [0059]    In the asynchronous forwarding mode of the hard disk, in the step S 2  of the method for forwarding data implemented by a hard disk, the data is forwarded to the external device after the data is stored. 
         [0060]    A method corresponding to the method for forwarding data implemented by a hard disk is acquiring, by a hard disk, data from an external device to perform backup. As shown in  FIG. 7 , the foregoing method for acquiring data implemented by a hard disk may include the following steps. 
         [0061]    S 11 : Receive a data acquiring command. 
         [0062]    S 12 : Establish a data connection with an external device. 
         [0063]    S 13 : Acquire required data. 
         [0064]    The external device may be an external hard disk, and the data acquiring command may include a network address of the external device, so that a data connection is established with the external device in subsequent steps. 
         [0065]    The following illustrates, by using embodiments, specific implementation processes of the hard disk, the method for forwarding data implemented by a hard disk, and the method for acquiring data implemented by a hard disk according to the present invention. 
       Embodiment 1 
       [0066]    In this embodiment, as shown in  FIG. 8 , a hard disk forwards, in a synchronous forwarding mode, data received from a server, and a procedure is as follows. 
         [0067]    At a server end, the server sends a forwarding request. 
         [0068]    At a hard disk end, after receiving the forwarding request, the hard disk feeds back previous forwarding configuration information to the server. 
         [0069]    At the server end, after receiving the previous forwarding configuration information, the server sends new forwarding configuration information. 
         [0070]    At the hard disk end, after receiving the new forwarding configuration information, the hard disk returns a forwarding configuration result to the server. 
         [0071]    At the server end, after receiving the forwarding configuration result, the server sends data. 
         [0072]    At the hard disk end, at the same time when receiving the data, the hard disk forwards the data to a backup hard disk, and feeds back a state in which the hard disk receives the data and a state in which the hard disk forwards the data. 
         [0073]    At the server end, the server receives the data receiving state and the data forwarding state fed back by the hard disk. 
       Embodiment 2 
       [0074]    In this embodiment, as shown in  FIG. 9 , a hard disk forwards, in an asynchronous forwarding mode, data received from a server, and operations are as follows. 
         [0075]    At a server end, the server sends a forwarding request. 
         [0076]    At a hard disk end, after receiving the forwarding request, the hard disk feeds back previous forwarding configuration information to the server. 
         [0077]    At the server end, after receiving the previous forwarding configuration information, the server sends new forwarding configuration information. 
         [0078]    At the hard disk end, after receiving the new forwarding configuration information, the hard disk returns a forwarding configuration result to the server. 
         [0079]    At the server end, after receiving the forwarding configuration result, the server sends data. 
         [0080]    At the hard disk end, the hard disk receives the data and feeds back a receiving state to the server. 
         [0081]    At the server end, the server receives the receiving state fed back by the hard disk. 
         [0082]    At the hard disk end, the hard disk forwards the data to a backup hard disk. 
         [0083]    At the server end, the server sends a forwarding status query request. 
         [0084]    At the hard disk end, the hard disk receives the forwarding status query request and feeds back a forwarding state to the server. 
         [0085]    At the server end, the server receives the forwarding state. 
         [0086]    Persons of ordinary skill in the art may understand that, each aspect of the present invention or a possible implementation manner of each aspect may be specifically implemented as a system, a method, or a computer program product. Therefore, each aspect of the present invention or a possible implementation manner of each aspect may use forms of hardware only embodiments, software only embodiments (including firmware, resident software, and the like), or embodiments with a combination of software and hardware, which are uniformly referred to as “circuit”, “module”, or “system” herein. In addition, each aspect of the present invention or the possible implementation manner of each aspect may take a form of a computer program product, where the computer program product refers to computer-readable program code stored in a computer-readable medium. 
         [0087]    The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium includes but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semi-conductive system, device, or apparatus, or any appropriate combination thereof, such as a random access memory (RAM), a read-only memory (ROM), an erasable programmable read only memory (EPROM or flash memory), an optical fiber, and a compact disc read only memory (CD-ROM). 
         [0088]    A processor in a computer reads computer-readable program code stored in a computer-readable medium, so that the processor can perform a function and an action specified in each step or a combination of steps in a flowchart; and an apparatus is generated to implement a function and an action specified in each block or a combination of blocks in a block diagram. 
         [0089]    All computer-readable program code may be executed on a user computer, or some may be executed on a user computer as a standalone software package, or some may be executed on a computer of a user while some is executed on a remote computer, or all the code may be executed on a remote computer or a server. It should also be noted that, in some alternative implementation solutions, each step in the flowcharts or functions specified in each block in the block diagrams may not occur in the illustrated order. For example, two consecutive steps or two blocks in the illustration, which are dependent on an involved function, may in fact be executed substantially at the same time, or these blocks may sometimes be executed in reverse order. 
         [0090]    Obviously, persons skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. The present invention is intended to cover these modifications and variations provided that they fall within the scope of protection defined by the following claims and their equivalent technologies.