The background is that delta updates are faster because they read a lot, and only write the changed parts. We can do the same in rootfs updates one block at a time. Quick experiments with SD cards revealed ~3x reading speed when compared to writing speed.
Acceptance criteria:
- Mender client must do, block by block:
- Read the block
- Compare the contents of the block with the block from the rootfs update stream
- If (and only if) different, seek back to the beginning of the block and write that block from the update stream
- Proceed to next block
- The Sync() call must only performed on written blocks
- Must never read further than the length of the update stream (so the stream must be read first)
- Stretch goal: Enable for UBI writing as well
- This is likely more complicated because UBI requires an exact number of bytes to be written to be known beforehand, and that is not possibly for rootfs updates. See also this comment.
- No test is needed, since updates are already extensively tested, but a quick manual verification of the speed improvement would be good