I am attempting to make compressed incremental backups of a Windows partition using ntfsclone on Linux. Currently, I am making full ntfsclone images using something like the following command:
sudo ntfsclone -s -t -o - /dev/sda2 | xz -zc > new-backup.ntfsclone.xz
What I would like to do is perform incremental backups by creating a delta file using the previous backup and the ntfsclone output stream rather than create a new ntfsclone image each backup session.
I understand that creating diffs of binaries is not easy, and that several tools (rdiff, xdelta, bsdiff, etc.) exist for this purpose; however, they all require the two source files to be present on disk and cannot compare data directly from output streams.
In other words, are there any solutions for binary streams that do something like the following command?
diff -u <(xz -dc old-backup.ntfsclone.xz) \
<(sudo ntfsclone -s -t -o - /dev/sda2) \
| xz -zvc > new-backup.ntfsclone.delta.xz
Obviously, the above command doesn't work, but I would like to be able to decompress the old image, compare it to an ntfsclone representation of the Windows partition, and create a compressed delta image from the comparison in a single step.
A few conditions are:
- Process must use ntfsclone
- Deltas must be patchable directly to disk
- Preferably, everything takes place in a single step
It is also possible (and may be preferable) to create a delta file by restoring the ntfsclone image to pipe and creating a diff by comparing directly to /dev/sda2
, as this would likely create a smaller output file, but doing so would complicate filtering out unallocated disk space.
(That is, we would have to zero out unused disk space or do something like diff -u <(xz -dc old-backup.ntfsclone.xz | ntfsclone -r -t -o - -) <(sudo ntfsclone -t -o - /dev/sda2) | xz -zc > new-backup.img.delta.xz
to prevent archiving all of the deleted file data. Yuck!)
Any takers?
NOTE: A tool called ntfsddup by Wei Dong does exist for accomplishing almost exactly this, but I am having a hard time getting the darn thing to work. The software is in VERY early stages and needs a LOT of work.