use dd conv=sparse to copy partitions.

After writing lots of data to the output block device, the kernel will
sometimes hang in close.  See also http://b/135292499.

When the destination is not a regular file, cp ignores --sparse.  Since
the copies are to partitions in a loopback block device that was freshly
created, there is no need to write the zero blocks to it.


Change-Id: I884eb143d9cc2303e7855e78995a6c836b095f2b
Tested-by: LaMont Jones <>
Commit-Ready: LaMont Jones <>
Legacy-Commit-Queue: Commit Bot <>
Reviewed-by: Mike Frysinger <>
1 file changed