Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got two partition images (A and B) and want to use them to create a patch that I can apply on A on another computer in order to get the new B image without flooding the network. I have the following requirements:

  • works on Linux
  • can create diffs
  • can use diffs to patch files
  • can handle binary files
  • can handle large files (a few hundred GB should work)
  • no user interaction required (just a console application)
  • ideally, should be able to read from/write to pipes (so that I can pipe into it from a gzip-compressed file and write to one)

Does something like that exist?

share|improve this question
up vote 8 down vote accepted

You should probably take a look at the rsync-related tools: rdiff and rdiff-backup. The rdiff command lets you produce a patch file and apply it to some other file.

The rdiff-backup command uses this approach to deal with entire directories, but I'm guessing you're working with single-file disk images, so rdiff will be the one to use.

share|improve this answer
Thanks, rdiff looks good! – thejh May 13 '11 at 15:13

xdelta can do everything you want. Fair warning though, if your images aren't very similar, you can end up with a very large patch, because xdelta uses half of the defined memory buffer for finding differences. More information is available at the TuningMemoryBudget wiki page. Increasing the buffer size may help out quite a bit.

bsdiff is another option, but it's very RAM hungry and completely inappropriate for anything the size of a disk image.

bsdiff is quite memory-hungry. It requires max(17*n,9*n+m)+O(1) bytes of memory, where n is the size of the old file and m is the size of the new file. bspatch requires n+m+O(1) bytes.

share|improve this answer
Thank you, that one also looks good. – thejh May 13 '11 at 15:28

JDIFF is a program that outputs the differences between two (binary) files.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .