Results 1 to 3 of 3

Thread: How to copy only binary differences of a file/device?

  1. #1
    Join Date
    Dec 2005
    Beans
    28

    How to copy only binary differences of a file/device?

    Here is my dilemma:

    # Create the original file
    dd if=/dev/urandom of=file1.bin bs=1M count=100
    # Create an exact copy. Both files are now exactly the same
    cp file1.bin file2.bin
    # Change some bytes in the original file so it is different from the copy
    dd if=/dev/zero of=file1.bin bs=1M seek=10 count=1

    Now I want to copy just the 1MB of data that is different from file1.bin to file2.bin - how?
    I tried to use rsync but it copies the whole 100MB.
    zsync works but it is mainly for downloading files from the net.

    Any ideas?

    qiet72

  2. #2
    Join Date
    Apr 2006
    Location
    Ubuntuland
    Beans
    2,124
    Distro
    Ubuntu 13.10 Saucy Salamander

    Lightbulb Re: How to copy only binary differences of a file/device?

    Try xdelta: http://xdelta.org/
    24 beers in a case, 24 hours in a day. Coincidence? I think not!

    Trusty Tahr 64 bit, AMD Phenom II 955 Quad Core 3.2GHz, GeForce 9600 GT
    16G PC2-6400 RAM, 128 GB SSD, Twin 1TB SATA 7200 RPM RAID0

  3. #3
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    6,040
    Distro
    Xubuntu

    Re: How to copy only binary differences of a file/device?

    From man rsync:
    -W, --whole-file
    With this option rsync’s delta-transfer algorithm is not used and the whole file is sent as-is instead. The transfer may be faster if this option is used when the bandwidth between the source and destination machines is higher than the bandwidth to disk (especially when the "disk" is actually a networked filesystem). This is the default when both the source and destination are specified as local paths, but only if no batch-writing option is in effect.
    I don't see a way of making it use the delta algorithm on local files, but then again, I don't see a need to either. The delta should work when using remote files.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •