If you are absolutely sure there were zero-filled blocks then the reason you saved no space was the large buffer you used. From man dd:
sparse try to seek rather than write the output for NUL input blocks
You used bs=32M, so you needed a whole 32 MiB block of zeros at a right offset for the conv=sparse option to do its job if only just once.
The option bs sets ibs (input block size) and obs (output block size). While the manual mentions input blocks, it is actually the obs that matters.
Here are the results of some tests. (As I am the OP, I did the tests with the very same device.) Each file is named according to <obs_used>.img pattern. Pay attention to the first column:
$ ls -hlst *.img
250M -rw-r--r-- 1 root root 250M Oct 18 22:02 4M.img
250M -rw-r--r-- 1 root root 250M Oct 18 22:02 2M.img
249M -rw-r--r-- 1 root root 250M Oct 18 22:02 1M.img
248M -rw-r--r-- 1 root root 250M Oct 18 22:01 512K.img
248M -rw-r--r-- 1 root root 250M Oct 18 22:01 256K.img
247M -rw-r--r-- 1 root root 250M Oct 18 22:00 128K.img
247M -rw-r--r-- 1 root root 250M Oct 18 21:57 64K.img
247M -rw-r--r-- 1 root root 250M Oct 18 21:56 32K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:55 16K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:54 8K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:53 4K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:52 2K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:51 1K.img
246M -rw-r--r-- 1 root root 250M Oct 18 21:44 512.img
The conclusion is: you shouldn't use large obs with conv=sparse option. The common sector size is 512 bytes, so bs=512 seems just right. Your command should have been:
dd if=/dev/sdb of=myusb.img conv=sparse bs=512
sparseoption actually working, but the saving is so small that it doesn't seem worth the trouble. Maybe you should fill the free space on the old device with an all-0x00 file and then delete it, before actually dumping the image with dd? – Fred Qian Oct 23 '22 at 02:05bs=512? What were your good reasons? Given the limited total size and the name you gave I can imagine that the source is a USB key? If yes, unless this is a brand new key or unless you have explicitly written a file full of zeros on it, I wouldn't expect many sectors containing only zeros. – PierU Oct 24 '22 at 08:18bsseems better whenconv=sparseis used. – Kamil Maciorowski Oct 24 '22 at 08:28conv=sparsewould not save a significant amount of written blocks, without taking into account that the context in not the same (this is a SSD involved, so there are reasons to expect a different behavior compared to a USB key that has likely not even a garbage collection mechanism). You're not responsible for such wild extrapolation, but nonetheless it would be useful IMHO to update your answer and comment about the amount of saved space. – PierU Oct 24 '22 at 08:46