- dd uses bs=512 by default, which is far from optimal for sequential reads.
Use bs=1048576(1M) for initial dump.
This improves read performance by a measurable amount.
- Zero-fill only the remaining blocks.
There's no need to zero-fill all blocks,
not to mention the additional/unnecessary wear and tear
to the flash storage.
Linux pipe uses bs=4096 by default. By using cat for this,
we additionally gain much better write performance.
On the OnePlus 6T, final write operation took 7.1 seconds in total with
2 consecutive dd commands. With cat, it now takes 0.08 seconds.
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>