![]() The generated "patch" was 4.6 MB large, suggesting that only the modified bits were stored in the patch. I also tested writing the 2.3 MB modification to some other place in the abc2 data, a bit further in (at about 50 MB), as well as at the start. Note that unless you create an explicit "reverse patch", there is no way to easily undo the application of the patch. There is no error messages nor does the file's contents change (the MD5 checksum does not change). Re-applying the patch a second time seems safe. With the command rsync -read-batch=abc-diff abc, you would apply the patch to the file abc, transforming its contents to be the same as the abc2 file on the system where you created the diff. The file abc-diff could now be transferred to wherever else you have abc. This script modifies abc so that it becomes identical to abc2, given the file abc-diff: $ md5sum abc abc2 The generated file abc-diff is the actual diff (your "patch file"), while abc-diff.sh is a short shell script that rsync creates for you: $ cat abc-diff.sh rwx- 1 kk wheel 38B Feb 3 17:03 abc-diff.sh rw- 1 kk wheel 2.3M Feb 3 17:03 abc-diff We create out patch for transforming abc into abc2 and call it abc-diff: $ rsync -only-write-batch=abc-diff abc2 abc The file abc2 has been modified by overwriting the first 2.3 MB of the file with some other data: $ ls -lh This is an example with abc and abc2 being 153 MB. (I have no user experience with borgbackup, so I can't say anything about that program.)Ĭalculating and storing a diff of the abc and abc2 files can be done with rsync. The restic backup program allows you to back up directories from multiple machines to the same backup repository, deduplicating the backup data both amongst fragments of files from an individual machine as well as between machine. PS2: If possible, I don't want to use rsync I know it can replicate changes between 2 computers in an efficient way (not resending data that has not changed), but here I really want to have a patch file, that is reproducible later if I have both abc and patch.įor the second application/issue, I would use a deduplicating backup program like restic or borgbackup, rather than trying to manually keep track of "patches" or diffs. ![]() PS: for text, I know diff, but here I'm looking for something that could work for any raw binary format, it could be zip files or executables or even other types of file. Locally, instead of wasting 8 GB to backup both abc and abc2, I could save only abc + patch, so it would take < 4100 MB only. I could only send a patch file (probably max 100MB) to the distant server, instead of reuploading the whole abc2 file (it would take a few hours again!), and recreate abc2 on the distant server from abc and patch only. How to compute a binary diff of abc and abc2? ![]() I also kept the original file abc on my local computer. Now I have slightly modified the file (probably 50 MB maximum, but not consecutive bytes in this file) locally, and saved it into abc2. I have uploaded it to a distant server via SFTP, it took a few hours. Let's say I have a 4 GB file abc on my local computer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |