Data deduplication: http://en.wikipedia.org/wiki/Data_deduplication
During data backup or transmission, compression is often performed to reduce storage or bandwidth overhead. This is to use the CPU cycle for storage or bandwidth.
There are already many compression algorithms. Data deduplication is another type of compression: deduplication is performed through redundancy between files or between file blocks ).
When uploading a large file, after local computation, the page prompts the user that the file already exists on the server, in this way, you do not need to upload it again. This is a typical example of data deduplication.
File-level deduplication is the most common. Typical application scenarios include:
1. attachments and large attachments in QQ mail;
2. Offline download functions of QQ tornado and thunder;
3. Various Network disks in disorder;
4. Distribution of new software versions, such as cernvm-FS (cvmfs uses content-addressable storage, a very similar concept ).
The similarities between these scenarios are: different software versions (4), attachments uploaded by different users (1, 3), and files to be downloaded by different users (2, 3). We can easily guess that some popular resources (such as favorite video files and Windows Installation images) are included in files (1), (2), and (3) there will be a large number of users to use, through data deduplication, can greatly reduce the storage overhead and network communication overhead.
You can also think about it here, for example, the offline download function of thunder or the 115 network disk. If you just upload and download some popular resources, you can claim to be a 10 Gb space, it may be shared with others, Hoho.
Another application scenario is that for virtual servers, many system files are the same for different virtual servers (for example, centos is installed on six virtual servers). deduplication is performed on these files, this reduces the storage overhead of the machine running the virtual server.
The data deduplication method is very simple. Calculate the fingerprint of a file (Block) and compare whether there are duplicates. If yes, only the tag is used, instead of storing a copy.
This process can be online or offline, that is, the difference between in-line process and post process;
It can be distinguished based on the operation location. The process can occur in the data production area or the target storage device, that is, the difference between source deduplication and target deduplication.
To calculate the file fingerprint, you must use the cryptographic hash function, such as SHA-1. Although hash will certainly have a collision, the probability of a collision is much lower than that of other faults, so it can be ignored.
In implementation, we can use two hash and one weak hash for optimization. The calculation speed is faster, but the collision probability increases. Strong hash can use cryptographic hash, although there is a collision in theory, now that no one on earth can find it, there is no right.
For more conservative people, after strong hash, such as SHA-1, even if the SHA-1 fingerprint is the same, they are still afraid that they will encounter a SHA-1 collision. The two files are not the same, then they can compare two files bit by bit, so that they can rest assured. In my opinion, conservative is not necessarily a bad thing, but they use the wrong place, rather than afraid that SHA-1 will collision, it is better to directly on the SHA-512, and then if still met, no one will blame you, but those in the password field should thank you for finding a collision.
Update: Dropbox has been scolded recently. See http://internet.solidot.org/article.pl? SID = 11/05/16/064217
From the description, it is easy to guess that Dropbox has performed data deduplication on the user's file. We can easily understand why Dropbox needs to do so for the allegations that Dropbox only saves one file copy:
1. The main cost of Dropbox is the bandwidth to upload files to Amazon, and the storage space of files in Amazon (downloading files is an inevitable overhead, so do not consider it, to reduce storage overhead and upload file bandwidth overhead, deduplication of user files is very attractive.
2. During the upload process, a file fingerprint is calculated locally (is it local to the user, so they do not need to consume their CPU cycle) and then sent to the server, the server checks whether the file already exists. If yes, just mark it and do not upload it. In this way, both bandwidth and hard disk are saved.
Data deduplication conflicts with encryption. To reassure users (no one wants their files to be stored in the cloud in plain text), Dropbox claims that the files are encrypted. Therefore, this encryption process is usually put on the server side, and Dropbox must know the encryption key. This is because encryption is a kind of pseudo-random permutation. It makes no sense to deduplication encrypted files, because even if the files are identical, after encryption with different keys, the content will be significantly different (or, completely different ).
To keep files encrypted, you can still perform data deduplication. Dropbox can only do this:
1. files stored in Amazon are encrypted, but Dropbox has a decryption key;
2. When file a is uploaded, the fingerprint is calculated and then sent to the server for comparison. If the fingerprint of file a is the same as that of file B, it will not be uploaded;
3. file encryption can occur on the client (which is inconsistent with the charges against Dropbox in the above link), but Dropbox must have an encryption (that is, decryption) key, so there is no difference;
4. When file a is downloaded, the server knows that file A is not actually stored, but points to file B. It needs to get the encrypted version of file B and decrypt it on its own, return as a after decryption.
Therefore, it is not difficult to understand why Dropbox's encryption key management and encryption process are challenged. The question about key management is yes, and Dropbox must have a key; otherwise, deduplication will fail; the question about the encryption process is not too powerful, because the encryption process can be placed on the client (the so-called client backup deduplication, see the corresponding entry in the wikidata duplication entry), it is a big deal to calculate a hash and then send it to the server, but since the server has a key, so it doesn't matter where it happened, and it's impossible to make it more insecure.