ddff - dd Flash Friendly
ddff is a utility like the dd program in GNU coreutils, but it is designed to reduce wear on flash drives by only writing modified blocks on the output device. This requires first reading from the output file or device and comparing it to the block that is to be written. This behavior is adjustable. It also improves performance on devices that have significantly faster read speeds than write speeds.
Examples:
Restore or synchronize to last week's sdc1 partition back up.
# ddff if=last_week_sdc1.img of=/dev/sdc1 bs=4K
Create and then restore a backed up lzop compressed sdb5 image.
Create: # lzop /dev/sdb5 -o /mnt/storage/sdb5.img.lzo
Restore: # lzop -c -d /mnt/storage/sdb5.img.lzo | ddff of=/dev/sdb5 bs=4K
Network synchronize sda.img.lzo to host 192.168.0.99 with netcat.
File server: # nc -N 192.168.0.99 5432 < sda.img.lzo
Target booted from live DVD: # nc -l -p 5432 | lzop -d -c | ddff of=/dev/sda bs=4K
Watch the progress of synchronizing /dev/sdc6 using mbuffer.
# mbuffer -i sdc6.img | ddff of=/dev/sdc6 bs=4K
Synchronize file badfile to file goodfile quickly, where large contiguous areas have been changed and other contigous areas are unchanged, without the overhead of reading from every block on badfile first. This way it will read only one block, and if changed, write the remaining 127 blocks too without checking to see if they were modified.
# ddff if=goodfile of=badfile bs=16K oldway=128
To make ddff behave like dd, for block devices, set oldway= to a big number. For files, delete the output file first.
# dd of=<path> oldway=100000000
ddff does not implement filesystem cache hints, whereas dd does. Linux will probably try to cache entire files.
Download:
ddff-dd_flash_friendly-0.1-testing.tar
This is a shared shell server, so don't trust the included binary and inspect the source code briefly. I doubt anyone would do anything, but you never know.