Patent Publication Number: US-10769112-B2

Title: Deduplication of file

Description:
BACKGROUND 
     The present invention relates to deduplication techniques, and more specifically, to a method for deduplication of a file and an apparatus thereof. 
     Deduplication is a widely used data reduction technique in the process of backing up and archiving data, which eliminates redundant data by deleting duplicate data in data sets (for example, a file), so as to reduce a storage capacity used in the storage space. 
     Typically, the redundant data can be divided into three types: File Level, Block Level and Byte Level. In the type of File Level, the redundant data is entire files, which means one file is a duplicate of at least one other file. In the type of Block Level, the redundant data is blocks within the file, which means there are identical data blocks among different files. In the type of Byte Level, the redundant data is more fine-grained data in bytes. 
     There are some deduplication methods for these three types of redundant data. Single Instance Storage is a deduplication technique for the File Level, which can effectively detect duplicate files. When each file is stored onto a content addressable memory (CAS) device, the CAS device will generate a hash for the file content stored therein. If there are already files having an identical hash in the CAS device, the CAS device will recreate a pointer representing a duplicate to point to the already existing files, without saving the duplicate files. The deduplication technique for the Byte Level may effectively eliminate the redundant bytes by data compression technology. 
     A commonly used deduplication method is a hash-based method. In this method, firstly, the data file is segmented into a set of data blocks, and for each data block, a fingerprint (i.e. a hash value) is calculated. Then the fingerprint is used as a keyword for hash retrieving. If matching, it indicates that the data block is a duplicate data block, and only an index number of the data block is stored. If not matching, it indicates that the data block is a new data block, and the data block will be stored and the associated metadata will be created. 
     There are three kinds of chunking methods, namely, fixed-size partition (FSP), content-defined chunking (CDC) and sliding-window blocking (SB). The FSP method is to partition a file into data blocks with a fixed length, so as to quickly detect the redundant data. The CDC method and the SB method are to partition a file into data blocks with a variable size based on content of the file, so as to effectively find the redundant data. 
     However, when the deduplication is performed on a file, if the file has deduplication executed previously and is modified later, for example, new data is inserted into the file, or the original data is deleted from the file, or the data is modified in the file, which changes the length of the file, the FSP method is very sensitive to such modification, and is very inefficient. This is because the FSP method partitions the file into the fixed-size blocks. One or some data blocks obtained by partitioning the modified file will contain the modified data. Compared with the data blocks obtained by partitioning the file before the modification, the contents of the data blocks change and they become the new data blocks. Since the length of the data block is fixed, the contents in the subsequent data blocks also change due to the change in the length of the file, and these data blocks also become the new data blocks. In this way, the redundant data blocks in the file will not be actually detected, so the deduplication rate for the file is reduced. 
     Although the CDC method and the SB method can solve such a problem, it is relatively difficult to determine the size of the data blocks, which renders the deduplication speed lower than that of the FSP method. 
     SUMMARY 
     Embodiments of the present invention provide a method for deduplication of a file, computer program product, and an apparatus thereof. 
     According to one embodiment of the present invention, there is provided a method for deduplication of a file, which comprises: partitioning the file into at least one composite block, wherein the composite block includes a fixed-size block and a variable-size block, the variable-size block being determined based on content of the file; and performing a deduplication operation on the at least one composite block. 
     According to another embodiment of the present invention, there is provided an apparatus for deduplication of a file, which comprises: a partitioning module configured to partition the file into at least one composite block, wherein the composite block includes a fixed-size block and a variable-size block, the variable-size block being determined based on content of the file; and a deduplication module configured to perform a deduplication operation on the at least one composite block. 
    
    
     
       BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS 
         FIG. 1  shows a block diagram of an exemplary computer system/server  12  which is applicable to implement the embodiments of the present invention. 
         FIG. 2  is a flowchart of the method for deduplication of a file according to an embodiment of the present invention. 
         FIG. 3  is a schematic flowchart of the process for partitioning a file into at least one composite block in the embodiment shown in  FIG. 2 . 
         FIG. 4  is a schematic diagram illustrating the composite block of an embodiment of the present invention. 
         FIG. 5  is a schematic flowchart of an embodiment of the process for determining the end boundary of the variable-size block in the embodiment shown in  FIG. 3 . 
         FIG. 6  is a schematic flowchart of another embodiment of the process for determining the end boundary of the variable-size block in the embodiment shown in  FIG. 3 . 
         FIG. 7  is a schematic flowchart of a further embodiment of the process for determining the end boundary of the variable-size block in the embodiment shown in  FIG. 3 . 
         FIG. 8  is a schematic block diagram of the apparatus for deduplication of a file according to an embodiment of the present invention. 
     
    
    
     DETAILED DESCRIPTION 
     The embodiments of the present invention can execute the deduplication for the Block Level quickly and efficiently, utilize fixed-size blocks to accelerate the speed of deduplication, and utilize variable-size blocks to eliminate the influence caused by the change of the content of the file effectively. 
     Some preferable embodiments will be described in more detail with reference to the accompanying drawings, in which the preferable embodiments of the present invention have been illustrated. However, the present invention can be implemented in various manners, and thus should not be construed to be limited to the embodiments disclosed herein. On the contrary, these embodiments are provided for the thorough and complete understanding of the present invention, and to completely convey the scope of the present invention to those skilled in the art. 
     Referring now to  FIG. 1 , in which an exemplary computer system/server  12  which is applicable to implement the embodiments of the present invention is shown. Computer system/server  12  is only illustrative and is not intended to suggest any limitation as to the scope of use or functionality of embodiments of the invention described herein. 
     As shown in  FIG. 1 , computer system/server  12  is shown in the form of a general-purpose computing device. The components of computer system/server  12  may include, but are not limited to, one or more processors or processing units  16 , a system memory  28 , and a bus  18  that couples various system components including system memory  28  to the one or more processors or processing units  16 . 
     Bus  18  represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus. 
     Computer system/server  12  typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server  12 , and it includes both volatile and non-volatile media, removable and non-removable media. 
     System memory  28  can include computer system readable media in the form of volatile memory, such as random access memory (RAM)  30  and/or cache memory  32 . 
     Computer system/server  12  may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system  34  can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically called a “hard drive”). Although not shown, a magnetic disk drive for reading from and writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”), and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a CD-ROM, DVD-ROM or other optical media can be provided. In such instances, each can be connected to bus  18  by one or more data media interfaces. As will be further depicted and described below, system memory  28  may include at least one program product having a set (e.g., at least one) of program modules  42  that are configured to carry out the functions of embodiments of the invention. 
     Program/utility  40 , having a set (at least one) of program modules  42 , may be stored in system memory  28  by way of example, and not limitation, as well as an operating system, one or more application programs, other program modules, and program data. Each of the operating system, one or more application programs, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. Program modules  42  generally carry out the functions and/or methodologies of embodiments of the invention as described herein. 
     Computer system/server  12  may also communicate with one or more external devices  14  such as a keyboard, a pointing device, a display  24 , one or more other devices that enable a user to interact with computer system/server  12 , any devices (e.g., network card, modem, etc.) that enable computer system/server  12  to communicate with one or more other computing devices, etc. Such communication can occur via Input/Output (I/O) interfaces  22 . Computer system/server  12  can communicate with one or more networks such as a local area network (LAN), a general wide area network (WAN), and/or a public network (e.g., the Internet) via network adapter  20 . As depicted, network adapter  20  communicates with the other components of computer system/server  12  via bus  18 . It should be understood that although not shown, other hardware and/or software components could be used in conjunction with computer system/server  12 . Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data archival storage systems, etc. 
     With reference now to  FIG. 2 ,  FIG. 2  shows a flowchart of the method for deduplication of a file according to an embodiment of the present invention. This embodiment will be described below in detail in conjunction with the accompanying Figure. 
     As shown in  FIG. 2 , in S 210 , the file is partitioned into at least one composite block, wherein the composite block includes a fixed-size block and a variable-size block. In the present embodiment, the fixed-size block is a data block with a fixed length, and the variable-size block is a data block with a variable length. Thus, the partitioned composite blocks may have the same size or different sizes. In addition, the variable-size block is determined based on content of the file. 
     Different from other approaches where the file is partitioned into either only fixed-size blocks or variable-size blocks, in the present embodiment, the file is partitioned into the at least one composite block, wherein each composite block includes a fixed-size block and variable-size block, which thereby can increase the deduplication speed, without reducing the deduplication rate. 
       FIG. 3  shows a schematic flow diagram of the process for partitioning a file into at least one composite block (see  FIG. 2 , S 210 ). As shown in  FIG. 3 , in S 301 , firstly, a start boundary of a fixed-size block is determined. When the file is read in, starting from a head of the file, the beginning of the file is determined as the start boundary of the fixed-size block. Next, in S 305 , an end boundary of the fixed-size block is determined, so that the length of the fixed-size block is equal to a first fixed length. The first fixed length may be any predetermined length. In one example, the first fixed length may be set as 8 kilobytes (kb). Once the start boundary and the end boundary of the fixed-size block are determined, the fixed-size block can be determined. 
     Next, in S 310 , the determined end boundary of the fixed-size block is considered as a start boundary of a variable-size block, and an end boundary of the variable-size block is determined based on content of the file. The determination of the end boundary of the variable-size block will be described later. After the start boundary and the end boundary of the variable-size block have been determined, the variable-size block can be determined. The fixed-size block and the variable-size block will constitute a composite block. 
     Then, in S 315 , it is determined whether an end of the file has been reached. If the end of the file has not been reached yet, the process returns to S 301 , in which the start boundary of another fixed-size block is determined. In this case, the end boundary of the variable-size block in the previous composite block can be determined as a start boundary of the next fixed-size block. Then the process goes to S 305  to determine the end boundary of the next fixed-size block. If the end of the file has been reached, the process of partitioning the file ends. 
     Using the process of partitioning the file as shown in  FIG. 3 , the file can be partitioned into at least one composite block (e.g., composite block  1   410 ), which includes a fixed-size block with a fixed length (e.g., fixed-size block  420 ) and a variable-size block with a variable length (e.g., variable-size block  430 ), as shown in  FIG. 4 . As the length of the fixed-size block in the composite block is always fixed, the deduplication speed can be accelerated. Also as the variable-size block is determined based on the content of the file, an offset of content caused by the modification of the file can be buffered. In other words, even if the file has deduplication executed previously and later is modified, after the modified file is partitioned with the process as shown in  FIG. 3 , there is only one composite block which is different from the corresponding composite block obtained by partitioning the file before modification, and other composite blocks will not be affected. 
     For example, if the content within some fixed-size block obtained by partitioning the modified file changes due to the modification of the file, for example, new data is added or original data is removed, then the offset of content caused by such change may be eliminated by the variable-size block in the same composite block. Because the length of the fixed-size block remains unchanged, the length of the variable-size block is changed. If new data is added to the fixed-size block, the length of the variable-size block will be increased. If original data is removed in the fixed-size block, the length of the variable-size block will be shortened. Therefore, in this case, only the fixed-size block and the variable-size block in the same composite block will be influenced, the composite block becomes a new composite block, and other subsequent composite blocks are not influenced. The redundant composite blocks can still be detected, so as not to reduce the deduplication ratio. 
     For another example, if the content within some variable-size block after partitioning is changed due to the modification of the file, then as the variable-size block is obtained based on the content of the file and the length of the variable-size block can be changed, and the offset of content caused by such change may be included in the variable-size block. Therefore, only the variable-size block is influenced and becomes a new variable-size block, the fixed-size block in the same composite block and other subsequent composite block remain unchanged. So the redundant composite blocks can still be detected, so as to ensure the deduplication ratio. 
     The process of determining the end boundary of the variable-size block (see S 305 ) will be described in detail through several embodiments. 
       FIG. 5  shows a schematic flowchart of an embodiment of the process for determining an end boundary of a variable-size block. As shown in  FIG. 5 , in S 501 , starting from the end boundary of the determined fixed-size block, a sliding window having a second fixed length slides on the file, to obtain a data block within the sliding window. The second fixed length may be any predetermined length. In one example, the second fixed length may be set as 48 bytes. 
     Next, in S 505 , a hash value of the data block within the sliding window is calculated to detect the end boundary of the variable-size block. A hash algorithm for calculating a weak hash value, such as RabinHash algorithm, may be used. 
     Then, in S 510 , it is determined whether the calculated hash value of the data block meets a first predetermined condition. In the present embodiment, the first predetermined condition is a block boundary condition, which may be defined as, for example, that a hash value of a data block modulo a predetermined integer is equal to a predetermined value, wherein the predetermined value is less than the predetermined integer. The predetermined integer and the predetermined value can be set arbitrarily. Typically, the predetermined value may be set as the predetermined integer minus one. The predetermined integer may be set as a desired average length of the variable-size block. For example, the first predetermined condition may be presented as:
 
 H %  M=R  
 
where H denotes the hash value of the data block, M denotes the predetermined integer, and R denotes the predetermined value which equals to M−1.
 
     If the hash value of the data block meets the first predetermined condition, in S 520 , the current position of the sliding window is determined as the end boundary of the current variable-size block. Here, the position of the right-side boundary of the sliding window is regarded as the position of the sliding window. The right side indicates a side closer to the end of the file. If the hash value of the data block does not meet the first predetermined condition, in S 530 , the sliding window slides continuously on the file, to obtain the next data block. The sliding window may slide continuously, so that there is an interval of a predetermined length between the position of the sliding window after sliding and the previous position, wherein the predetermined length is less than or equal to a second fixed length. Thus, the obtained new data block is adjacent to or partially overlaps with the previous data block. 
     Then, returning to S 505 , a hash value is calculated for the obtained next data block. The above actions S 505  to S 530  are repeatedly executed, until the end boundary of the current variable-size block is determined. 
     However, in this embodiment, an issue that the variable-size block is too large may occur. To solve this issue, further, a maximum length for the variable-size block can be predetermined. In this case, if the determination result of S 510  is that the hash value of the data block does not meet the first predetermined condition, prior to S 530 , in S 522 , a length from the start boundary of the current variable-size block to the current position of the sliding window is determined, i.e. the size of the data over which the sliding window has slid from the start boundary of the variable-size block. Then, in S 525 , it is determined whether the determined length is less than the predetermined maximum length for the variable-size block. If the determined length is less than the predetermined maximum length for the variable-size block, S 520  is executed to continue to slide the sliding window to obtain the next data block. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, in S 528 , the position where the predetermined maximum length ends is determined as the end boundary of the current variable-size block. 
       FIG. 6  shows a schematic flowchart of another embodiment of the process for determining an end boundary of a variable-size block. In this embodiment, the actions S 601 , S 605 , S 610  and S 620  are the same as actions S 501 , S 505 , S 510  and S 520  in the embodiment shown in  FIG. 5 , whose description is properly omitted. 
     If the hash value of the data block does not meet the first predetermined condition in S 610 , in S 630 , it is determined whether the hash value of the data block meets a second predetermined condition. In the present embodiment, the second predetermined condition is a block boundary condition which is more fine-grained than the first predetermined condition, and the definition thereof is the same as that of the first predetermined condition. In the second predetermined condition, the predetermined integer is any integer smaller than the predetermined integer used in the first predetermined condition. For example, the predetermined integer in the second predetermined condition may be set as half of the predetermined integer in the first predetermined condition. Thus, the second predetermined condition may be presented as:
 
 H % M′=R′ 
 
where H denotes the hash value of the data block, M′ denotes the predetermined integer, and R′ denotes the predetermined value which equals to M′−1.
 
     If the hash value of the data block meets the second predetermined condition in S 630 , S 620  is executed, and the current position of the sliding window is determined as the end boundary of the current variable-size block. If the hash value of the data block does not meet the second predetermined condition in S 630 , in S 640 , the sliding window slides continuously on the file to obtain the next data block. Then, return to S 605  to calculate a hash value of the next data block. 
     In the present embodiment, by setting the first predetermined condition and the second predetermined condition, the size of the variable-size block can be adjusted in a more fine-grained manner. 
     Further, the maximum length for the variable-size block can also be predetermined to prevent the variable-size block being too large. In this case, if the hash value of the data block does not meet the second predetermined condition in S 630 , prior to S 640 , in S 632 , a length from the start boundary of the current variable-size block to the current position of the sliding window is determined, i.e. the size of the data over which the sliding window has slid from the start boundary of the current variable-size block. Then, in S 635 , it is determined whether the determined length is less than the predetermined maximum length for the variable-size block. If the determined length is less than the predetermined maximum length for the variable-size block, S 640  is executed to continue to slide the sliding window on the file to obtain the next data block. Then the process returns to S 605  to calculate the hash value of the next data block. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, in S 638 , the position where the predetermined maximum length ends is determined as the end boundary of the current variable-size block. 
       FIG. 7  shows a schematic flowchart of a further embodiment of the process for determining an end boundary of a variable-size block. In this embodiment, the actions S 701 , S 705 , S 710  and S 720  are the same as actions S 501 , S 505 , S 510  and S 520  in the embodiment shown in  FIG. 5 , whose description is properly omitted. Furthermore, the maximum length for the variable-size block is predetermined. 
     After the hash value of the data block has been calculated in S 705 , in parallel with S 710 , in S 730 , it is determined whether the hash value of the data block meets the second predetermined condition. In the present embodiment, the definition and setting of the second predetermined condition are the same as those of the second predetermined condition in the embodiment shown in  FIG. 6 . 
     If the hash value of the data block does not meet the second predetermined condition in S 730 , no operation is executed. If the hash value of the data block meets the second predetermined condition in S 730 , in S 735 , it is checked whether the position of the sliding window has been recorded previously for the current variable-size block, that is, whether the second predetermined condition is met for the first time for the current variable-size block. If it is checked that the position of the sliding window has been recorded previously, that is, the second predetermined condition is not met for the first time, in S 740 , the current position of the sliding window is not recorded, and the already recorded position of the sliding window is maintained. If it is checked that the position of the sliding window is not recorded previously, that is, the second predetermined condition is met for the first time, in S 745 , the current position of the sliding window is recorded as an alternative end boundary for the current variable-size block. 
     If the hash value of the data block does not meet the first predetermined condition in S 710 , in S 750 , a length from the start boundary of the current variable-size block to the current position of the sliding window is determined. Then, in S 755 , it is determined whether the determined length is less than the predetermined maximum length for the variable-size block. If the determined length is less than the predetermined maximum length for the variable-size block, in S 760 , the sliding window slides continuously on the file to obtain the next data block. Then the process returns to S 705  to calculate the hash value of the next data block. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, in S 765 , it is checked whether there is an alternative end boundary for the variable-size block. If it is checked in S 765  that there is the alternative end boundary for the variable-size block, in S 770 , the alternative end boundary is determined as the end boundary of the current variable-size block. If it is checked that there is no alternative end boundary for the variable-size block, in S 780 , the position where the predetermined maximum length ends is determined as the end boundary of the current variable-size block. 
     Returning to  FIG. 2 , after the file is partitioned into at least one packet data block, in S 220 , a deduplication operation is performed on the at least one composite block. 
     In S 220 , firstly, for each of the at least one composite block, the hash value of the fixed-size block and the hash value of the variable-size block are respectively calculated. Here, a hash algorithm such as MD5 and SHA-1 may be used for calculation to obtain the hash value that can uniquely identify the fixed-size block and the hash value that can uniquely identify the variable-size block. 
     Next, the hash value of the fixed-size block and the hash value of the variable-size block calculated are looked up in a hash table. The hash table can be used to store the hash values of data blocks and some metadata of data blocks, such as offset, reference and the like. 
     If the hash value of the fixed-size block is found in the hash table, which indicates that the fixed-size block is the duplicate data block, the fixed-size block is discarded. If the hash value of the fixed-size block is not found in the hash table, which indicates that the fixed-size block is the new data block, the fixed-size block is stored, and the hash value of the fixed-size block is stored in the hash table. 
     Similarly, if the hash value of the variable-size block is found in the hash table, which indicates that the variable-size block is the duplicate data block, the variable-size block is discarded. If the hash value of the variable-size block is not found in the hash table, which indicates that the variable-size block is the new block, the variable-size block is stored, and the hash value of the variable-size block is stored in the hash table. 
     It can be seen from the above description that the method for deduplication of a file of this embodiment can not only accelerate the deduplication speed, but also ensure the high deduplication rate by partitioning the file into the composite blocks including the fixed-size block and the variable-size block. 
     Although the above embodiments describe partitioning the file firstly to obtain all the composite blocks and then performing the deduplication operation on the respective composite blocks, those skilled in the art can appreciate that the deduplication operation can be performed on a fixed-size block or a variable-size block whenever the fixed-size block or the variable-size block is obtained by partitioning the file. 
     Under the same inventive concept,  FIG. 8  shows a schematic block diagram of the apparatus  800  for deduplication of a file according to an embodiment of the present invention. The embodiment will be described in detail below in connection with the accompanying drawings, wherein the description of the parts same as those of the previous embodiments is omitted properly. 
     As shown in  FIG. 8 , the apparatus  800  of the present embodiment may comprise: a partitioning module  801 , which is configured to partition the file into at least one composite block, wherein the composite block includes a fixed-size block and a variable-size block, the variable-size block being determined based on content of the file; and a deduplication module  802 , which is configured to perform a deduplication operation on the at least one composite block. 
     In one embodiment, in the partitioning module  801 , a fixed-size block determination module firstly determines a start boundary of a fixed-size block. When the file is read in, the fixed-size block determination module determines the beginning of the file as the start boundary of the fixed-size block. Then, the fixed-size block determination module determines an end boundary of the fixed-size block, so that a length of the fixed-size block is equal to a first fixed length. The first fixed length may be any predetermined length. Next, a variable-size block determination module determines an end boundary of the variable-size block based on the content of the file, with the end boundary of the determined fixed-size block as a start boundary of the variable-size block. The fixed-size block and the variable-size block will constitute a composite block. If the end of the file has not been reached, the fixed-size block determination module determines the start boundary of the next fixed-size block. At that time, the fixed-size block determination module determines the end boundary of the variable-size block in the previous composite block as a start boundary of the next fixed-size block, and determines the end boundary of the next fixed-size block. The fixed-size block determination module and the variable-size block determination module work alternatively until the end of the file. 
     In one embodiment, in the variable-size block determination module, a data block obtaining unit obtains a data block within a sliding window having a second fixed length starting from the end boundary of the fixed-size block. The second fixed length may be any predetermined length. Next, a calculation unit calculates a hash value of the obtained data block. Here, a hash algorithm for calculating a weak hash value such as RabinHash algorithm may be used. Then, a boundary determination unit determines the current position of the sliding window as the end boundary of the variable-size block, if the calculated hash value of the data block meets the first predetermined condition. In the present embodiment, the first predetermined condition is a block boundary condition, which may be defined as, for example, that a hash value of a data block modulo a predetermined integer is equal to the predetermined value. If the calculated hash value of the data block does not meet the first predetermined condition, the data block obtaining unit obtains the next data block by continuing to slide the sliding window on the file. 
     In another embodiment, in the variable-size block determination module, if the calculated hash value of the data block does not meet the first predetermined condition, a length determination unit determines a length from the start boundary of the current variable-size block to the current position of the sliding window. Then, if the determined length is less than a predetermined maximum length for the variable-size block, the data block obtaining unit obtains the next data block by continuing to slide the sliding window. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, the boundary determination unit determines the position where the predetermined maximum length ends as the end boundary of the current variable-size block. 
     In another embodiment, in the variable-size block determination module, if the calculated hash value of the data block does not meet the first predetermined condition but meets a second predetermined condition, the boundary determination unit determines the current position of the sliding window as the end boundary of the current variable-size block. In the present embodiment, the second predetermined condition is a block boundary condition which is more fine-grained than the first predetermined condition, and the definition thereof is same as that of the first predetermined condition. If the calculated hash value of the data block does not meet the first and the second predetermined conditions, the data block obtaining unit obtains the next data block by continuing to slide the sliding window on the file. 
     In another embodiment, in the variable-size block determination module, if the calculated hash value of the data block does not meet the first and second predetermined conditions, the length determination unit determines a length from the start boundary of the current variable-size block to the current position of the sliding window. If the determined length is less than the predetermined maximum length for the variable-size block, the data block obtaining unit obtains the next data block by continuing to slide the sliding window on the file. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, the boundary determination unit determines the position where the predetermined maximum length ends as the end boundary of the current variable-size block. 
     In another embodiment, in the variable-size block determination module, a checking unit checks whether the position of the sliding window has been recorded previously for the current variable-size block, if the calculated hash value of the data block meets the second predetermined condition. Then if it is checked that the position of the sliding window has been recorded previously, a recording unit does not record the current position of the sliding window, but maintains the recorded position of the sliding window. The recording unit also records the current position of the sliding window as an alternative end boundary for the variable-size block, if it is checked that the position of the sliding window has not been recorded previously. In parallel, the length determination unit determines a length from the start boundary of the current variable-size block to the current position of the sliding window, if the calculated hash value of the data block does not meet the first predetermined condition. Then, if the determined length is less than the predetermined maximum length for the variable-size block, the data block obtaining module obtains the next data block by continuing to slide the sliding window on the file. If the determined length is greater than or equal to the predetermined maximum length for the variable-size block, the checking unit checks whether there is an alternative end boundary for the variable-size block. Then, the boundary determination unit determines the alternative end boundary as the end boundary of the current variable-size block, if it is checked that there is the alternative end boundary for the variable-size block, and determines the position where the predetermined maximum length ends as the end boundary of the current variable-size block, if it is checked that there is no alternative end boundary for the current variable-size block. 
     In one embodiment, in deduplication module  802 , a calculation unit calculates the hash value of the fixed-size block and the hash value of the variable-size block, respectively, for each of the at least one composite data block partitioned by partitioning module  801 . Then, a lookup unit looks up the hash value of the fixed-size block and the hash value of the variable-size block in hash table  803 . If the hash value of the fixed-size block is found in hash table  803 , a discarding unit discards the corresponding fixed-size block. If the hash value of the fixed-size block is not found in hash table  803 , a storage unit stores the corresponding fixed-size block, and stores the hash value of the fixed-size block in hash table  803 . If the hash value of the variable-size block is found in hash table  803 , the discarding unit discards the corresponding variable-size block. If the hash value of the variable-size block is not found in hash table  803 , the storage unit stores the corresponding variable-size block, and stores the hash value of the variable-size block in hash table  803 . 
     It should be noted that the apparatus  800  of the present embodiment can operationally implement the method for deduplication of a file in the embodiments shown in  FIG. 2 ,  FIG. 3 ,  FIG. 5 ,  FIG. 6 , and  FIG. 7 . 
     The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention. 
     The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire. 
     Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device. 
     Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user&#39;s computer, partly on the user&#39;s computer, as a stand-alone software package, partly on the user&#39;s computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user&#39;s computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention. 
     Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions. 
     These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks. 
     The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks. 
     The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. 
     The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.