bsdiff
uses max(17*n,9*n+m)
bytes of memory (where n is the size of the old file and m is the size of the new file) according to http://www.daemonology.net/bsdiff/
Is there a lighter (in terms of memory) alternative for me given the following circumstances?
- The changes will only take place when I am aware
- I have
sudo
power - The file is between 1 GiB and 10 GiB
My use:
- Copy file from external drive to
tmpfs
- Many, many writes will take place on the file in the
tmpfs
(I do not know where in the large binary the writes will take place) - Make the file in the external drive the same as the one in the
tmpfs
Right now, I have two solutions:
- Run
bsdiff
to get a patch (and apply the patch to the file in an external drive) - this does not work for me; the computer I am using does not have enough memory for runningbsdiff
on this large file. - Copy the whole file over to the external drive. This works, but uses up the flash erase (remember, I am working with large files) and takes a long time (redundant copying).
Note: I am able to have both the "original copy" (from the external drive) and the "working copy" (same as the one from the external drive, but will be making many changes to this file) in the tmpfs
.
Would monitoring changes as they are made to the file and building a patch from that be possible (and also more memory efficient)? If so, how?
cat {patch} >> /dir/to/patchfile.txt
;-) – Rinzwind Oct 21 '18 at 5:09