Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 6 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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.