Skip to content

Instantly share code, notes, and snippets.

@jpillora
Created July 6, 2017 06:41
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpillora/edb83dc2d511c410cf46485e53569fdf to your computer and use it in GitHub Desktop.
Save jpillora/edb83dc2d511c410cf46485e53569fdf to your computer and use it in GitHub Desktop.
rdiff file example
# $ apt install rdiff
# $ rdiff --help
# Usage: rdiff [OPTIONS] signature [BASIS [SIGNATURE]]
# [OPTIONS] delta SIGNATURE [NEWFILE [DELTA]]
# [OPTIONS] patch BASIS [DELTA [NEWFILE]]
# Options:
# -v, --verbose Trace internal processing
# -V, --version Show program version
# -?, --help Show this help message
# -s, --statistics Show performance statistics
# Delta-encoding options:
# -b, --block-size=BYTES Signature block size
# -S, --sum-size=BYTES Set signature strength
# --paranoia Verify all rolling checksums
# IO options:
# -I, --input-size=BYTES Input buffer size
# -O, --output-size=BYTES Output buffer size
# create signature for old file
rdiff signature old-file signature-file
# create delta using signature file and new file
rdiff delta signature-file new-file delta-file
# generate new file using old file and delta
rdiff patch old-file delta-file gen-file
# test
diff -s gen-file new-file
# Files gen-file and new-file are identical
@amworsley
Copy link

  • Note signature is a command to generate a signature file - wasn't obvious to me
  • e.g. An example
# Generate signature into sigfile.bin
rdiff signature share/bigbinaryfile.img4 sigfile.bin
# Generate delta from generated signature file and other file
rdiff delta sigfile.bin the-other-bigbinaryfile.img4 delta.rdiff
# Patch the original file to the new file with delta.rdiff
rdiff patch share/bigbinaryfile.img4 delta.rdiff share/bigbinaryfile.img4-new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment