What happens if dd encounters errors while output of dd is being piped to gzip?

Suppose that

dd if=/dev/sda bs=100M | gzip -c > somefile.img.gz 

is done. If errors occur in dd, do I get to see error messages in terminal, or do they get ignored?

Also, suppose that dd encounters a read error. Will dd just skip the block, or will it print out error messages?


Solution 1:

You will see the error message if there is any.

There are different types of read errors and dd should always report it. If the error is continuable, dd just outputs nulls for that block. Otherwise dd will stop.

If you want to recover data, ddrescue is more error-tolerant than dd.